fix: oprava závislostí
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
This commit is contained in:
@@ -3,7 +3,6 @@ import { getDateForWeekIndex, getData, getRestaurantMenu, getToday, initIfNeeded
|
|||||||
import { formatDate, getDayOfWeekIndex } from "../utils";
|
import { formatDate, getDayOfWeekIndex } from "../utils";
|
||||||
import getStorage from "../storage";
|
import getStorage from "../storage";
|
||||||
import { getWebsocket } from "../websocket";
|
import { getWebsocket } from "../websocket";
|
||||||
import { GenerateMockDataData, ClearMockDataData, LunchChoice, Restaurant } from "../../../types";
|
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const storage = getStorage();
|
const storage = getStorage();
|
||||||
@@ -18,22 +17,22 @@ const MOCK_NAMES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Volby stravování pro mock data
|
// Volby stravování pro mock data
|
||||||
const LUNCH_CHOICES: LunchChoice[] = [
|
const LUNCH_CHOICES = [
|
||||||
LunchChoice.SLADOVNICKA,
|
'SLADOVNICKA',
|
||||||
LunchChoice.TECHTOWER,
|
'TECHTOWER',
|
||||||
LunchChoice.ZASTAVKAUMICHALA,
|
'ZASTAVKAUMICHALA',
|
||||||
LunchChoice.SENKSERIKOVA,
|
'SENKSERIKOVA',
|
||||||
LunchChoice.OBJEDNAVAM,
|
'OBJEDNAVAM',
|
||||||
LunchChoice.NEOBEDVAM,
|
'NEOBEDVAM',
|
||||||
LunchChoice.ROZHODUJI,
|
'ROZHODUJI',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Restaurace s menu
|
// Restaurace s menu
|
||||||
const RESTAURANTS_WITH_MENU: LunchChoice[] = [
|
const RESTAURANTS_WITH_MENU = [
|
||||||
LunchChoice.SLADOVNICKA,
|
'SLADOVNICKA',
|
||||||
LunchChoice.TECHTOWER,
|
'TECHTOWER',
|
||||||
LunchChoice.ZASTAVKAUMICHALA,
|
'ZASTAVKAUMICHALA',
|
||||||
LunchChoice.SENKSERIKOVA,
|
'SENKSERIKOVA',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +50,7 @@ router.use(requireDevMode);
|
|||||||
/**
|
/**
|
||||||
* Vygeneruje mock data pro testování.
|
* 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 {
|
try {
|
||||||
const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday());
|
const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday());
|
||||||
const count = req.body?.count ?? Math.floor(Math.random() * 16) + 5; // 5-20
|
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
|
// Získání menu restaurací pro vybraný den
|
||||||
const menus: { [key: string]: any } = {};
|
const menus: { [key: string]: any } = {};
|
||||||
for (const restaurant of RESTAURANTS_WITH_MENU) {
|
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) {
|
if (menu?.food?.length) {
|
||||||
menus[restaurant] = menu.food;
|
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.
|
* 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 {
|
try {
|
||||||
const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday());
|
const dayIndex = req.body?.dayIndex ?? getDayOfWeekIndex(getToday());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user