Browse Source

store mime_type for each file

pull/1/head
Trent Larson 9 months ago
parent
commit
119429bdea
  1. 3
      server.js
  2. 1
      sql/migrations/V1__Create_image_table.sql

3
server.js

@ -179,7 +179,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => {
const handleId = req.body.handleId; const handleId = req.body.handleId;
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
db.run( 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, currentDate,
issuerDid, issuerDid,
@ -188,6 +188,7 @@ app.post('/image', uploadMulter.single('image'), async (req, res) => {
localFile, localFile,
reqFile.size, reqFile.size,
fileName, fileName,
reqFile.mimetype,
finalUrl finalUrl
], ],
(dbErr) => { (dbErr) => {

1
sql/migrations/V1__Create_image_table.sql

@ -7,6 +7,7 @@ CREATE TABLE image (
local_file TEXT NOT NULL, local_file TEXT NOT NULL,
size INTEGER NOT NULL, size INTEGER NOT NULL,
final_file TEXT NOT NULL, final_file TEXT NOT NULL,
mime_type TEXT NOT NULL,
url TEXT NOT NULL url TEXT NOT NULL
); );

Loading…
Cancel
Save