- Rewrite db.md as canonical schema: add categories, sessions tables; add alias to accounts, is_category_confirmed/comment to transactions, FK references to categories(id); mark budgets as post-MVP - Fix account masking to use fixed 6 asterisks (code + docs) - Remove budgets from MVP requirements in agent_backend.md - Add explicit 'not in MVP' note to analytics.md budgets section - Fix test_Statement.json: convert amounts to kopecks (integers), remove fingerprint fields (computed by backend) Made-with: Cursor
19 lines
590 B
TypeScript
19 lines
590 B
TypeScript
import { Request, Response, NextFunction } from 'express';
|
|
|
|
export function maskAccountNumber(num: string): string {
|
|
if (num.length <= 10) return num;
|
|
return num.slice(0, 6) + '******' + 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);
|
|
};
|
|
}
|