-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* photo pipelining, switch to using mysql2/promise for better transactions * fix casing * utilize transactions, generateDB models * add logging * rename DB models acccordingly * double check mime type on backend * fix mime time casing and account creation * remove unused sql from init procedure
- Loading branch information
1 parent
004d23a
commit b9f45d7
Showing
42 changed files
with
1,226 additions
and
1,602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import multer from "multer"; | ||
import path from "path"; | ||
|
||
const storage = multer.memoryStorage(); | ||
|
||
// multer for uploading images | ||
export const imageUploadMiddleware = multer({ | ||
storage, | ||
fileFilter: (_req, file, cb) => { | ||
// Allowed ext | ||
const allowedExts = ['jpeg', 'jpg', 'png', 'gif']; | ||
// Check ext | ||
const extname = allowedExts.includes(path.extname(file.originalname).replace('.', '').toLowerCase()); | ||
// Check mime | ||
const mimetype = allowedExts.map(ext => `image/${ext}`).includes(file.mimetype); | ||
|
||
if(mimetype && extname){ | ||
cb(null, true); | ||
} else { | ||
cb(null, false); | ||
} | ||
} | ||
}).single('image'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.