@ozdao/prometheus-framework 0.2.32 → 0.2.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/events.server.js +31 -0
  2. package/dist/events.server.mjs +31 -0
  3. package/dist/files.server.js +99 -78
  4. package/dist/files.server.mjs +99 -78
  5. package/dist/globals.server.js +0 -1
  6. package/dist/globals.server.mjs +0 -1
  7. package/dist/main.css +1 -1
  8. package/dist/prometheus-framework.cjs.js +21 -21
  9. package/dist/prometheus-framework.es.js +1037 -1023
  10. package/package.json +1 -1
  11. package/src/components/Countdown/Countdown.vue +75 -0
  12. package/src/components/EditImages/EditImages.vue +10 -2
  13. package/src/components/Upload/Upload.vue +32 -6
  14. package/src/components/UploadImage/UploadImage.vue +12 -8
  15. package/src/components/UploadImageMultiple/UploadImageMultiple.vue +4 -2
  16. package/src/modules/events/components/pages/EditEvent.vue +304 -2
  17. package/src/modules/events/components/pages/Event.vue +128 -46
  18. package/src/modules/events/components/sections/HeroEvent.vue +161 -0
  19. package/src/modules/events/components/sections/SectionLineup.vue +42 -0
  20. package/src/modules/events/components/sections/SectionMainGuest.vue +104 -0
  21. package/src/modules/events/components/sections/SectionPreviousEvents.vue +119 -0
  22. package/src/modules/events/components/sections/SectionSpecialGuests.vue +47 -0
  23. package/src/modules/events/controllers/events.controller.js +1 -0
  24. package/src/modules/events/controllers/utils/queryProcessor.js +2 -0
  25. package/src/modules/events/models/event.model.js +29 -0
  26. package/src/modules/events/store/events.js +4 -0
  27. package/src/modules/files/controllers/files.controller.js +3 -0
  28. package/src/modules/files/middlewares/server/middlewareBusboy.js +115 -100
  29. package/src/modules/files/routes/files.routes.js +3 -4
  30. package/src/modules/globals/globals.server.js +0 -1
  31. package/src/modules/marketplace/components/pages/Catalog.vue +1 -0
  32. package/src/modules/orders/components/blocks/CardOrder.vue +5 -5
  33. package/src/modules/orders/components/blocks/StatusHistory.vue +84 -0
  34. package/src/modules/orders/components/pages/Order.vue +11 -54
  35. package/src/modules/orders/controllers/orders.controller.js +17 -9
  36. package/src/modules/orders/models/order.model.js +19 -0
  37. package/src/modules/orders/routes/orders.routes.js +4 -1
  38. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
  39. package/src/modules/users/components/pages/Profile.vue +1 -1
@@ -163,6 +163,8 @@ function getProjectStage() {
163
163
  date: 1,
164
164
  numberOfTickets: 1,
165
165
  participantsPhotos: 1,
166
+ special: 1,
167
+ specialData: 1,
166
168
  hasTicket: 1,
167
169
  tickets: 1,
168
170
  createdAt: 1
@@ -290,6 +292,7 @@ const middlewareFactory = (db) => {
290
292
  }
291
293
  };
292
294
  const update = async (req, res) => {
295
+ console.log(req.body);
293
296
  try {
294
297
  const event = await Event.findOneAndUpdate({ url: req.body.url }, { $set: req.body }, { new: true }).exec();
295
298
  if (!event) {
@@ -555,6 +558,34 @@ var event_model = (db) => {
555
558
  end: {
556
559
  type: Date
557
560
  }
561
+ },
562
+ specialData: {
563
+ type: Object,
564
+ default: () => ({
565
+ subtitle: "NMS Presents",
566
+ ticketPrice: "499",
567
+ ticketImage: null,
568
+ ticketLinkStripe: null,
569
+ video: null,
570
+ guests: [],
571
+ guestVideo: null,
572
+ guestTitle: null,
573
+ guestDescription: null,
574
+ guestFacebook: null,
575
+ guestInstagram: null,
576
+ guestTelegram: null,
577
+ guestTwitter: null,
578
+ guestSoundcloud: null,
579
+ guestSpotify: null,
580
+ logos: [],
581
+ lineup: [],
582
+ lineupBackground: null
583
+ })
584
+ },
585
+ // Adding special boolean property
586
+ special: {
587
+ type: Boolean,
588
+ default: false
558
589
  }
559
590
  }, {
560
591
  timestamps: {
@@ -161,6 +161,8 @@ function getProjectStage() {
161
161
  date: 1,
162
162
  numberOfTickets: 1,
163
163
  participantsPhotos: 1,
164
+ special: 1,
165
+ specialData: 1,
164
166
  hasTicket: 1,
165
167
  tickets: 1,
166
168
  createdAt: 1
@@ -288,6 +290,7 @@ const middlewareFactory = (db) => {
288
290
  }
289
291
  };
290
292
  const update = async (req, res) => {
293
+ console.log(req.body);
291
294
  try {
292
295
  const event = await Event.findOneAndUpdate({ url: req.body.url }, { $set: req.body }, { new: true }).exec();
293
296
  if (!event) {
@@ -553,6 +556,34 @@ var event_model = (db) => {
553
556
  end: {
554
557
  type: Date
555
558
  }
559
+ },
560
+ specialData: {
561
+ type: Object,
562
+ default: () => ({
563
+ subtitle: "NMS Presents",
564
+ ticketPrice: "499",
565
+ ticketImage: null,
566
+ ticketLinkStripe: null,
567
+ video: null,
568
+ guests: [],
569
+ guestVideo: null,
570
+ guestTitle: null,
571
+ guestDescription: null,
572
+ guestFacebook: null,
573
+ guestInstagram: null,
574
+ guestTelegram: null,
575
+ guestTwitter: null,
576
+ guestSoundcloud: null,
577
+ guestSpotify: null,
578
+ logos: [],
579
+ lineup: [],
580
+ lineupBackground: null
581
+ })
582
+ },
583
+ // Adding special boolean property
584
+ special: {
585
+ type: Boolean,
586
+ default: false
556
587
  }
557
588
  }, {
558
589
  timestamps: {
@@ -5,13 +5,14 @@ const index = require("./index-a8dffc0c.js");
5
5
  const require$$0$1 = require("sharp");
6
6
  const require$$1 = require("fs");
7
7
  const require$$2 = require("fs/promises");
8
- require("os");
9
- const require$$5 = require("busboy");
8
+ const require$$4 = require("busboy");
10
9
  require("jsonwebtoken");
11
10
  require("mongodb");
12
11
  const path = require$$0;
13
12
  const controllerFactory$1 = (db, publicPath) => {
14
13
  const uploadMultipleFileController = async (req, res, next) => {
14
+ console.log("uploadMultipleFileController called");
15
+ console.log("Files received:", req.files ? req.files.length : 0);
15
16
  if (!req.files || req.files.length === 0) {
16
17
  return res.status(400).send({ message: "No files uploaded." });
17
18
  }
@@ -45,98 +46,119 @@ function requireMiddlewareBusboy() {
45
46
  const fs = require$$1;
46
47
  const fsp = require$$2;
47
48
  const path2 = require$$0;
48
- const busboy = require$$5;
49
+ const busboy = require$$4;
49
50
  const createThumbnail = async (originalPath) => {
50
51
  const thumbnailPath = path2.join(
51
52
  path2.dirname(originalPath),
52
53
  "thumbnail_" + path2.basename(originalPath)
53
54
  );
54
55
  try {
55
- await sharp(originalPath).rotate().resize({ width: 800 }).toFile(thumbnailPath);
56
+ const metadata = await sharp(originalPath).metadata();
57
+ const resizeOptions = {};
58
+ if (metadata.width > 800) {
59
+ resizeOptions.width = 800;
60
+ }
61
+ await sharp(originalPath).rotate().resize(resizeOptions).toFile(thumbnailPath);
56
62
  } catch (error) {
57
63
  console.error("Error creating thumbnail:", error);
64
+ throw error;
58
65
  }
59
66
  };
67
+ const handleFileUpload = (req, res, next, publicPath, { folderNameDefault = "unsorted", maxSize = 10 * 1024 * 1024, allowedTypes = null }) => {
68
+ console.log("handleFileUpload middleware called");
69
+ console.log("Options:" + folderNameDefault + maxSize + allowedTypes);
70
+ let folderName = req.query.folderName || folderNameDefault;
71
+ folderName = decodeURIComponent(folderName);
72
+ folderName = folderName.startsWith("/") ? folderName : "/" + folderName;
73
+ const filePath = path2.join(publicPath, folderName);
74
+ let files = [];
75
+ let filesWrongSize = [];
76
+ let filesWrongType = [];
77
+ let fileProcessingPromises = [];
78
+ const bb = busboy({
79
+ headers: req.headers,
80
+ limits: { fileSize: maxSize }
81
+ });
82
+ bb.on("file", (name, file, info) => {
83
+ console.log(`Received file: ${info.filename}, Type: ${info.mimeType}`);
84
+ const isValidType = !allowedTypes || allowedTypes.includes(info.mimeType);
85
+ if (!isValidType) {
86
+ console.log(`File of wrong type: ${info.filename}`);
87
+ filesWrongType.push(info.filename);
88
+ file.resume();
89
+ return;
90
+ }
91
+ const fileName = `${Math.floor(Math.random() * 1e4)}-${info.filename}`;
92
+ const fileFullPath = path2.join(filePath, fileName);
93
+ const fileProcess = fsp.mkdir(path2.dirname(fileFullPath), { recursive: true }).then(() => new Promise((resolve, reject) => {
94
+ const stream = file.pipe(fs.createWriteStream(fileFullPath));
95
+ stream.on("finish", () => {
96
+ files.push(path2.relative(publicPath, fileFullPath));
97
+ resolve();
98
+ });
99
+ stream.on("error", reject);
100
+ }));
101
+ fileProcessingPromises.push(fileProcess);
102
+ file.on("limit", () => {
103
+ filesWrongSize.push(info.filename);
104
+ fsp.unlink(fileFullPath).catch((err) => console.error(`Error deleting oversized file: ${err.message}`));
105
+ });
106
+ });
107
+ bb.on("finish", () => {
108
+ Promise.all(fileProcessingPromises).then(() => {
109
+ console.log(`Upload finished. Files: ${files.length}, Wrong Size: ${filesWrongSize.length}, Wrong Type: ${filesWrongType.length}`);
110
+ req.files = files;
111
+ if (files.length === 0 && (filesWrongSize.length > 0 || filesWrongType.length > 0)) {
112
+ let errorMessage = "No files uploaded.";
113
+ if (filesWrongSize.length > 0) {
114
+ errorMessage += " Some files were too large.";
115
+ }
116
+ if (filesWrongType.length > 0) {
117
+ errorMessage += " Some files were of an unsupported type.";
118
+ }
119
+ return res.status(400).json({ message: errorMessage });
120
+ }
121
+ next();
122
+ }).catch((error) => {
123
+ console.error("Failed processing one or more files", error);
124
+ res.status(500).json({ message: "Error processing files" });
125
+ });
126
+ });
127
+ req.pipe(bb);
128
+ };
60
129
  const middlewareFactory = (db, publicPath) => {
61
130
  const generatePreviewMiddleware = async (req, res, next) => {
62
- const files = req.file ? [req.file] : req.files;
131
+ const files = req.files;
63
132
  try {
64
- await Promise.all(files.map((file) => createThumbnail(file)));
133
+ await Promise.all(files.map((file) => createThumbnail(path2.join(publicPath, file))));
65
134
  } catch (error) {
66
135
  console.error("Error generating previews:", error);
136
+ return res.status(500).json({ message: "Internal server error while generating previews." });
67
137
  }
68
138
  next();
69
139
  };
70
- const uploadMultipleFilesMiddleware = (req, res, next) => {
71
- let folderName = req.query.folderName || "unsorted";
72
- if (!folderName.startsWith("/")) {
73
- folderName = "/" + folderName;
74
- }
75
- let files = [];
76
- let filesWrongSize = [];
77
- let filesWrongType = [];
78
- let filePath = path2.join(publicPath, folderName);
79
- let filePromise;
80
- try {
81
- const bb = busboy({
82
- headers: req.headers,
83
- limits: {
84
- fileSize: 10 * 1024 * 1024
85
- }
86
- });
87
- bb.on("error", (err) => {
88
- next(err);
89
- });
90
- let fileFullPath;
91
- bb.on("file", (name2, file, info) => {
92
- if (info.filename.length > 0) {
93
- file.resume();
94
- }
95
- if (info.mimeType != "image/png" && info.mimeType != "image/jpeg" && info.mimeType != "image/gif") {
96
- filesWrongType.push(info.filename);
97
- file.resume();
98
- }
99
- let fileName = `${Math.floor(Math.random() * 1e4)}-${info.filename}`;
100
- fileFullPath = path2.join(filePath, fileName);
101
- fileRelativePath = path2.join(folderName, fileName);
102
- filePromise = new Promise((resolve, reject) => {
103
- const writeStream = fs.createWriteStream(fileFullPath).on("error", reject).on("finish", resolve);
104
- file.on("error", reject);
105
- file.pipe(writeStream);
106
- });
107
- files.push(fileFullPath);
108
- file.on("limit", () => {
109
- filesWrongSize.push(info.filename);
110
- fsp.unlink(fileFullPath);
111
- const index2 = files.indexOf(fileFullPath);
112
- if (index2 !== -1) {
113
- files.splice(index2, 1);
114
- }
115
- file.resume();
116
- });
117
- });
118
- bb.on("close", async () => {
119
- try {
120
- if (!filePromise) {
121
- res.status(400).json({ message: `Uploaded file '${name}' is missing` });
122
- return;
123
- }
124
- await filePromise;
125
- req.files = files;
126
- next();
127
- } catch (err) {
128
- next(err);
129
- } finally {
130
- bb.removeAllListeners();
131
- }
132
- });
133
- req.pipe(bb);
134
- } catch (err) {
135
- res.status(400).json({ message: `Could not retrieve file from request - ${err.message}` });
136
- }
140
+ const uploadFilesMiddleware = (req, res, next) => {
141
+ const allowedTypes = [
142
+ "image/png",
143
+ "image/jpeg",
144
+ "image/jpg",
145
+ "image/gif",
146
+ "application/pdf",
147
+ "image/svg+xml",
148
+ "video/mp4",
149
+ "video/quicktime",
150
+ // MOV
151
+ "video/webm"
152
+ ];
153
+ handleFileUpload(req, res, next, publicPath, { folderNameDefault: "unsorted", maxSize: 10 * 1024 * 1024, allowedTypes });
154
+ };
155
+ const uploadImagesMiddleware = (req, res, next) => {
156
+ const allowedTypes = ["image/png", "image/jpeg", "image/jpg", "image/gif"];
157
+ handleFileUpload(req, res, next, publicPath, { folderNameDefault: "unsorted", maxSize: 10 * 1024 * 1024, allowedTypes });
137
158
  };
138
159
  return {
139
- uploadMultipleFilesMiddleware,
160
+ uploadImagesMiddleware,
161
+ uploadFilesMiddleware,
140
162
  generatePreviewMiddleware
141
163
  };
142
164
  };
@@ -169,7 +191,7 @@ var files_routes = function(app, db, origins, publicPath) {
169
191
  app.post(
170
192
  "/api/upload/image",
171
193
  [
172
- middlewareBusboy2.uploadMultipleFilesMiddleware,
194
+ middlewareBusboy2.uploadImagesMiddleware,
173
195
  middlewareBusboy2.generatePreviewMiddleware
174
196
  ],
175
197
  controller.uploadMultipleFileController
@@ -177,15 +199,14 @@ var files_routes = function(app, db, origins, publicPath) {
177
199
  app.post(
178
200
  "/api/upload/file",
179
201
  [
180
- middlewareBusboy2.uploadMultipleFilesMiddleware,
181
- middlewareBusboy2.generatePreviewMiddleware
202
+ middlewareBusboy2.uploadFilesMiddleware
182
203
  ],
183
204
  controller.uploadMultipleFileController
184
205
  );
185
206
  app.post(
186
207
  "/api/upload/multiple",
187
208
  [
188
- middlewareBusboy2.uploadMultipleFilesMiddleware,
209
+ middlewareBusboy2.uploadImagesMiddleware,
189
210
  middlewareBusboy2.generatePreviewMiddleware
190
211
  ],
191
212
  controller.uploadMultipleFileController
@@ -4,13 +4,14 @@ import { s as server$1 } from "./index-d769324d.mjs";
4
4
  import require$$0$1 from "sharp";
5
5
  import require$$1 from "fs";
6
6
  import require$$2 from "fs/promises";
7
- import "os";
8
- import require$$5 from "busboy";
7
+ import require$$4 from "busboy";
9
8
  import "jsonwebtoken";
10
9
  import "mongodb";
11
10
  const path = require$$0;
12
11
  const controllerFactory$1 = (db, publicPath) => {
13
12
  const uploadMultipleFileController = async (req, res, next) => {
13
+ console.log("uploadMultipleFileController called");
14
+ console.log("Files received:", req.files ? req.files.length : 0);
14
15
  if (!req.files || req.files.length === 0) {
15
16
  return res.status(400).send({ message: "No files uploaded." });
16
17
  }
@@ -44,98 +45,119 @@ function requireMiddlewareBusboy() {
44
45
  const fs = require$$1;
45
46
  const fsp = require$$2;
46
47
  const path2 = require$$0;
47
- const busboy = require$$5;
48
+ const busboy = require$$4;
48
49
  const createThumbnail = async (originalPath) => {
49
50
  const thumbnailPath = path2.join(
50
51
  path2.dirname(originalPath),
51
52
  "thumbnail_" + path2.basename(originalPath)
52
53
  );
53
54
  try {
54
- await sharp(originalPath).rotate().resize({ width: 800 }).toFile(thumbnailPath);
55
+ const metadata = await sharp(originalPath).metadata();
56
+ const resizeOptions = {};
57
+ if (metadata.width > 800) {
58
+ resizeOptions.width = 800;
59
+ }
60
+ await sharp(originalPath).rotate().resize(resizeOptions).toFile(thumbnailPath);
55
61
  } catch (error) {
56
62
  console.error("Error creating thumbnail:", error);
63
+ throw error;
57
64
  }
58
65
  };
66
+ const handleFileUpload = (req, res, next, publicPath, { folderNameDefault = "unsorted", maxSize = 10 * 1024 * 1024, allowedTypes = null }) => {
67
+ console.log("handleFileUpload middleware called");
68
+ console.log("Options:" + folderNameDefault + maxSize + allowedTypes);
69
+ let folderName = req.query.folderName || folderNameDefault;
70
+ folderName = decodeURIComponent(folderName);
71
+ folderName = folderName.startsWith("/") ? folderName : "/" + folderName;
72
+ const filePath = path2.join(publicPath, folderName);
73
+ let files = [];
74
+ let filesWrongSize = [];
75
+ let filesWrongType = [];
76
+ let fileProcessingPromises = [];
77
+ const bb = busboy({
78
+ headers: req.headers,
79
+ limits: { fileSize: maxSize }
80
+ });
81
+ bb.on("file", (name, file, info) => {
82
+ console.log(`Received file: ${info.filename}, Type: ${info.mimeType}`);
83
+ const isValidType = !allowedTypes || allowedTypes.includes(info.mimeType);
84
+ if (!isValidType) {
85
+ console.log(`File of wrong type: ${info.filename}`);
86
+ filesWrongType.push(info.filename);
87
+ file.resume();
88
+ return;
89
+ }
90
+ const fileName = `${Math.floor(Math.random() * 1e4)}-${info.filename}`;
91
+ const fileFullPath = path2.join(filePath, fileName);
92
+ const fileProcess = fsp.mkdir(path2.dirname(fileFullPath), { recursive: true }).then(() => new Promise((resolve, reject) => {
93
+ const stream = file.pipe(fs.createWriteStream(fileFullPath));
94
+ stream.on("finish", () => {
95
+ files.push(path2.relative(publicPath, fileFullPath));
96
+ resolve();
97
+ });
98
+ stream.on("error", reject);
99
+ }));
100
+ fileProcessingPromises.push(fileProcess);
101
+ file.on("limit", () => {
102
+ filesWrongSize.push(info.filename);
103
+ fsp.unlink(fileFullPath).catch((err) => console.error(`Error deleting oversized file: ${err.message}`));
104
+ });
105
+ });
106
+ bb.on("finish", () => {
107
+ Promise.all(fileProcessingPromises).then(() => {
108
+ console.log(`Upload finished. Files: ${files.length}, Wrong Size: ${filesWrongSize.length}, Wrong Type: ${filesWrongType.length}`);
109
+ req.files = files;
110
+ if (files.length === 0 && (filesWrongSize.length > 0 || filesWrongType.length > 0)) {
111
+ let errorMessage = "No files uploaded.";
112
+ if (filesWrongSize.length > 0) {
113
+ errorMessage += " Some files were too large.";
114
+ }
115
+ if (filesWrongType.length > 0) {
116
+ errorMessage += " Some files were of an unsupported type.";
117
+ }
118
+ return res.status(400).json({ message: errorMessage });
119
+ }
120
+ next();
121
+ }).catch((error) => {
122
+ console.error("Failed processing one or more files", error);
123
+ res.status(500).json({ message: "Error processing files" });
124
+ });
125
+ });
126
+ req.pipe(bb);
127
+ };
59
128
  const middlewareFactory = (db, publicPath) => {
60
129
  const generatePreviewMiddleware = async (req, res, next) => {
61
- const files = req.file ? [req.file] : req.files;
130
+ const files = req.files;
62
131
  try {
63
- await Promise.all(files.map((file) => createThumbnail(file)));
132
+ await Promise.all(files.map((file) => createThumbnail(path2.join(publicPath, file))));
64
133
  } catch (error) {
65
134
  console.error("Error generating previews:", error);
135
+ return res.status(500).json({ message: "Internal server error while generating previews." });
66
136
  }
67
137
  next();
68
138
  };
69
- const uploadMultipleFilesMiddleware = (req, res, next) => {
70
- let folderName = req.query.folderName || "unsorted";
71
- if (!folderName.startsWith("/")) {
72
- folderName = "/" + folderName;
73
- }
74
- let files = [];
75
- let filesWrongSize = [];
76
- let filesWrongType = [];
77
- let filePath = path2.join(publicPath, folderName);
78
- let filePromise;
79
- try {
80
- const bb = busboy({
81
- headers: req.headers,
82
- limits: {
83
- fileSize: 10 * 1024 * 1024
84
- }
85
- });
86
- bb.on("error", (err) => {
87
- next(err);
88
- });
89
- let fileFullPath;
90
- bb.on("file", (name2, file, info) => {
91
- if (info.filename.length > 0) {
92
- file.resume();
93
- }
94
- if (info.mimeType != "image/png" && info.mimeType != "image/jpeg" && info.mimeType != "image/gif") {
95
- filesWrongType.push(info.filename);
96
- file.resume();
97
- }
98
- let fileName = `${Math.floor(Math.random() * 1e4)}-${info.filename}`;
99
- fileFullPath = path2.join(filePath, fileName);
100
- fileRelativePath = path2.join(folderName, fileName);
101
- filePromise = new Promise((resolve, reject) => {
102
- const writeStream = fs.createWriteStream(fileFullPath).on("error", reject).on("finish", resolve);
103
- file.on("error", reject);
104
- file.pipe(writeStream);
105
- });
106
- files.push(fileFullPath);
107
- file.on("limit", () => {
108
- filesWrongSize.push(info.filename);
109
- fsp.unlink(fileFullPath);
110
- const index = files.indexOf(fileFullPath);
111
- if (index !== -1) {
112
- files.splice(index, 1);
113
- }
114
- file.resume();
115
- });
116
- });
117
- bb.on("close", async () => {
118
- try {
119
- if (!filePromise) {
120
- res.status(400).json({ message: `Uploaded file '${name}' is missing` });
121
- return;
122
- }
123
- await filePromise;
124
- req.files = files;
125
- next();
126
- } catch (err) {
127
- next(err);
128
- } finally {
129
- bb.removeAllListeners();
130
- }
131
- });
132
- req.pipe(bb);
133
- } catch (err) {
134
- res.status(400).json({ message: `Could not retrieve file from request - ${err.message}` });
135
- }
139
+ const uploadFilesMiddleware = (req, res, next) => {
140
+ const allowedTypes = [
141
+ "image/png",
142
+ "image/jpeg",
143
+ "image/jpg",
144
+ "image/gif",
145
+ "application/pdf",
146
+ "image/svg+xml",
147
+ "video/mp4",
148
+ "video/quicktime",
149
+ // MOV
150
+ "video/webm"
151
+ ];
152
+ handleFileUpload(req, res, next, publicPath, { folderNameDefault: "unsorted", maxSize: 10 * 1024 * 1024, allowedTypes });
153
+ };
154
+ const uploadImagesMiddleware = (req, res, next) => {
155
+ const allowedTypes = ["image/png", "image/jpeg", "image/jpg", "image/gif"];
156
+ handleFileUpload(req, res, next, publicPath, { folderNameDefault: "unsorted", maxSize: 10 * 1024 * 1024, allowedTypes });
136
157
  };
137
158
  return {
138
- uploadMultipleFilesMiddleware,
159
+ uploadImagesMiddleware,
160
+ uploadFilesMiddleware,
139
161
  generatePreviewMiddleware
140
162
  };
141
163
  };
@@ -168,7 +190,7 @@ var files_routes = function(app, db, origins, publicPath) {
168
190
  app.post(
169
191
  "/api/upload/image",
170
192
  [
171
- middlewareBusboy2.uploadMultipleFilesMiddleware,
193
+ middlewareBusboy2.uploadImagesMiddleware,
172
194
  middlewareBusboy2.generatePreviewMiddleware
173
195
  ],
174
196
  controller.uploadMultipleFileController
@@ -176,15 +198,14 @@ var files_routes = function(app, db, origins, publicPath) {
176
198
  app.post(
177
199
  "/api/upload/file",
178
200
  [
179
- middlewareBusboy2.uploadMultipleFilesMiddleware,
180
- middlewareBusboy2.generatePreviewMiddleware
201
+ middlewareBusboy2.uploadFilesMiddleware
181
202
  ],
182
203
  controller.uploadMultipleFileController
183
204
  );
184
205
  app.post(
185
206
  "/api/upload/multiple",
186
207
  [
187
- middlewareBusboy2.uploadMultipleFilesMiddleware,
208
+ middlewareBusboy2.uploadImagesMiddleware,
188
209
  middlewareBusboy2.generatePreviewMiddleware
189
210
  ],
190
211
  controller.uploadMultipleFileController
@@ -47,7 +47,6 @@ const sitemap = sitemap$1;
47
47
  const mailing = mailing$1.mailing;
48
48
  const parseCookie = parseCookie_1;
49
49
  var globals_server = {
50
- middlewareFactory,
51
50
  sitemap,
52
51
  mailing,
53
52
  parseCookie
@@ -46,7 +46,6 @@ const sitemap = sitemap$1;
46
46
  const mailing = mailing$1;
47
47
  const parseCookie = parseCookie_1;
48
48
  var globals_server = {
49
- middlewareFactory,
50
49
  sitemap,
51
50
  mailing,
52
51
  parseCookie