From 119429bdea5123138c323c7edf3d490ff7bbf9cf Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 11 Mar 2024 20:10:15 -0600 Subject: [PATCH] store mime_type for each file --- server.js | 3 ++- sql/migrations/V1__Create_image_table.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index a68f5a0..679514e 100644 --- a/server.js +++ b/server.js @@ -179,7 +179,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => { const handleId = req.body.handleId; await new Promise((resolve, reject) => { db.run( - 'INSERT INTO image (time, did, claim_type, handle_id, local_file, size, final_file, url) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', + 'INSERT INTO image (time, did, claim_type, handle_id, local_file, size, final_file, mime_type, url) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', [ currentDate, issuerDid, @@ -188,6 +188,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => { localFile, reqFile.size, fileName, + reqFile.mimetype, finalUrl ], (dbErr) => { diff --git a/sql/migrations/V1__Create_image_table.sql b/sql/migrations/V1__Create_image_table.sql index 748d8a6..9f33da0 100644 --- a/sql/migrations/V1__Create_image_table.sql +++ b/sql/migrations/V1__Create_image_table.sql @@ -7,6 +7,7 @@ CREATE TABLE image ( local_file TEXT NOT NULL, size INTEGER NOT NULL, final_file TEXT NOT NULL, + mime_type TEXT NOT NULL, url TEXT NOT NULL );