Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Oct 21, 2024
1 parent b513a92 commit c01123a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/backend/src/routes/uploadRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import util from "node:util";
import { pipeline } from "node:stream";
import { getPictureName } from "../services/uploadService";
import { db } from "../db/db";
import { makeDebug } from "../features/debug";

const debug = makeDebug("upload");
const pump = util.promisify(pipeline);

export const uploadPlugin: FastifyPluginAsyncTypebox = async (fastify, _) => {
Expand All @@ -28,10 +30,12 @@ export const uploadPlugin: FastifyPluginAsyncTypebox = async (fastify, _) => {
name: getPictureName(reportId, id),
});

debug("adding url to pic", id, "for report", reportId);

// await db.pictures.create({ data: { id, url, reportId, createdAt: new Date() } });
await db.pictures.update({ where: { id }, data: { url } });

reply.send();
reply.send(url);

// for await (const file of files) {
// const isImage = ["image/png", "image/jpeg", "image/jpg"].includes(file.mimetype);
Expand Down

0 comments on commit c01123a

Please sign in to comment.