@ozdao/prometheus-framework 0.0.87 → 0.0.88
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Feed-51e4e232.js +1 -0
- package/dist/Feed-dc8b66bf.mjs +367 -0
- package/dist/Image-6c7584f5.mjs +477 -0
- package/dist/Image-9a870c88.js +9 -0
- package/dist/Product-1724d88d.mjs +837 -0
- package/dist/Product-a94d8b65.js +7 -0
- package/dist/ProductEdit-57484f1e.mjs +349 -0
- package/dist/ProductEdit-ef301baa.js +1 -0
- package/dist/ProfileEvents-1cfe6858.mjs +55 -0
- package/dist/ProfileEvents-d8e16509.js +1 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +197 -214
- package/dist/events.client.cjs +1 -1
- package/dist/events.client.js +328 -309
- package/dist/events.server.js +77 -0
- package/dist/events.server.mjs +77 -0
- package/dist/organizations.client-686845be.mjs +3179 -0
- package/dist/organizations.client-99bfc474.js +3 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +2 -2
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +1 -1
- package/package.json +1 -1
- package/src/modules/events/components/blocks/CardEvent.vue +1 -1
- package/src/modules/events/components/pages/EditEvent.vue +7 -2
- package/src/modules/events/components/pages/Event.vue +43 -4
- package/src/modules/events/middlewares/server/index.js +10 -0
- package/src/modules/events/middlewares/server/verifyEvent.js +60 -0
- package/src/modules/events/routes/events.routes.js +14 -1
package/dist/events.server.js
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const _commonjsHelpers = require("./_commonjsHelpers-3b53548e.js");
|
4
4
|
const require$$1 = require("mongoose");
|
5
|
+
const index = require("./index-21dfdbd9.js");
|
6
|
+
require("jsonwebtoken");
|
7
|
+
require("mongodb");
|
5
8
|
const ObjectId = require$$1.Types.ObjectId;
|
6
9
|
const middlewareFactory = (db) => {
|
7
10
|
db.ticket;
|
@@ -287,9 +290,75 @@ const middlewareFactory = (db) => {
|
|
287
290
|
};
|
288
291
|
var events_controller = middlewareFactory;
|
289
292
|
const events_controller$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(events_controller);
|
293
|
+
var verifyEvent;
|
294
|
+
var hasRequiredVerifyEvent;
|
295
|
+
function requireVerifyEvent() {
|
296
|
+
if (hasRequiredVerifyEvent)
|
297
|
+
return verifyEvent;
|
298
|
+
hasRequiredVerifyEvent = 1;
|
299
|
+
const middlewareFactory2 = (db) => {
|
300
|
+
const Event = db.event;
|
301
|
+
const checkEventExistOrNot = async (req, res, next) => {
|
302
|
+
try {
|
303
|
+
const url = req.body.url ? req.body.url : req.body.name.toLowerCase().replace(/ /g, "-").replace(/[^\w-]+/g, "");
|
304
|
+
if (!req.body._id) {
|
305
|
+
const event = await Event.findOne({ url });
|
306
|
+
if (event) {
|
307
|
+
res.status(400).send({ errorCode: "EVENT_URL_ALREADY_IN_USE", accessToken: null });
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
next();
|
311
|
+
return;
|
312
|
+
}
|
313
|
+
const updatingEventId = req.body._id;
|
314
|
+
const existingEvent = await Event.findById(updatingEventId);
|
315
|
+
if (!existingEvent) {
|
316
|
+
res.status(404).send({ errorCode: "EVENT_NOT_FOUND", accessToken: null });
|
317
|
+
return;
|
318
|
+
}
|
319
|
+
if (existingEvent.url !== url) {
|
320
|
+
const event = await Event.findOne({ url });
|
321
|
+
if (event) {
|
322
|
+
res.status(400).send({ errorCode: "EVENT_URL_ALREADY_IN_USE", accessToken: null });
|
323
|
+
return;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
next();
|
327
|
+
} catch (err) {
|
328
|
+
console.log(err);
|
329
|
+
res.status(500).send({ message: err });
|
330
|
+
}
|
331
|
+
};
|
332
|
+
const checkNameNotEmpty = (req, res, next) => {
|
333
|
+
if (!req.body.name || req.body.name.trim() === "") {
|
334
|
+
res.status(400).send({ errorCode: "NAME_CANNOT_BE_EMPTY", accessToken: null });
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
next();
|
338
|
+
};
|
339
|
+
return {
|
340
|
+
checkEventExistOrNot,
|
341
|
+
// Изменено с checkBlogpostExistOrNot на checkEventExistOrNot
|
342
|
+
checkNameNotEmpty
|
343
|
+
};
|
344
|
+
};
|
345
|
+
verifyEvent = middlewareFactory2;
|
346
|
+
return verifyEvent;
|
347
|
+
}
|
348
|
+
const middlewareIndexFactory = (db) => {
|
349
|
+
const verifyEvent2 = requireVerifyEvent()(db);
|
350
|
+
return {
|
351
|
+
verifyEvent: verifyEvent2
|
352
|
+
};
|
353
|
+
};
|
354
|
+
var server = middlewareIndexFactory;
|
290
355
|
const controllerFactory$2 = events_controller;
|
356
|
+
const middlewareFactoryGlobal = index.server;
|
357
|
+
const middlewareFactoryEvents = server;
|
291
358
|
var events_routes = function(app, db) {
|
292
359
|
const controller = controllerFactory$2(db);
|
360
|
+
middlewareFactoryGlobal(db);
|
361
|
+
const { verifyEvent: verifyEvent2 } = middlewareFactoryEvents(db);
|
293
362
|
app.use(function(req, res, next) {
|
294
363
|
res.header(
|
295
364
|
"Access-Control-Allow-Headers",
|
@@ -304,10 +373,18 @@ var events_routes = function(app, db) {
|
|
304
373
|
);
|
305
374
|
app.post(
|
306
375
|
"/api/events/create",
|
376
|
+
[
|
377
|
+
verifyEvent2.checkNameNotEmpty,
|
378
|
+
verifyEvent2.checkEventExistOrNot
|
379
|
+
],
|
307
380
|
controller.create
|
308
381
|
);
|
309
382
|
app.post(
|
310
383
|
"/api/events/update",
|
384
|
+
[
|
385
|
+
verifyEvent2.checkNameNotEmpty,
|
386
|
+
verifyEvent2.checkEventExistOrNot
|
387
|
+
],
|
311
388
|
controller.update
|
312
389
|
);
|
313
390
|
app.delete(
|
package/dist/events.server.mjs
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-83b1d755.mjs";
|
2
2
|
import require$$1 from "mongoose";
|
3
|
+
import { s as server$1 } from "./index-fa8d5df4.mjs";
|
4
|
+
import "jsonwebtoken";
|
5
|
+
import "mongodb";
|
3
6
|
const ObjectId = require$$1.Types.ObjectId;
|
4
7
|
const middlewareFactory = (db) => {
|
5
8
|
db.ticket;
|
@@ -285,9 +288,75 @@ const middlewareFactory = (db) => {
|
|
285
288
|
};
|
286
289
|
var events_controller = middlewareFactory;
|
287
290
|
const events_controller$1 = /* @__PURE__ */ getDefaultExportFromCjs(events_controller);
|
291
|
+
var verifyEvent;
|
292
|
+
var hasRequiredVerifyEvent;
|
293
|
+
function requireVerifyEvent() {
|
294
|
+
if (hasRequiredVerifyEvent)
|
295
|
+
return verifyEvent;
|
296
|
+
hasRequiredVerifyEvent = 1;
|
297
|
+
const middlewareFactory2 = (db) => {
|
298
|
+
const Event = db.event;
|
299
|
+
const checkEventExistOrNot = async (req, res, next) => {
|
300
|
+
try {
|
301
|
+
const url = req.body.url ? req.body.url : req.body.name.toLowerCase().replace(/ /g, "-").replace(/[^\w-]+/g, "");
|
302
|
+
if (!req.body._id) {
|
303
|
+
const event = await Event.findOne({ url });
|
304
|
+
if (event) {
|
305
|
+
res.status(400).send({ errorCode: "EVENT_URL_ALREADY_IN_USE", accessToken: null });
|
306
|
+
return;
|
307
|
+
}
|
308
|
+
next();
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
const updatingEventId = req.body._id;
|
312
|
+
const existingEvent = await Event.findById(updatingEventId);
|
313
|
+
if (!existingEvent) {
|
314
|
+
res.status(404).send({ errorCode: "EVENT_NOT_FOUND", accessToken: null });
|
315
|
+
return;
|
316
|
+
}
|
317
|
+
if (existingEvent.url !== url) {
|
318
|
+
const event = await Event.findOne({ url });
|
319
|
+
if (event) {
|
320
|
+
res.status(400).send({ errorCode: "EVENT_URL_ALREADY_IN_USE", accessToken: null });
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
next();
|
325
|
+
} catch (err) {
|
326
|
+
console.log(err);
|
327
|
+
res.status(500).send({ message: err });
|
328
|
+
}
|
329
|
+
};
|
330
|
+
const checkNameNotEmpty = (req, res, next) => {
|
331
|
+
if (!req.body.name || req.body.name.trim() === "") {
|
332
|
+
res.status(400).send({ errorCode: "NAME_CANNOT_BE_EMPTY", accessToken: null });
|
333
|
+
return;
|
334
|
+
}
|
335
|
+
next();
|
336
|
+
};
|
337
|
+
return {
|
338
|
+
checkEventExistOrNot,
|
339
|
+
// Изменено с checkBlogpostExistOrNot на checkEventExistOrNot
|
340
|
+
checkNameNotEmpty
|
341
|
+
};
|
342
|
+
};
|
343
|
+
verifyEvent = middlewareFactory2;
|
344
|
+
return verifyEvent;
|
345
|
+
}
|
346
|
+
const middlewareIndexFactory = (db) => {
|
347
|
+
const verifyEvent2 = requireVerifyEvent()(db);
|
348
|
+
return {
|
349
|
+
verifyEvent: verifyEvent2
|
350
|
+
};
|
351
|
+
};
|
352
|
+
var server = middlewareIndexFactory;
|
288
353
|
const controllerFactory$2 = events_controller;
|
354
|
+
const middlewareFactoryGlobal = server$1;
|
355
|
+
const middlewareFactoryEvents = server;
|
289
356
|
var events_routes = function(app, db) {
|
290
357
|
const controller = controllerFactory$2(db);
|
358
|
+
middlewareFactoryGlobal(db);
|
359
|
+
const { verifyEvent: verifyEvent2 } = middlewareFactoryEvents(db);
|
291
360
|
app.use(function(req, res, next) {
|
292
361
|
res.header(
|
293
362
|
"Access-Control-Allow-Headers",
|
@@ -302,10 +371,18 @@ var events_routes = function(app, db) {
|
|
302
371
|
);
|
303
372
|
app.post(
|
304
373
|
"/api/events/create",
|
374
|
+
[
|
375
|
+
verifyEvent2.checkNameNotEmpty,
|
376
|
+
verifyEvent2.checkEventExistOrNot
|
377
|
+
],
|
305
378
|
controller.create
|
306
379
|
);
|
307
380
|
app.post(
|
308
381
|
"/api/events/update",
|
382
|
+
[
|
383
|
+
verifyEvent2.checkNameNotEmpty,
|
384
|
+
verifyEvent2.checkEventExistOrNot
|
385
|
+
],
|
309
386
|
controller.update
|
310
387
|
);
|
311
388
|
app.delete(
|