Skip to content

Commit

Permalink
a few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleveille committed Jun 8, 2024
1 parent c735a36 commit f4a125d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controllers/bag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const initBagRoutes = (app: Elysia) => {
});

/* Add disc to bag (bearer auth secured) */
app.put("/bag/add-disc", async ({ request, body }) => {
app.patch("/bag/add-disc", async ({ request, body }) => {
assertIsRequestAuthorized(request);
const { id, disc_id } = parseBody(body) as { id: string; disc_id: string };
if (!id) throw new BadRequestError("Required body field missing: id");
Expand All @@ -55,7 +55,7 @@ export const initBagRoutes = (app: Elysia) => {
});

/* Remove disc from bag (bearer auth secured) */
app.put("/bag/remove-disc", async ({ request, body }) => {
app.patch("/bag/remove-disc", async ({ request, body }) => {
assertIsRequestAuthorized(request);
const { id, disc_id } = parseBody(body) as { id: string; disc_id: string };
if (!id) throw new BadRequestError("Required body field missing: id");
Expand All @@ -71,7 +71,7 @@ export const initBagRoutes = (app: Elysia) => {
});

/* Update name of bag (bearer auth secured) */
app.put("/bag/update-name", async ({ request, body }) => {
app.patch("/bag/update-name", async ({ request, body }) => {
assertIsRequestAuthorized(request);
const { id, name } = parseBody(body) as { id: string; name: string };
if (!id) throw new BadRequestError("Required body field missing: id");
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useErrorHandler = (app: Elysia) => {
message?: string;
status?: number;
};
!Config.IS_PROD && log.error(`${new Date().toISOString()} ${request.method} ${path} ${status}: ${message}`);
!Config.IS_PROD && log.error(`${new Date().toISOString()} ${request.method} ${path} ${status} ${message}`);
return { error: message };
});
};
2 changes: 1 addition & 1 deletion src/middleware/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export const useLogger = (app: Elysia) => {
app.onResponse(({ request, error, path }) => {
const { message } = error as { message?: string };
if (message) return;
!Config.IS_PROD && log.info(`${new Date().toISOString()} ${request.method} ${path} 200`);
!Config.IS_PROD && log.info(`${new Date().toISOString()} ${request.method} ${path} 200 OK`);
});
};
2 changes: 1 addition & 1 deletion src/services/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const startServer = () => {
app.listen(Config.PORT, () =>
log.info(
`Server started in ${Config.IS_PROD ? "production" : "development"} mode` +
` - listening on port ${app.server.port}.`
` - listening on port ${app.server.port}...`
)
);
};

0 comments on commit f4a125d

Please sign in to comment.