diff --git a/server/src/routes/devRoutes.ts b/server/src/routes/devRoutes.ts index 99aa1bb..066ca6b 100644 --- a/server/src/routes/devRoutes.ts +++ b/server/src/routes/devRoutes.ts @@ -3,7 +3,6 @@ import { getDateForWeekIndex, getData, getRestaurantMenu, getToday, initIfNeeded import { formatDate, getDayOfWeekIndex } from "../utils"; import getStorage from "../storage"; import { getWebsocket } from "../websocket"; -import { GenerateMockDataData, ClearMockDataData, LunchChoice, Restaurant } from "../../../types"; const router = express.Router(); const storage = getStorage(); @@ -18,22 +17,22 @@ const MOCK_NAMES = [ ]; // Volby stravování pro mock data -const LUNCH_CHOICES: LunchChoice[] = [ - LunchChoice.SLADOVNICKA, - LunchChoice.TECHTOWER, - LunchChoice.ZASTAVKAUMICHALA, - LunchChoice.SENKSERIKOVA, - LunchChoice.OBJEDNAVAM, - LunchChoice.NEOBEDVAM, - LunchChoice.ROZHODUJI, +const LUNCH_CHOICES = [ + 'SLADOVNICKA', + 'TECHTOWER', + 'ZASTAVKAUMICHALA', + 'SENKSERIKOVA', + 'OBJEDNAVAM', + 'NEOBEDVAM', + 'ROZHODUJI', ]; // Restaurace s menu -const RESTAURANTS_WITH_MENU: LunchChoice[] = [ - LunchChoice.SLADOVNICKA, - LunchChoice.TECHTOWER, - LunchChoice.ZASTAVKAUMICHALA, - LunchChoice.SENKSERIKOVA, +const RESTAURANTS_WITH_MENU = [ + 'SLADOVNICKA', + 'TECHTOWER', + 'ZASTAVKAUMICHALA', + 'SENKSERIKOVA', ]; /** @@ -51,7 +50,7 @@ router.use(requireDevMode); /** * Vygeneruje mock data pro testování. */ -router.post("/generate", async (req: Request<{}, any, GenerateMockDataData["body"]>, res, next) => { +router.post("/generate", async (req: Request<{}, any, any>, res, next) => { try { const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday()); const count = req.body?.count ?? Math.floor(Math.random() * 16) + 5; // 5-20 @@ -69,7 +68,7 @@ router.post("/generate", async (req: Request<{}, any, GenerateMockDataData["body // Získání menu restaurací pro vybraný den const menus: { [key: string]: any } = {}; for (const restaurant of RESTAURANTS_WITH_MENU) { - const menu = await getRestaurantMenu(restaurant as Restaurant, date); + const menu = await getRestaurantMenu(restaurant as any, date); if (menu?.food?.length) { menus[restaurant] = menu.food; } @@ -125,7 +124,7 @@ router.post("/generate", async (req: Request<{}, any, GenerateMockDataData["body /** * Smaže všechny volby pro daný den. */ -router.post("/clear", async (req: Request<{}, any, ClearMockDataData["body"]>, res, next) => { +router.post("/clear", async (req: Request<{}, any, any>, res, next) => { try { const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday());