S3 file upload support

This commit is contained in:
oitsjustjose 2022-04-16 00:32:32 -05:00
commit 778b629fde
15 changed files with 539 additions and 404 deletions

View file

@ -1,5 +1,5 @@
import { Request, Response } from "express";
import Products from "../../../models/Product";
import Product from "../../../models/Product";
import { LOGGER } from "../../../util/Logger";
export default async (req: Request, res: Response) => {
@ -8,7 +8,7 @@ export default async (req: Request, res: Response) => {
return res.status(403).send();
}
const tmp = new Products(req.body);
const tmp = new Product(req.body);
await tmp.save();
return res.status(200).json(tmp);
} catch (ex) {

View file

@ -0,0 +1,9 @@
import { Document, model, Schema } from "mongoose";
export type FileModel = Document & { key: string };
const FileSchema = new Schema<FileModel>({
key: { type: String, required: true },
});
export default model<FileModel>("files", FileSchema, "files");