Files
bigcapital/packages/server/src/services/Banking/Exclude/utils.ts
2024-06-20 13:50:29 +02:00

15 lines
441 B
TypeScript

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);
}
};