feat: exclude/unexclude the uncategorized transactions

This commit is contained in:
Ahmed Bouhuolia
2024-06-20 13:50:29 +02:00
parent b6deb842ff
commit b37002bea6
8 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { ServiceError } from '@/exceptions';
import UncategorizedCashflowTransaction from '@/models/UncategorizedCashflowTransaction';
const ERRORS = {
TRANSACTION_ALREADY_CATEGORIZED: 'TRANSACTION_ALREADY_CATEGORIZED',
};
export const validateTransactionNotCategorized = (
transaction: UncategorizedCashflowTransaction
) => {
if (transaction.categorized) {
throw new ServiceError(ERRORS.TRANSACTION_ALREADY_CATEGORIZED);
}
};