diff --git a/src/routes/api/v1/user.ts b/src/routes/api/v1/user.ts index bda9001..a3be81d 100644 --- a/src/routes/api/v1/user.ts +++ b/src/routes/api/v1/user.ts @@ -95,7 +95,7 @@ async function post(req: Request, res: Response) { .create({ data: { name: value.name, - code: (value.code === '0000') ? null : value.code + code: value.code === '0000' ? null : value.code }, select: { id: true @@ -125,7 +125,7 @@ async function patch(req: Request, res: Response) { }, data: { name: value.name, - code: (value.code === '0000') ? null : value.code + code: value.code === '0000' ? null : value.code }, select: { id: true @@ -156,7 +156,8 @@ async function del(req: Request, res: Response) { }) .then((result) => { res.status(200).json({ status: 'DELETED', message: 'Successfully deleted user', id: result.id }); - }).catch((err) => { + }) + .catch((err) => { handlePrismaError(err, res, 'DEL user'); }); } diff --git a/src/routes/index.ts b/src/routes/index.ts index 32e3258..243d0c0 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,8 +1,7 @@ import express from 'express'; import path from 'node:path'; -import __path from "../handlers/path.js"; -import log from "../handlers/log.js"; - +import __path from '../handlers/path.js'; +import log from '../handlers/log.js'; // Route imports import frontend_routes from './frontend/index.js'; @@ -12,7 +11,7 @@ const Router = express.Router({ strict: false }); // static / libs routes Router.use('/static', express.static(__path + '/static')); -Router.use('/libs/bulma', express.static(path.join(__path, 'node_modules', 'bulma', 'css'))); // http://192.168.221.10:3000/libs/bulma/bulma.css +Router.use('/libs/bulma', express.static(path.join(__path, 'node_modules', 'bulma', 'css'))); // /libs/bulma/bulma.css Router.use('/libs/jquery', express.static(path.join(__path, 'node_modules', 'jquery', 'dist'))); Router.use('/libs/bootstrap-icons', express.static(path.join(__path, 'node_modules', 'bootstrap-icons'))); @@ -20,7 +19,6 @@ Router.use('/libs/bootstrap-icons', express.static(path.join(__path, 'node_modul Router.use('/api', api_routes); Router.use('/', frontend_routes); - // Default route. Router.all('*', function (req, res) { // TODO: Respond based on content-type (with req.is('application/json'))