refactor: enforce enum machine codes
Backend security / security (push) Successful in 8s
Backend security / security (pull_request) Canceled after 0s
Backend verify / verify (push) Canceled after 9s
Backend verify / verify (pull_request) Canceled after 4s
Conventional commits / commits (pull_request) Successful in 31s
Backend security / security (push) Successful in 8s
Backend security / security (pull_request) Canceled after 0s
Backend verify / verify (push) Canceled after 9s
Backend verify / verify (pull_request) Canceled after 4s
Conventional commits / commits (pull_request) Successful in 31s
Use owner enums for error and T-Bank protocol values with ESLint regression checks. Preserve open wire fallbacks and keep protocol imports independent of DI and Prisma. Verified npm ci, verify, 226 unit tests, 262 isolated e2e tests and unchanged OpenAPI.
This commit is contained in:
@@ -22,24 +22,23 @@ import {
|
||||
const NEXT_MONTH_OFFSET = 1;
|
||||
const PREVIOUS_MONTH_LAST_DAY = 0;
|
||||
|
||||
export const BankErrorCode = {
|
||||
InvalidInput: 'BANK_INVALID_INPUT',
|
||||
VersionConflict: 'BANK_VERSION_CONFLICT',
|
||||
NotFound: 'BANK_NOT_FOUND',
|
||||
InvalidMoney: 'BANK_INVALID_MONEY',
|
||||
InvalidDate: 'BANK_INVALID_DATE',
|
||||
ImmutableOperation: 'BANK_IMMUTABLE_OPERATION',
|
||||
InvalidRefund: 'BANK_INVALID_REFUND',
|
||||
RefundLimit: 'BANK_REFUND_LIMIT',
|
||||
DependentRefunds: 'BANK_DEPENDENT_REFUNDS',
|
||||
IntentConflict: 'BANK_INTENT_CONFLICT',
|
||||
OperationDeleted: 'BANK_OPERATION_DELETED',
|
||||
CardArchived: 'BANK_CARD_ARCHIVED',
|
||||
OpeningDateConflict: 'BANK_OPENING_DATE_CONFLICT',
|
||||
WriteConflict: 'BANK_WRITE_CONFLICT',
|
||||
DuplicateCategory: 'BANK_DUPLICATE_CATEGORY',
|
||||
} as const;
|
||||
export type BankErrorCode = (typeof BankErrorCode)[keyof typeof BankErrorCode];
|
||||
export enum BankErrorCode {
|
||||
CardArchived = 'BANK_CARD_ARCHIVED',
|
||||
DependentRefunds = 'BANK_DEPENDENT_REFUNDS',
|
||||
DuplicateCategory = 'BANK_DUPLICATE_CATEGORY',
|
||||
ImmutableOperation = 'BANK_IMMUTABLE_OPERATION',
|
||||
IntentConflict = 'BANK_INTENT_CONFLICT',
|
||||
InvalidDate = 'BANK_INVALID_DATE',
|
||||
InvalidInput = 'BANK_INVALID_INPUT',
|
||||
InvalidMoney = 'BANK_INVALID_MONEY',
|
||||
InvalidRefund = 'BANK_INVALID_REFUND',
|
||||
NotFound = 'BANK_NOT_FOUND',
|
||||
OpeningDateConflict = 'BANK_OPENING_DATE_CONFLICT',
|
||||
OperationDeleted = 'BANK_OPERATION_DELETED',
|
||||
RefundLimit = 'BANK_REFUND_LIMIT',
|
||||
VersionConflict = 'BANK_VERSION_CONFLICT',
|
||||
WriteConflict = 'BANK_WRITE_CONFLICT',
|
||||
}
|
||||
|
||||
export function fail(code: BankErrorCode = BankErrorCode.InvalidInput): never {
|
||||
throw new BadRequestException({ code });
|
||||
|
||||
Reference in New Issue
Block a user