S3 file upload support
This commit is contained in:
parent
fb98314bf4
commit
778b629fde
15 changed files with 539 additions and 404 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
9
backend/src/app/models/S3FileLink.ts
Normal file
9
backend/src/app/models/S3FileLink.ts
Normal 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");
|
||||
Loading…
Reference in a new issue