Skip to content

Commit

Permalink
fix lint errors, add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianka committed Jun 11, 2024
1 parent 3862b94 commit 4325473
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/routes/deleteBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function registerDeleteBoxRoute(
prisma: PrismaClient,
) {
fastify.delete<{ Params: RouteParams }>(
"/box/:id",
"/boxes/:id",
{ schema: deleteBoxSchema },
async function handler(request, reply) {
try {
Expand All @@ -18,6 +18,7 @@ export async function registerDeleteBoxRoute(
where: { id: numericId },
});

console.log("Box deleted:", box);
reply.code(200).send({ message: "Box deleted successfully." });
} catch (error) {
console.log(
Expand Down
1 change: 1 addition & 0 deletions backend/src/routes/getBoxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export async function registerGetBoxesRoute(
fastify.get("/boxes", async function handler(_request, reply) {
try {
const boxes = await prisma.boxes.findMany();
console.log("Boxes fetched");
reply.code(200).send(boxes);
} catch (error) {
reply.code(500).send({
Expand Down
1 change: 1 addition & 0 deletions backend/src/routes/postBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export async function registerPostBoxesRoute(
},
});

console.log("Box created:", box);
reply.code(201).send(box);
} catch (error) {
reply.code(500).send({
Expand Down
1 change: 1 addition & 0 deletions backend/src/routes/putBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export async function registerPutBoxRoute(
},
});

console.log("Box updated:", updatedBox);
return reply.code(200).send(updatedBox);
} catch (error) {
console.log(
Expand Down

0 comments on commit 4325473

Please sign in to comment.