@ozdao/prometheus-framework 0.2.60 → 0.2.62
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +8 -190
- package/dist/auth.server.mjs +8 -190
- package/dist/community.server.js +3 -2
- package/dist/community.server.mjs +2 -1
- package/dist/events.server.js +101 -29
- package/dist/events.server.mjs +100 -28
- package/dist/files.server.js +7 -7
- package/dist/files.server.mjs +7 -7
- package/dist/gallery.server.js +2 -2
- package/dist/gallery.server.mjs +2 -2
- package/dist/main-DsseFd2d.mjs +13753 -0
- package/dist/main-U466Gwzt.js +91 -0
- package/dist/main.css +1 -1
- package/dist/metadata.schema-CS6_9GLU.js +174 -0
- package/dist/metadata.schema-D88c1Ebp.mjs +175 -0
- package/dist/organizations.server.js +212 -16
- package/dist/organizations.server.mjs +212 -16
- package/dist/ownership.schema-DN0SlQL6.js +36 -0
- package/dist/ownership.schema-oyx6eNkZ.mjs +37 -0
- package/dist/products.server.js +8 -5
- package/dist/products.server.mjs +8 -5
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.js +19 -14
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.js +1 -55
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.js +55 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +27 -27
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue.js +1 -51
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Loader/Loader.vue2.js +51 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue.js +1 -97
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +97 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +1 -36
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +36 -1
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.js +12 -14
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +197 -183
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +168 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.js +1 -0
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/router/events.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/router/events.js +11 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +67 -64
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +13 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +1 -13
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +24 -24
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -38
- package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.js +19 -19
- package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.js +5 -5
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.js +36 -27
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +7 -7
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +20 -20
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +36 -50
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/web-D7bW32Ul.mjs +54 -0
- package/dist/web-DpE9HxA3.js +1 -0
- package/package.json +1 -1
- package/src/components/Chips/Chips.vue +2 -2
- package/src/components/Feed/Feed.vue +2 -1
- package/src/modules/auth/auth.client.js +0 -2
- package/src/modules/auth/auth.server.js +1 -6
- package/src/modules/auth/components/pages/Invite.vue +1 -1
- package/src/modules/events/components/pages/EditEvent.vue +19 -0
- package/src/modules/events/components/pages/EditEventTickets.vue +194 -0
- package/src/modules/events/controllers/tickets.controller.js +103 -28
- package/src/modules/events/models/ticket.model.js +22 -4
- package/src/modules/events/router/events.js +5 -0
- package/src/modules/events/routes/tickets.routes.js +2 -2
- package/src/modules/events/store/tickets.js +1 -0
- package/src/modules/globals/components/blocks/CardHeader.vue +6 -6
- package/src/modules/organizations/components/pages/Members.vue +1 -1
- package/src/modules/organizations/components/pages/Organization.vue +4 -4
- package/src/modules/organizations/components/sections/MembersAdd.vue +1 -1
- package/src/modules/organizations/controllers/departments.controller.js +14 -1
- package/src/modules/organizations/models/department.model.js +5 -1
- package/src/modules/organizations/organizations.client.js +2 -0
- package/src/modules/organizations/organizations.server.js +6 -2
- package/src/modules/organizations/routes/departments.routes.js +1 -1
- package/src/modules/organizations/store/departments.js +3 -2
- package/src/modules/products/components/blocks/CardLeftover.vue +19 -7
- package/src/modules/products/components/pages/EditLeftover.vue +1 -1
- package/src/modules/products/components/pages/Leftovers.vue +14 -3
- package/src/modules/products/components/pages/Products.vue +8 -8
- package/src/modules/products/models/leftover.model.js +9 -5
- package/src/modules/users/models/client.model.js +60 -0
- /package/src/modules/{auth → organizations}/controllers/invites.controller.js +0 -0
- /package/src/modules/{auth → organizations}/models/invite.model.js +0 -0
- /package/src/modules/{auth → organizations}/routes/invites.routes.js +0 -0
- /package/src/modules/{auth → organizations}/store/invites.js +0 -0
package/dist/events.server.js
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
3
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
4
4
|
const require$$0 = require("mongoose");
|
5
|
-
const metadata_schema = require("./metadata.schema-
|
5
|
+
const metadata_schema = require("./metadata.schema-CS6_9GLU.js");
|
6
6
|
const index = require("./index-CL9l0HRS.js");
|
7
7
|
const require$$0$1 = require("qrcode");
|
8
|
+
const require$$1 = require("jimp");
|
9
|
+
const require$$2 = require("path");
|
10
|
+
const mailing = require("./mailing-CxEcQ8NY.js");
|
11
|
+
const ownership_schema = require("./ownership.schema-DN0SlQL6.js");
|
8
12
|
const ObjectId = require$$0.Types.ObjectId;
|
9
13
|
function getDateConditions(date) {
|
10
14
|
if (date) {
|
@@ -427,8 +431,78 @@ var events_routes = function(app, db, origins) {
|
|
427
431
|
};
|
428
432
|
const events_routes$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(events_routes);
|
429
433
|
const QRCode = require$$0$1;
|
430
|
-
const
|
434
|
+
const Jimp = require$$1;
|
435
|
+
const path = require$$2;
|
436
|
+
const { sendEmail } = mailing.mailing;
|
437
|
+
const controllerFactory$1 = (db, publicPath) => {
|
431
438
|
const Ticket = db.ticket;
|
439
|
+
async function saveAndSendTicket(ticketData) {
|
440
|
+
console.log(ticketData);
|
441
|
+
const ticket = new Ticket(ticketData);
|
442
|
+
const data = await ticket.save();
|
443
|
+
const qrData = data._id.toString();
|
444
|
+
const qrCode = await QRCode.toDataURL(qrData, { errorCorrectionLevel: "H", type: "image/png" });
|
445
|
+
data.status = "unused";
|
446
|
+
data.qrcode = qrCode;
|
447
|
+
data.client_refactor.name = ticketData.name;
|
448
|
+
data.client_refactor.email = ticketData.email;
|
449
|
+
const templatePath = path.join(publicPath, "tickets", "template.png");
|
450
|
+
const outputPath = path.join(publicPath, "tickets", `ticket-${data._id}.png`);
|
451
|
+
data.image = `/tickets/ticket-${data._id}.png`;
|
452
|
+
const ticketTemplate = await Jimp.read(templatePath);
|
453
|
+
const qrImage = await Jimp.read(Buffer.from(qrCode.split(",")[1], "base64"));
|
454
|
+
const resizedQrWidth = qrImage.bitmap.width * 1.5;
|
455
|
+
const resizedQrHeight = qrImage.bitmap.height * 1.5;
|
456
|
+
qrImage.resize(resizedQrWidth, resizedQrHeight);
|
457
|
+
const { width: templateWidth, height: templateHeight } = ticketTemplate.bitmap;
|
458
|
+
const xPosition = (templateWidth - resizedQrWidth) / 2;
|
459
|
+
const yPosition = templateHeight / 2 - resizedQrHeight / 2 + 275;
|
460
|
+
await ticketTemplate.composite(qrImage, xPosition, yPosition);
|
461
|
+
await ticketTemplate.writeAsync(outputPath);
|
462
|
+
if (ticketData.email) {
|
463
|
+
const emailBody = `
|
464
|
+
<h1>Your Ticket from ${process.env.APP_NAME}</h1>
|
465
|
+
<p>Dear ${ticketData.name || "Anonymous"},<br>
|
466
|
+
Your ticket is now ready.<br>
|
467
|
+
Please find your ticket attached below:</p>
|
468
|
+
<img src="${process.env.API_URL + data.image}" alt="Ticket Image" style="width:100%;max-width:600px;height:auto;">
|
469
|
+
Keep this ticket safe, and show the QR code at the entrance.<br>
|
470
|
+
Looking forward to seeing you!<br>
|
471
|
+
Best regards,<br>
|
472
|
+
<p>The ${process.env.APP_NAME} Team</p>
|
473
|
+
`;
|
474
|
+
try {
|
475
|
+
const emailSent = await sendEmail(ticketData.email, `Your Ticket from ${process.env.APP_NAME}`, emailBody);
|
476
|
+
} catch (err) {
|
477
|
+
console.log(err);
|
478
|
+
}
|
479
|
+
}
|
480
|
+
await data.save();
|
481
|
+
return data;
|
482
|
+
}
|
483
|
+
const create = async (req, res) => {
|
484
|
+
if (Array.isArray(req.body)) {
|
485
|
+
const ticketsData = req.body;
|
486
|
+
try {
|
487
|
+
const ticketsPromises = ticketsData.map(
|
488
|
+
(ticketData) => saveAndSendTicket(ticketData)
|
489
|
+
);
|
490
|
+
const tickets = await Promise.all(ticketsPromises);
|
491
|
+
res.json(tickets);
|
492
|
+
} catch (err) {
|
493
|
+
console.log(err);
|
494
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
495
|
+
}
|
496
|
+
} else {
|
497
|
+
try {
|
498
|
+
const data = await saveAndSendTicket(req.body);
|
499
|
+
res.json(data);
|
500
|
+
} catch (err) {
|
501
|
+
console.log(err);
|
502
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
503
|
+
}
|
504
|
+
}
|
505
|
+
};
|
432
506
|
const read = async (req, res) => {
|
433
507
|
let query = {};
|
434
508
|
let options = {};
|
@@ -454,25 +528,6 @@ const controllerFactory$1 = (db) => {
|
|
454
528
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
455
529
|
}
|
456
530
|
};
|
457
|
-
const create = async (req, res) => {
|
458
|
-
const newTicket = new Ticket({
|
459
|
-
user: req.body.user,
|
460
|
-
type: req.body.type,
|
461
|
-
target: req.body.target,
|
462
|
-
role: req.body.role
|
463
|
-
});
|
464
|
-
try {
|
465
|
-
const data = await newTicket.save();
|
466
|
-
const qrData = data._id.toString();
|
467
|
-
const qrCode = await QRCode.toDataURL(qrData);
|
468
|
-
data.status = "unused";
|
469
|
-
data.qrcode = qrCode;
|
470
|
-
await data.save();
|
471
|
-
res.send(data);
|
472
|
-
} catch (err) {
|
473
|
-
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
474
|
-
}
|
475
|
-
};
|
476
531
|
const update = async (req, res) => {
|
477
532
|
try {
|
478
533
|
const { _id } = req.body;
|
@@ -512,8 +567,8 @@ const controllerFactory$1 = (db) => {
|
|
512
567
|
};
|
513
568
|
var tickets_controller = controllerFactory$1;
|
514
569
|
const controllerFactory = tickets_controller;
|
515
|
-
var tickets_routes = function(app, db, origins) {
|
516
|
-
const controller = controllerFactory(db);
|
570
|
+
var tickets_routes = function(app, db, origins, publicPath) {
|
571
|
+
const controller = controllerFactory(db, publicPath);
|
517
572
|
app.use(function(req, res, next) {
|
518
573
|
const origin = req.headers.origin;
|
519
574
|
if (origins.includes(origin)) {
|
@@ -542,7 +597,7 @@ var tickets_routes = function(app, db, origins) {
|
|
542
597
|
const tickets_routes$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(tickets_routes);
|
543
598
|
const applyCommonSchema = metadata_schema.common_schema;
|
544
599
|
const applyEngagementSchema = metadata_schema.engagement_schema;
|
545
|
-
const applyOwnershipSchema =
|
600
|
+
const applyOwnershipSchema = ownership_schema.ownership_schema;
|
546
601
|
const applyMetadataSchema = metadata_schema.metadata_schema;
|
547
602
|
var event_model = (db) => {
|
548
603
|
const EventSchema = new db.mongoose.Schema({
|
@@ -627,19 +682,29 @@ var event_model = (db) => {
|
|
627
682
|
const event_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(event_model);
|
628
683
|
var ticket_model = (mongoose) => {
|
629
684
|
const TicketSchema = new mongoose.Schema({
|
685
|
+
client: {
|
686
|
+
type: mongoose.Schema.Types.ObjectId,
|
687
|
+
ref: "Client"
|
688
|
+
},
|
689
|
+
client_refactor: {
|
690
|
+
email: {
|
691
|
+
type: String
|
692
|
+
},
|
693
|
+
name: {
|
694
|
+
type: String
|
695
|
+
}
|
696
|
+
},
|
630
697
|
user: {
|
631
698
|
type: mongoose.Schema.Types.ObjectId,
|
632
|
-
ref: "User"
|
633
|
-
required: true
|
699
|
+
ref: "User"
|
634
700
|
},
|
635
701
|
type: {
|
636
702
|
type: String,
|
637
703
|
enum: ["event", "parking"],
|
638
|
-
default: "
|
704
|
+
default: "event",
|
639
705
|
required: true
|
640
706
|
},
|
641
707
|
target: {
|
642
|
-
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
643
708
|
type: mongoose.Schema.Types.ObjectId,
|
644
709
|
ref: function(value) {
|
645
710
|
if (this.type === "event")
|
@@ -656,11 +721,18 @@ var ticket_model = (mongoose) => {
|
|
656
721
|
qrcode: {
|
657
722
|
type: String
|
658
723
|
},
|
724
|
+
image: {
|
725
|
+
type: String
|
726
|
+
},
|
659
727
|
status: {
|
660
728
|
type: String,
|
661
|
-
enum: ["unused", "used"],
|
729
|
+
enum: ["unused", "used", "deactivated"],
|
662
730
|
deafult: "unused"
|
663
731
|
}
|
732
|
+
}, {
|
733
|
+
timestamps: {
|
734
|
+
currentTime: () => Date.now()
|
735
|
+
}
|
664
736
|
});
|
665
737
|
TicketSchema.index({ user: 1, type: 1, target: 1 });
|
666
738
|
const Ticket = mongoose.model("Ticket", TicketSchema);
|
package/dist/events.server.mjs
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
2
|
import require$$0 from "mongoose";
|
3
|
-
import { q as queryProcessor$2, c as common_schema, e as engagement_schema,
|
3
|
+
import { q as queryProcessor$2, c as common_schema, e as engagement_schema, m as metadata_schema } from "./metadata.schema-D88c1Ebp.mjs";
|
4
4
|
import { s as server$1 } from "./index-CGIn4v5E.mjs";
|
5
5
|
import require$$0$1 from "qrcode";
|
6
|
+
import require$$1 from "jimp";
|
7
|
+
import require$$2 from "path";
|
8
|
+
import { m as mailing } from "./mailing-DT2ZSkCD.mjs";
|
9
|
+
import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
|
6
10
|
const ObjectId = require$$0.Types.ObjectId;
|
7
11
|
function getDateConditions(date) {
|
8
12
|
if (date) {
|
@@ -425,8 +429,78 @@ var events_routes = function(app, db, origins) {
|
|
425
429
|
};
|
426
430
|
const events_routes$1 = /* @__PURE__ */ getDefaultExportFromCjs(events_routes);
|
427
431
|
const QRCode = require$$0$1;
|
428
|
-
const
|
432
|
+
const Jimp = require$$1;
|
433
|
+
const path = require$$2;
|
434
|
+
const { sendEmail } = mailing;
|
435
|
+
const controllerFactory$1 = (db, publicPath) => {
|
429
436
|
const Ticket = db.ticket;
|
437
|
+
async function saveAndSendTicket(ticketData) {
|
438
|
+
console.log(ticketData);
|
439
|
+
const ticket = new Ticket(ticketData);
|
440
|
+
const data = await ticket.save();
|
441
|
+
const qrData = data._id.toString();
|
442
|
+
const qrCode = await QRCode.toDataURL(qrData, { errorCorrectionLevel: "H", type: "image/png" });
|
443
|
+
data.status = "unused";
|
444
|
+
data.qrcode = qrCode;
|
445
|
+
data.client_refactor.name = ticketData.name;
|
446
|
+
data.client_refactor.email = ticketData.email;
|
447
|
+
const templatePath = path.join(publicPath, "tickets", "template.png");
|
448
|
+
const outputPath = path.join(publicPath, "tickets", `ticket-${data._id}.png`);
|
449
|
+
data.image = `/tickets/ticket-${data._id}.png`;
|
450
|
+
const ticketTemplate = await Jimp.read(templatePath);
|
451
|
+
const qrImage = await Jimp.read(Buffer.from(qrCode.split(",")[1], "base64"));
|
452
|
+
const resizedQrWidth = qrImage.bitmap.width * 1.5;
|
453
|
+
const resizedQrHeight = qrImage.bitmap.height * 1.5;
|
454
|
+
qrImage.resize(resizedQrWidth, resizedQrHeight);
|
455
|
+
const { width: templateWidth, height: templateHeight } = ticketTemplate.bitmap;
|
456
|
+
const xPosition = (templateWidth - resizedQrWidth) / 2;
|
457
|
+
const yPosition = templateHeight / 2 - resizedQrHeight / 2 + 275;
|
458
|
+
await ticketTemplate.composite(qrImage, xPosition, yPosition);
|
459
|
+
await ticketTemplate.writeAsync(outputPath);
|
460
|
+
if (ticketData.email) {
|
461
|
+
const emailBody = `
|
462
|
+
<h1>Your Ticket from ${process.env.APP_NAME}</h1>
|
463
|
+
<p>Dear ${ticketData.name || "Anonymous"},<br>
|
464
|
+
Your ticket is now ready.<br>
|
465
|
+
Please find your ticket attached below:</p>
|
466
|
+
<img src="${process.env.API_URL + data.image}" alt="Ticket Image" style="width:100%;max-width:600px;height:auto;">
|
467
|
+
Keep this ticket safe, and show the QR code at the entrance.<br>
|
468
|
+
Looking forward to seeing you!<br>
|
469
|
+
Best regards,<br>
|
470
|
+
<p>The ${process.env.APP_NAME} Team</p>
|
471
|
+
`;
|
472
|
+
try {
|
473
|
+
const emailSent = await sendEmail(ticketData.email, `Your Ticket from ${process.env.APP_NAME}`, emailBody);
|
474
|
+
} catch (err) {
|
475
|
+
console.log(err);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
await data.save();
|
479
|
+
return data;
|
480
|
+
}
|
481
|
+
const create = async (req, res) => {
|
482
|
+
if (Array.isArray(req.body)) {
|
483
|
+
const ticketsData = req.body;
|
484
|
+
try {
|
485
|
+
const ticketsPromises = ticketsData.map(
|
486
|
+
(ticketData) => saveAndSendTicket(ticketData)
|
487
|
+
);
|
488
|
+
const tickets = await Promise.all(ticketsPromises);
|
489
|
+
res.json(tickets);
|
490
|
+
} catch (err) {
|
491
|
+
console.log(err);
|
492
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
493
|
+
}
|
494
|
+
} else {
|
495
|
+
try {
|
496
|
+
const data = await saveAndSendTicket(req.body);
|
497
|
+
res.json(data);
|
498
|
+
} catch (err) {
|
499
|
+
console.log(err);
|
500
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
501
|
+
}
|
502
|
+
}
|
503
|
+
};
|
430
504
|
const read = async (req, res) => {
|
431
505
|
let query = {};
|
432
506
|
let options = {};
|
@@ -452,25 +526,6 @@ const controllerFactory$1 = (db) => {
|
|
452
526
|
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
453
527
|
}
|
454
528
|
};
|
455
|
-
const create = async (req, res) => {
|
456
|
-
const newTicket = new Ticket({
|
457
|
-
user: req.body.user,
|
458
|
-
type: req.body.type,
|
459
|
-
target: req.body.target,
|
460
|
-
role: req.body.role
|
461
|
-
});
|
462
|
-
try {
|
463
|
-
const data = await newTicket.save();
|
464
|
-
const qrData = data._id.toString();
|
465
|
-
const qrCode = await QRCode.toDataURL(qrData);
|
466
|
-
data.status = "unused";
|
467
|
-
data.qrcode = qrCode;
|
468
|
-
await data.save();
|
469
|
-
res.send(data);
|
470
|
-
} catch (err) {
|
471
|
-
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
472
|
-
}
|
473
|
-
};
|
474
529
|
const update = async (req, res) => {
|
475
530
|
try {
|
476
531
|
const { _id } = req.body;
|
@@ -510,8 +565,8 @@ const controllerFactory$1 = (db) => {
|
|
510
565
|
};
|
511
566
|
var tickets_controller = controllerFactory$1;
|
512
567
|
const controllerFactory = tickets_controller;
|
513
|
-
var tickets_routes = function(app, db, origins) {
|
514
|
-
const controller = controllerFactory(db);
|
568
|
+
var tickets_routes = function(app, db, origins, publicPath) {
|
569
|
+
const controller = controllerFactory(db, publicPath);
|
515
570
|
app.use(function(req, res, next) {
|
516
571
|
const origin = req.headers.origin;
|
517
572
|
if (origins.includes(origin)) {
|
@@ -625,19 +680,29 @@ var event_model = (db) => {
|
|
625
680
|
const event_model$1 = /* @__PURE__ */ getDefaultExportFromCjs(event_model);
|
626
681
|
var ticket_model = (mongoose) => {
|
627
682
|
const TicketSchema = new mongoose.Schema({
|
683
|
+
client: {
|
684
|
+
type: mongoose.Schema.Types.ObjectId,
|
685
|
+
ref: "Client"
|
686
|
+
},
|
687
|
+
client_refactor: {
|
688
|
+
email: {
|
689
|
+
type: String
|
690
|
+
},
|
691
|
+
name: {
|
692
|
+
type: String
|
693
|
+
}
|
694
|
+
},
|
628
695
|
user: {
|
629
696
|
type: mongoose.Schema.Types.ObjectId,
|
630
|
-
ref: "User"
|
631
|
-
required: true
|
697
|
+
ref: "User"
|
632
698
|
},
|
633
699
|
type: {
|
634
700
|
type: String,
|
635
701
|
enum: ["event", "parking"],
|
636
|
-
default: "
|
702
|
+
default: "event",
|
637
703
|
required: true
|
638
704
|
},
|
639
705
|
target: {
|
640
|
-
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
641
706
|
type: mongoose.Schema.Types.ObjectId,
|
642
707
|
ref: function(value) {
|
643
708
|
if (this.type === "event")
|
@@ -654,11 +719,18 @@ var ticket_model = (mongoose) => {
|
|
654
719
|
qrcode: {
|
655
720
|
type: String
|
656
721
|
},
|
722
|
+
image: {
|
723
|
+
type: String
|
724
|
+
},
|
657
725
|
status: {
|
658
726
|
type: String,
|
659
|
-
enum: ["unused", "used"],
|
727
|
+
enum: ["unused", "used", "deactivated"],
|
660
728
|
deafult: "unused"
|
661
729
|
}
|
730
|
+
}, {
|
731
|
+
timestamps: {
|
732
|
+
currentTime: () => Date.now()
|
733
|
+
}
|
662
734
|
});
|
663
735
|
TicketSchema.index({ user: 1, type: 1, target: 1 });
|
664
736
|
const Ticket = mongoose.model("Ticket", TicketSchema);
|
package/dist/files.server.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
3
|
-
const require$$
|
3
|
+
const require$$2 = require("path");
|
4
4
|
const index = require("./index-CL9l0HRS.js");
|
5
|
-
const require$$0
|
5
|
+
const require$$0 = require("sharp");
|
6
6
|
const require$$1 = require("fs");
|
7
|
-
const require$$2 = require("fs/promises");
|
7
|
+
const require$$2$1 = require("fs/promises");
|
8
8
|
const require$$4 = require("busboy");
|
9
|
-
const path = require$$
|
9
|
+
const path = require$$2;
|
10
10
|
const controllerFactory$1 = (db, publicPath) => {
|
11
11
|
const uploadMultipleFileController = async (req, res, next) => {
|
12
12
|
console.log("uploadMultipleFileController called");
|
@@ -40,10 +40,10 @@ function requireMiddlewareBusboy() {
|
|
40
40
|
if (hasRequiredMiddlewareBusboy)
|
41
41
|
return middlewareBusboy;
|
42
42
|
hasRequiredMiddlewareBusboy = 1;
|
43
|
-
const sharp = require$$0
|
43
|
+
const sharp = require$$0;
|
44
44
|
const fs = require$$1;
|
45
|
-
const fsp = require$$2;
|
46
|
-
const path2 = require$$
|
45
|
+
const fsp = require$$2$1;
|
46
|
+
const path2 = require$$2;
|
47
47
|
const busboy = require$$4;
|
48
48
|
const createThumbnail = async (originalPath) => {
|
49
49
|
const thumbnailPath = path2.join(
|
package/dist/files.server.mjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
|
-
import require$$
|
2
|
+
import require$$2 from "path";
|
3
3
|
import { s as server$1 } from "./index-CGIn4v5E.mjs";
|
4
|
-
import require$$0
|
4
|
+
import require$$0 from "sharp";
|
5
5
|
import require$$1 from "fs";
|
6
|
-
import require$$2 from "fs/promises";
|
6
|
+
import require$$2$1 from "fs/promises";
|
7
7
|
import require$$4 from "busboy";
|
8
|
-
const path = require$$
|
8
|
+
const path = require$$2;
|
9
9
|
const controllerFactory$1 = (db, publicPath) => {
|
10
10
|
const uploadMultipleFileController = async (req, res, next) => {
|
11
11
|
console.log("uploadMultipleFileController called");
|
@@ -39,10 +39,10 @@ function requireMiddlewareBusboy() {
|
|
39
39
|
if (hasRequiredMiddlewareBusboy)
|
40
40
|
return middlewareBusboy;
|
41
41
|
hasRequiredMiddlewareBusboy = 1;
|
42
|
-
const sharp = require$$0
|
42
|
+
const sharp = require$$0;
|
43
43
|
const fs = require$$1;
|
44
|
-
const fsp = require$$2;
|
45
|
-
const path2 = require$$
|
44
|
+
const fsp = require$$2$1;
|
45
|
+
const path2 = require$$2;
|
46
46
|
const busboy = require$$4;
|
47
47
|
const createThumbnail = async (originalPath) => {
|
48
48
|
const thumbnailPath = path2.join(
|
package/dist/gallery.server.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
3
|
-
const require$$
|
3
|
+
const require$$2 = require("path");
|
4
4
|
const index = require("./index-CL9l0HRS.js");
|
5
|
-
const path = require$$
|
5
|
+
const path = require$$2;
|
6
6
|
const controllerFactory$1 = (db) => {
|
7
7
|
const Photo = db.photo;
|
8
8
|
const read = async (req, res) => {
|
package/dist/gallery.server.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
|
-
import require$$
|
2
|
+
import require$$2 from "path";
|
3
3
|
import { s as server } from "./index-CGIn4v5E.mjs";
|
4
|
-
const path = require$$
|
4
|
+
const path = require$$2;
|
5
5
|
const controllerFactory$1 = (db) => {
|
6
6
|
const Photo = db.photo;
|
7
7
|
const read = async (req, res) => {
|