From 94186a3a181236ef255d8877a9518da6e2f705c3 Mon Sep 17 00:00:00 2001 From: grey Date: Mon, 10 Jul 2023 17:36:59 +0200 Subject: [PATCH] removed redundant getAll attribute --- src/routes/api/v1/storageLocations.ts | 7 +------ src/routes/api/v1/storageUnits.ts | 7 +------ static/js/editStorages.js | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/routes/api/v1/storageLocations.ts b/src/routes/api/v1/storageLocations.ts index bf9ec29..87c3343 100644 --- a/src/routes/api/v1/storageLocations.ts +++ b/src/routes/api/v1/storageLocations.ts @@ -14,12 +14,7 @@ async function get(req: Request, res: Response) { req.query.search = ''; } - if (req.query.getAll === undefined) { - // Check if required fields are present. - if (!req.query.id) { - res.status(400).json({ status: 'ERROR', errorcode: 'VALIDATION_ERROR', message: 'One or more required fields are missing' }); - return; - } + if (req.query.id) { prisma.storageLocation .findUnique({ where: { diff --git a/src/routes/api/v1/storageUnits.ts b/src/routes/api/v1/storageUnits.ts index 7ea87bb..8faf547 100644 --- a/src/routes/api/v1/storageUnits.ts +++ b/src/routes/api/v1/storageUnits.ts @@ -14,12 +14,7 @@ async function get(req: Request, res: Response) { if (req.query.search === undefined) { req.query.search = ''; } - if (req.query.getAll === undefined) { - // Check if required fields are present. - if (!req.query.id) { - res.status(400).json({ status: 'ERROR', errorcode: 'VALIDATION_ERROR', message: 'One or more required fields are missing' }); - return; - } + if (req.query.id) { prisma.storageUnit .findUnique({ where: { diff --git a/static/js/editStorages.js b/static/js/editStorages.js index ff9fb7f..7a18308 100644 --- a/static/js/editStorages.js +++ b/static/js/editStorages.js @@ -138,8 +138,8 @@ const itemList = $('#itemList'); const itemListUnit = $('#itemListUnit'); // itemList.empty(); -itemListUnit.bootstrapTable({ url: '/api/v1/storageUnits?getAll=true', search: true, showRefresh: true, responseHandler: dataResponseHandlerUnit, sidePagination: 'server', serverSort: true, silentSort: false }); -itemList.bootstrapTable({ url: '/api/v1/storageLocations?getAll=true', search: true, showRefresh: true, responseHandler: dataResponseHandler, sidePagination: 'server', serverSort: true, silentSort: false }); +itemListUnit.bootstrapTable({ url: '/api/v1/storageUnits', search: true, showRefresh: true, responseHandler: dataResponseHandlerUnit, sidePagination: 'server', serverSort: true, silentSort: false }); +itemList.bootstrapTable({ url: '/api/v1/storageLocations', search: true, showRefresh: true, responseHandler: dataResponseHandler, sidePagination: 'server', serverSort: true, silentSort: false }); setTimeout(() => { activateTooltips(); }, 1000);