enable public report
This commit is contained in:
parent
8f563d1058
commit
41c3093754
21 changed files with 307 additions and 19 deletions
|
@ -2,6 +2,7 @@ import multer from "multer";
|
|||
import { FileSystemHelper } from "../helpers/fileSystemHelper";
|
||||
import path from "path";
|
||||
import BadRequestException from "../exceptions/badRequestException";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
/**Settings image upload */
|
||||
export const clubImageStorage = multer.diskStorage({
|
||||
|
@ -58,3 +59,28 @@ export const inspectionFileMulter = multer({
|
|||
});
|
||||
|
||||
export const inspectionFileUpload = inspectionFileMulter.array("files");
|
||||
|
||||
/**public damage report upload */
|
||||
export const pDamageReportFileStorage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
FileSystemHelper.createFolder("damageReport");
|
||||
cb(null, FileSystemHelper.formatPath("damageReport"));
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
const fileExtension = path.extname(file.originalname).toLowerCase();
|
||||
cb(null, uuid() + fileExtension);
|
||||
},
|
||||
});
|
||||
|
||||
export const pDamageReportFileMulter = multer({
|
||||
storage: pDamageReportFileStorage,
|
||||
fileFilter(req, file, cb) {
|
||||
if (file.mimetype.startsWith("image/")) {
|
||||
cb(null, true);
|
||||
} else {
|
||||
cb(new BadRequestException("Wrong file format"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const pDamageReportFileUpload = pDamageReportFileMulter.array("images");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue