feat: creates backend for the project

This commit is contained in:
vakabunga
2026-03-02 00:32:37 +03:00
parent 9d12702688
commit 4d67636633
24 changed files with 1735 additions and 0 deletions

18
backend/src/utils.ts Normal file
View File

@@ -0,0 +1,18 @@
import { Request, Response, NextFunction } from 'express';
export function maskAccountNumber(num: string): string {
if (num.length <= 10) return num;
return num.slice(0, 6) + '*'.repeat(num.length - 10) + num.slice(-4);
}
export function escapeLike(input: string): string {
return input.replace(/\\/g, '\\\\').replace(/%/g, '\\%').replace(/_/g, '\\_');
}
type AsyncHandler = (req: Request, res: Response, next: NextFunction) => Promise<void>;
export function asyncHandler(fn: AsyncHandler) {
return (req: Request, res: Response, next: NextFunction) => {
fn(req, res, next).catch(next);
};
}