refactor: opravy dle SonarQube
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 33s
CI / Playwright E2E tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 33s
CI / Playwright E2E tests (push) Has been cancelled
CI / Build and push Docker image (push) Has been cancelled
CI / Notify (push) Has been cancelled
This commit is contained in:
@@ -30,10 +30,10 @@ router.post("/add", async (req: Request<{}, any, AddPizzaData["body"]>, res) =>
|
||||
const salatIndex = req.body.salatIndex;
|
||||
const salaty = await getSalatList();
|
||||
if (!salaty) {
|
||||
throw Error("Selhalo získání seznamu dostupných salátů.");
|
||||
throw new Error("Selhalo získání seznamu dostupných salátů.");
|
||||
}
|
||||
if (!salaty[salatIndex]) {
|
||||
throw Error("Neplatný index salátu: " + salatIndex);
|
||||
throw new Error("Neplatný index salátu: " + salatIndex);
|
||||
}
|
||||
const data = await addSalatOrder(login, salaty[salatIndex]);
|
||||
getWebsocket().emit("message", data);
|
||||
@@ -41,22 +41,22 @@ router.post("/add", async (req: Request<{}, any, AddPizzaData["body"]>, res) =>
|
||||
} else {
|
||||
// Přidání pizzy
|
||||
if (req.body?.pizzaIndex === undefined || isNaN(req.body.pizzaIndex)) {
|
||||
throw Error("Nebyl předán index pizzy ani salátu");
|
||||
throw new Error("Nebyl předán index pizzy ani salátu");
|
||||
}
|
||||
const pizzaIndex = req.body.pizzaIndex;
|
||||
if (req.body?.pizzaSizeIndex === undefined || isNaN(req.body.pizzaSizeIndex)) {
|
||||
throw Error("Nebyl předán index velikosti pizzy");
|
||||
throw new Error("Nebyl předán index velikosti pizzy");
|
||||
}
|
||||
const pizzaSizeIndex = req.body.pizzaSizeIndex;
|
||||
let pizzy = await getPizzaList();
|
||||
if (!pizzy) {
|
||||
throw Error("Selhalo získání seznamu dostupných pizz.");
|
||||
throw new Error("Selhalo získání seznamu dostupných pizz.");
|
||||
}
|
||||
if (!pizzy[pizzaIndex]) {
|
||||
throw Error("Neplatný index pizzy: " + pizzaIndex);
|
||||
throw new Error("Neplatný index pizzy: " + pizzaIndex);
|
||||
}
|
||||
if (!pizzy[pizzaIndex].sizes[pizzaSizeIndex]) {
|
||||
throw Error("Neplatný index velikosti pizzy: " + pizzaSizeIndex);
|
||||
throw new Error("Neplatný index velikosti pizzy: " + pizzaSizeIndex);
|
||||
}
|
||||
const data = await addPizzaOrder(login, pizzy[pizzaIndex], pizzy[pizzaIndex].sizes[pizzaSizeIndex]);
|
||||
getWebsocket().emit("message", data);
|
||||
@@ -67,7 +67,7 @@ router.post("/add", async (req: Request<{}, any, AddPizzaData["body"]>, res) =>
|
||||
router.post("/remove", async (req: Request<{}, any, RemovePizzaData["body"]>, res) => {
|
||||
const login = getLogin(parseToken(req));
|
||||
if (!req.body?.pizzaOrder) {
|
||||
throw Error("Nebyla předána objednávka");
|
||||
throw new Error("Nebyla předána objednávka");
|
||||
}
|
||||
const data = await removePizzaOrder(login, req.body?.pizzaOrder);
|
||||
getWebsocket().emit("message", data);
|
||||
@@ -106,7 +106,7 @@ router.post("/updatePizzaDayNote", async (req: Request<{}, any, UpdatePizzaDayNo
|
||||
const login = getLogin(parseToken(req));
|
||||
try {
|
||||
if (req.body.note && req.body.note.length > 70) {
|
||||
throw Error("Poznámka může mít maximálně 70 znaků");
|
||||
throw new Error("Poznámka může mít maximálně 70 znaků");
|
||||
}
|
||||
const data = await updatePizzaDayNote(login, req.body.note);
|
||||
getWebsocket().emit("message", data);
|
||||
|
||||
Reference in New Issue
Block a user