Files
flyer-crawler.projectium.com/src/routes/personalization.routes.ts
Torben Sorensen e39a7560ee
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m57s
home page errors in progress
2025-12-09 23:11:09 -08:00

47 lines
1.6 KiB
TypeScript

// src/routes/personalization.routes.ts
import { Router, Request, Response, NextFunction } from 'express';
import * as db from '../services/db/index.db';
import { logger } from '../services/logger.server';
const router = Router();
/**
* GET /api/personalization/master-items - Get the master list of all grocery items.
*/
router.get('/master-items', async (req: Request, res: Response, next: NextFunction) => {
try {
const masterItems = await db.personalizationRepo.getAllMasterItems();
res.json(masterItems);
} catch (error) {
logger.error('Error fetching master items in /api/personalization/master-items:', { error });
next(error);
}
});
/**
* GET /api/personalization/dietary-restrictions - Get the master list of all dietary restrictions.
*/
router.get('/dietary-restrictions', async (req: Request, res: Response, next: NextFunction) => {
try {
const restrictions = await db.personalizationRepo.getDietaryRestrictions();
res.json(restrictions);
} catch (error) {
logger.error('Error fetching dietary restrictions in /api/personalization/dietary-restrictions:', { error });
next(error);
}
});
/**
* GET /api/personalization/appliances - Get the master list of all kitchen appliances.
*/
router.get('/appliances', async (req: Request, res: Response, next: NextFunction) => {
try {
const appliances = await db.personalizationRepo.getAppliances();
res.json(appliances);
} catch (error) {
logger.error('Error fetching appliances in /api/personalization/appliances:', { error });
next(error);
}
});
export default router;