The BIG frontend update

This commit is contained in:
2023-05-16 22:58:08 +02:00
parent 04b5bd60f2
commit bd9f629690
22 changed files with 459 additions and 56 deletions

View File

@ -80,7 +80,7 @@ async function patch(req: Request, res: Response) {
});
if (result === null) {
res.status(410).json({ error: 'category does not exist.' });
res.status(410).json({ error: 'Category does not exist.' });
return;
}
} catch (err) {

View File

@ -4,12 +4,17 @@ import express from 'express';
import testRoute from './test.js';
import categoryRoute from './categories.js';
import storageUnitRoute from './storageUnits.js';
import storageLocationRoute from './storageLocations.js';
// Router base is '/api/v1'
const Router = express.Router({ strict: false });
Router.route('/categories').get(categoryRoute.get).post(categoryRoute.post).patch(categoryRoute.patch).delete(categoryRoute.del);
// TODO: Migrate routes to lowercase.
Router.route('/storageUnits').get(storageUnitRoute.get).post(storageUnitRoute.post).patch(storageUnitRoute.patch).delete(storageUnitRoute.del);
Router.route('/storageLocations').get(storageLocationRoute.get).post(storageLocationRoute.post).patch(storageLocationRoute.patch).delete(storageLocationRoute.del);
Router.route('/test').get(testRoute.get);
export default Router;