inspection finish and print
This commit is contained in:
parent
0f3e4488f4
commit
9ef82adef7
12 changed files with 358 additions and 76 deletions
|
@ -3,6 +3,7 @@ import { FileSystemHelper } from "../helpers/fileSystemHelper";
|
|||
import path from "path";
|
||||
import BadRequestException from "../exceptions/badRequestException";
|
||||
|
||||
/**Settings image upload */
|
||||
export const clubImageStorage = multer.diskStorage({
|
||||
destination: FileSystemHelper.formatPath("/app"),
|
||||
filename: function (req, file, cb) {
|
||||
|
@ -33,3 +34,27 @@ export const clubImageUpload = clubImageMulter.fields([
|
|||
{ name: "icon", maxCount: 1 },
|
||||
{ name: "logo", maxCount: 1 },
|
||||
]);
|
||||
|
||||
/**Inspection file upload */
|
||||
export const inspectionFileStorage = multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
FileSystemHelper.createFolder("inspection", req.params.id);
|
||||
cb(null, FileSystemHelper.formatPath("inspection", req.params.id));
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname);
|
||||
},
|
||||
});
|
||||
|
||||
export const inspectionFileMulter = multer({
|
||||
storage: inspectionFileStorage,
|
||||
fileFilter(req, file, cb) {
|
||||
if (file.mimetype.startsWith("image/") || file.mimetype === "application/pdf") {
|
||||
cb(null, true);
|
||||
} else {
|
||||
cb(new BadRequestException("Wrong file format"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const inspectionFileUpload = inspectionFileMulter.array("files");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue