fix: remove dead code, add ZodError handling, fix NaN pagination, add like routes, fix schemesCount sync
This commit is contained in:
@@ -15,7 +15,9 @@ const TARGET_TYPES = ['SCHEME', 'SCHEME_AOB', 'FILTER'] as const;
|
||||
router.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { type, page = 1, limit = 20 } = req.query;
|
||||
const skip = (Number(page) - 1) * Number(limit);
|
||||
const pageNum = Math.max(1, parseInt(String(page)) || 1);
|
||||
const limitNum = Math.min(100, Math.max(1, parseInt(String(limit)) || 20));
|
||||
const skip = (pageNum - 1) * limitNum;
|
||||
|
||||
const where: any = { userId: req.user!.userId };
|
||||
if (type && TARGET_TYPES.includes(type as any)) {
|
||||
|
||||
Reference in New Issue
Block a user