@ozdao/prometheus-framework 0.2.59 → 0.2.61
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +12 -223
- package/dist/auth.server.mjs +12 -223
- package/dist/community.server.js +3 -2
- package/dist/community.server.mjs +2 -1
- package/dist/events.server.js +117 -25
- package/dist/events.server.mjs +116 -24
- 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-CjpDDEnW.mjs +210 -0
- package/dist/metadata.schema-D88c1Ebp.mjs +175 -0
- package/dist/metadata.schema-doiYQfuO.js +209 -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/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +26 -26
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +1 -373
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -72
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +72 -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/Tab/Tab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
- 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/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +1 -1
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.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/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/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +1 -5
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +0 -66
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +5 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +66 -0
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.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 +199 -185
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +43 -43
- 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 +2 -2
- 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 +59 -56
- 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 +1 -13
- 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 +13 -1
- 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 +167 -124
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +56 -45
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +19 -24
- 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/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
- 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 +25 -25
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.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 +3 -3
- 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 +16 -16
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.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 +11 -11
- 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 +21 -21
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- 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/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- 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 +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
- 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 -7
- 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/auth.server.js
CHANGED
@@ -5,7 +5,6 @@ const require$$1$1 = require("bcryptjs");
|
|
5
5
|
const require$$0$1 = require("mongoose");
|
6
6
|
const require$$1 = require("jwk-to-pem");
|
7
7
|
const mailing = require("./mailing-CxEcQ8NY.js");
|
8
|
-
const require$$0$2 = require("uuidv4");
|
9
8
|
const index = require("./index-CL9l0HRS.js");
|
10
9
|
const jwt$1 = require$$0;
|
11
10
|
const jwkToPem = require$$1;
|
@@ -48,7 +47,7 @@ const jwt = require$$0;
|
|
48
47
|
const bcrypt = require$$1$1;
|
49
48
|
const ObjectId = require$$0$1.Types.ObjectId;
|
50
49
|
const { verifyAppleIdToken } = verifyAppleIdToken_1;
|
51
|
-
const controllerFactory$
|
50
|
+
const controllerFactory$2 = (db) => {
|
52
51
|
const User = db.user;
|
53
52
|
const Membership = db.membership;
|
54
53
|
const Invite = db.invite;
|
@@ -239,15 +238,15 @@ const controllerFactory$4 = (db) => {
|
|
239
238
|
updatePassword
|
240
239
|
};
|
241
240
|
};
|
242
|
-
var auth_controller = controllerFactory$
|
243
|
-
const { sendEmail
|
244
|
-
const controllerFactory$
|
241
|
+
var auth_controller = controllerFactory$2;
|
242
|
+
const { sendEmail, sendSms } = mailing.mailing;
|
243
|
+
const controllerFactory$1 = (db) => {
|
245
244
|
const sendcode = async (req, res) => {
|
246
245
|
const code = Math.floor(1e3 + Math.random() * 9e3);
|
247
246
|
const type = req.body.type;
|
248
247
|
const method = req.body.method;
|
249
248
|
if (type === "email") {
|
250
|
-
const emailSent = await sendEmail
|
249
|
+
const emailSent = await sendEmail(req.body.email, `${process.env.APP_NAME} Verification Code`, `Your ${process.env.APP_NAME} verification code is ${code}`);
|
251
250
|
if (emailSent) {
|
252
251
|
res.send({ code, type, method });
|
253
252
|
} else {
|
@@ -256,7 +255,7 @@ const controllerFactory$3 = (db) => {
|
|
256
255
|
}
|
257
256
|
}
|
258
257
|
if (type === "phone") {
|
259
|
-
const smsSent = await sendSms
|
258
|
+
const smsSent = await sendSms(req.body.phone, `Your ${process.env.APP_NAME} verification code: ${code}`);
|
260
259
|
if (smsSent) {
|
261
260
|
res.send({ code, type, method });
|
262
261
|
} else {
|
@@ -268,146 +267,14 @@ const controllerFactory$3 = (db) => {
|
|
268
267
|
sendcode
|
269
268
|
};
|
270
269
|
};
|
271
|
-
var twofa_controller = controllerFactory$
|
272
|
-
const
|
273
|
-
const { sendEmail, sendSms } = mailing.mailing;
|
274
|
-
const сontrollerFactory = (db) => {
|
275
|
-
const User = db.user;
|
276
|
-
const Invite = db.invite;
|
277
|
-
const Membership = db.membership;
|
278
|
-
const getOneByCode = async (req, res) => {
|
279
|
-
try {
|
280
|
-
const invite = await Invite.findOne({ code: req.params._id });
|
281
|
-
if (!invite) {
|
282
|
-
return res.status(404).send({ message: "Приглашение не найдено" });
|
283
|
-
}
|
284
|
-
res.send(invite);
|
285
|
-
} catch (err) {
|
286
|
-
res.status(500).send({ message: err.message });
|
287
|
-
}
|
288
|
-
};
|
289
|
-
const read = async (req, res) => {
|
290
|
-
try {
|
291
|
-
const invites = await Invite.find({ organization: req.params._id });
|
292
|
-
if (!invites) {
|
293
|
-
return res.status(404).send({ message: "Invites not found" });
|
294
|
-
}
|
295
|
-
res.send(invites);
|
296
|
-
} catch (err) {
|
297
|
-
res.status(500).send({ message: err.message });
|
298
|
-
}
|
299
|
-
};
|
300
|
-
const create = async (req, res) => {
|
301
|
-
const userInviter = JSON.parse(req.cookies.user);
|
302
|
-
const organizationId = req.params._id;
|
303
|
-
try {
|
304
|
-
const invites = req.body;
|
305
|
-
for (let invite of invites) {
|
306
|
-
let user = null;
|
307
|
-
if (invite.contact.includes("@")) {
|
308
|
-
user = await User.findOne({ email: invite.contact });
|
309
|
-
} else {
|
310
|
-
user = await User.findOne({ phone: invite.contact });
|
311
|
-
}
|
312
|
-
if (user) {
|
313
|
-
console.log(invite);
|
314
|
-
const membership = new Membership({
|
315
|
-
user: user._id,
|
316
|
-
type: "organization",
|
317
|
-
target: organizationId,
|
318
|
-
role: invite.role
|
319
|
-
});
|
320
|
-
await membership.save();
|
321
|
-
res.status(200).json({ message: "Invites sent successfully!" });
|
322
|
-
} else {
|
323
|
-
const newInvite = new Invite({
|
324
|
-
code: uuid(),
|
325
|
-
organization: organizationId,
|
326
|
-
role: invite.role,
|
327
|
-
createdBy: userInviter._id,
|
328
|
-
invitedEmail: invite.contact.includes("@") ? invite.contact : null,
|
329
|
-
invitedPhone: !invite.contact.includes("@") ? invite.contact : null
|
330
|
-
});
|
331
|
-
const savedInvite = await newInvite.save();
|
332
|
-
if (savedInvite.invitedEmail) {
|
333
|
-
const to = savedInvite.invitedEmail;
|
334
|
-
const subject = "You have been added to the organization";
|
335
|
-
const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email"`;
|
336
|
-
await sendEmail(to, subject, text);
|
337
|
-
}
|
338
|
-
if (savedInvite.invitedPhone !== null) {
|
339
|
-
const phone = savedInvite.invitedPhone;
|
340
|
-
const message = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=phone`;
|
341
|
-
await sendSms(phone, message);
|
342
|
-
}
|
343
|
-
res.status(200).json({ message: "Invites sent successfully!" });
|
344
|
-
}
|
345
|
-
}
|
346
|
-
} catch (error) {
|
347
|
-
console.error(error);
|
348
|
-
res.status(500).json({ message: "Something went wrong" });
|
349
|
-
}
|
350
|
-
};
|
351
|
-
const deleteInvite = async (req, res) => {
|
352
|
-
try {
|
353
|
-
const invite = await Invite.findOneAndDelete({ _id: req.params._id });
|
354
|
-
if (!invite) {
|
355
|
-
return res.status(404).send({ message: "Invite not found" });
|
356
|
-
}
|
357
|
-
res.send({ message: "Invite deleted successfully" });
|
358
|
-
} catch (err) {
|
359
|
-
res.status(500).send({ message: err.message });
|
360
|
-
}
|
361
|
-
};
|
362
|
-
return {
|
363
|
-
getOneByCode,
|
364
|
-
read,
|
365
|
-
create,
|
366
|
-
delete: deleteInvite
|
367
|
-
};
|
368
|
-
};
|
369
|
-
var invites_controller = сontrollerFactory;
|
370
|
-
const controllerFactory$2 = invites_controller;
|
371
|
-
const middlewareFactory$2 = index.server;
|
372
|
-
var invites_routes = function(app, db) {
|
373
|
-
const controller = controllerFactory$2(db);
|
374
|
-
const { verifyInvites } = middlewareFactory$2(db);
|
375
|
-
app.use(function(req, res, next) {
|
376
|
-
res.header(
|
377
|
-
"Access-Control-Allow-Headers",
|
378
|
-
"Access-Control-Allow-Origin",
|
379
|
-
"x-access-token, Origin, Content-Type, Accept"
|
380
|
-
);
|
381
|
-
next();
|
382
|
-
});
|
383
|
-
app.get(
|
384
|
-
"/api/invites/get/:_id",
|
385
|
-
controller.getOneByCode
|
386
|
-
);
|
387
|
-
app.get(
|
388
|
-
"/api/invites/:_id",
|
389
|
-
controller.read
|
390
|
-
);
|
391
|
-
app.post(
|
392
|
-
"/api/invites/:_id/create",
|
393
|
-
[
|
394
|
-
verifyInvites.checkInviteExist,
|
395
|
-
verifyInvites.checkUsersExist
|
396
|
-
],
|
397
|
-
controller.create
|
398
|
-
);
|
399
|
-
app.delete(
|
400
|
-
"/api/invites/:_id/delete",
|
401
|
-
controller.delete
|
402
|
-
);
|
403
|
-
};
|
404
|
-
const controllerFactory$1 = auth_controller;
|
270
|
+
var twofa_controller = controllerFactory$1;
|
271
|
+
const controllerFactory = auth_controller;
|
405
272
|
const controllerFactoryTwofa = twofa_controller;
|
406
|
-
const middlewareFactory
|
273
|
+
const middlewareFactory = index.server;
|
407
274
|
var auth_routes = function(app, db, origins) {
|
408
|
-
const controller = controllerFactory
|
275
|
+
const controller = controllerFactory(db);
|
409
276
|
const controllerTwofa = controllerFactoryTwofa();
|
410
|
-
const { verifySignUp, verifyUser } = middlewareFactory
|
277
|
+
const { verifySignUp, verifyUser } = middlewareFactory(db);
|
411
278
|
app.use(function(req, res, next) {
|
412
279
|
const origin = req.headers.origin;
|
413
280
|
if (origins.includes(origin)) {
|
@@ -440,34 +307,6 @@ var auth_routes = function(app, db, origins) {
|
|
440
307
|
controller.updatePassword
|
441
308
|
);
|
442
309
|
};
|
443
|
-
const controllerFactory = twofa_controller;
|
444
|
-
const middlewareFactory = index.server;
|
445
|
-
var twofa_routes = function(app, db) {
|
446
|
-
const controller = controllerFactory();
|
447
|
-
const { verifySignUp, verifyUser } = middlewareFactory(db);
|
448
|
-
app.use(function(req, res, next) {
|
449
|
-
res.header(
|
450
|
-
"Access-Control-Allow-Headers",
|
451
|
-
"Access-Control-Allow-Origin",
|
452
|
-
"x-access-token, Origin, Content-Type, Accept"
|
453
|
-
);
|
454
|
-
next();
|
455
|
-
});
|
456
|
-
app.post(
|
457
|
-
"/api/twofa/sendcode",
|
458
|
-
[
|
459
|
-
verifySignUp.checkDuplicateUsernameOrEmail
|
460
|
-
],
|
461
|
-
controller.sendcode
|
462
|
-
);
|
463
|
-
app.post(
|
464
|
-
"/api/twofa/sendcodereset",
|
465
|
-
[
|
466
|
-
verifyUser.checkUserExist
|
467
|
-
],
|
468
|
-
controller.sendcode
|
469
|
-
);
|
470
|
-
};
|
471
310
|
var role_model = (mongoose) => {
|
472
311
|
const Role = mongoose.model(
|
473
312
|
"Role",
|
@@ -477,66 +316,16 @@ var role_model = (mongoose) => {
|
|
477
316
|
);
|
478
317
|
return Role;
|
479
318
|
};
|
480
|
-
var invite_model = (mongoose) => {
|
481
|
-
const InviteSchema = new mongoose.Schema({
|
482
|
-
code: {
|
483
|
-
type: String,
|
484
|
-
required: true,
|
485
|
-
unique: true
|
486
|
-
},
|
487
|
-
organization: {
|
488
|
-
type: mongoose.Schema.Types.ObjectId,
|
489
|
-
ref: "Organization",
|
490
|
-
required: true
|
491
|
-
},
|
492
|
-
status: {
|
493
|
-
type: String,
|
494
|
-
enum: ["active", "used"],
|
495
|
-
default: "active"
|
496
|
-
},
|
497
|
-
role: {
|
498
|
-
name: {
|
499
|
-
type: String,
|
500
|
-
default: "Сотрудник"
|
501
|
-
},
|
502
|
-
value: {
|
503
|
-
type: String,
|
504
|
-
default: "member"
|
505
|
-
}
|
506
|
-
},
|
507
|
-
createdBy: {
|
508
|
-
type: mongoose.Schema.Types.ObjectId,
|
509
|
-
ref: "User"
|
510
|
-
},
|
511
|
-
invitedEmail: {
|
512
|
-
type: String
|
513
|
-
},
|
514
|
-
invitedPhone: {
|
515
|
-
type: String
|
516
|
-
}
|
517
|
-
}, {
|
518
|
-
timestamps: true
|
519
|
-
});
|
520
|
-
const Invite = mongoose.model("Invite", InviteSchema);
|
521
|
-
return Invite;
|
522
|
-
};
|
523
319
|
const AuthController = auth_controller;
|
524
320
|
const TwoFaController = twofa_controller;
|
525
|
-
const InvitesController = invites_controller;
|
526
|
-
const invitesRoutes = invites_routes;
|
527
321
|
const authRoutes = auth_routes;
|
528
|
-
const twofaRoutes = twofa_routes;
|
529
322
|
const RoleModel = role_model;
|
530
|
-
const InviteModel = invite_model;
|
531
323
|
var auth_server = {
|
532
324
|
AuthController,
|
533
325
|
TwoFaController,
|
534
|
-
InvitesController,
|
535
|
-
invitesRoutes,
|
536
326
|
authRoutes,
|
537
327
|
twofaRoutes,
|
538
|
-
RoleModel
|
539
|
-
InviteModel
|
328
|
+
RoleModel
|
540
329
|
};
|
541
330
|
const auth_server$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(auth_server);
|
542
331
|
module.exports = auth_server$1;
|
package/dist/auth.server.mjs
CHANGED
@@ -4,7 +4,6 @@ import require$$1$1 from "bcryptjs";
|
|
4
4
|
import require$$0$1 from "mongoose";
|
5
5
|
import require$$1 from "jwk-to-pem";
|
6
6
|
import { m as mailing } from "./mailing-DT2ZSkCD.mjs";
|
7
|
-
import require$$0$2 from "uuidv4";
|
8
7
|
import { s as server } from "./index-CGIn4v5E.mjs";
|
9
8
|
const jwt$1 = require$$0;
|
10
9
|
const jwkToPem = require$$1;
|
@@ -47,7 +46,7 @@ const jwt = require$$0;
|
|
47
46
|
const bcrypt = require$$1$1;
|
48
47
|
const ObjectId = require$$0$1.Types.ObjectId;
|
49
48
|
const { verifyAppleIdToken } = verifyAppleIdToken_1;
|
50
|
-
const controllerFactory$
|
49
|
+
const controllerFactory$2 = (db) => {
|
51
50
|
const User = db.user;
|
52
51
|
const Membership = db.membership;
|
53
52
|
const Invite = db.invite;
|
@@ -238,15 +237,15 @@ const controllerFactory$4 = (db) => {
|
|
238
237
|
updatePassword
|
239
238
|
};
|
240
239
|
};
|
241
|
-
var auth_controller = controllerFactory$
|
242
|
-
const { sendEmail
|
243
|
-
const controllerFactory$
|
240
|
+
var auth_controller = controllerFactory$2;
|
241
|
+
const { sendEmail, sendSms } = mailing;
|
242
|
+
const controllerFactory$1 = (db) => {
|
244
243
|
const sendcode = async (req, res) => {
|
245
244
|
const code = Math.floor(1e3 + Math.random() * 9e3);
|
246
245
|
const type = req.body.type;
|
247
246
|
const method = req.body.method;
|
248
247
|
if (type === "email") {
|
249
|
-
const emailSent = await sendEmail
|
248
|
+
const emailSent = await sendEmail(req.body.email, `${process.env.APP_NAME} Verification Code`, `Your ${process.env.APP_NAME} verification code is ${code}`);
|
250
249
|
if (emailSent) {
|
251
250
|
res.send({ code, type, method });
|
252
251
|
} else {
|
@@ -255,7 +254,7 @@ const controllerFactory$3 = (db) => {
|
|
255
254
|
}
|
256
255
|
}
|
257
256
|
if (type === "phone") {
|
258
|
-
const smsSent = await sendSms
|
257
|
+
const smsSent = await sendSms(req.body.phone, `Your ${process.env.APP_NAME} verification code: ${code}`);
|
259
258
|
if (smsSent) {
|
260
259
|
res.send({ code, type, method });
|
261
260
|
} else {
|
@@ -267,146 +266,14 @@ const controllerFactory$3 = (db) => {
|
|
267
266
|
sendcode
|
268
267
|
};
|
269
268
|
};
|
270
|
-
var twofa_controller = controllerFactory$
|
271
|
-
const
|
272
|
-
const { sendEmail, sendSms } = mailing;
|
273
|
-
const сontrollerFactory = (db) => {
|
274
|
-
const User = db.user;
|
275
|
-
const Invite = db.invite;
|
276
|
-
const Membership = db.membership;
|
277
|
-
const getOneByCode = async (req, res) => {
|
278
|
-
try {
|
279
|
-
const invite = await Invite.findOne({ code: req.params._id });
|
280
|
-
if (!invite) {
|
281
|
-
return res.status(404).send({ message: "Приглашение не найдено" });
|
282
|
-
}
|
283
|
-
res.send(invite);
|
284
|
-
} catch (err) {
|
285
|
-
res.status(500).send({ message: err.message });
|
286
|
-
}
|
287
|
-
};
|
288
|
-
const read = async (req, res) => {
|
289
|
-
try {
|
290
|
-
const invites = await Invite.find({ organization: req.params._id });
|
291
|
-
if (!invites) {
|
292
|
-
return res.status(404).send({ message: "Invites not found" });
|
293
|
-
}
|
294
|
-
res.send(invites);
|
295
|
-
} catch (err) {
|
296
|
-
res.status(500).send({ message: err.message });
|
297
|
-
}
|
298
|
-
};
|
299
|
-
const create = async (req, res) => {
|
300
|
-
const userInviter = JSON.parse(req.cookies.user);
|
301
|
-
const organizationId = req.params._id;
|
302
|
-
try {
|
303
|
-
const invites = req.body;
|
304
|
-
for (let invite of invites) {
|
305
|
-
let user = null;
|
306
|
-
if (invite.contact.includes("@")) {
|
307
|
-
user = await User.findOne({ email: invite.contact });
|
308
|
-
} else {
|
309
|
-
user = await User.findOne({ phone: invite.contact });
|
310
|
-
}
|
311
|
-
if (user) {
|
312
|
-
console.log(invite);
|
313
|
-
const membership = new Membership({
|
314
|
-
user: user._id,
|
315
|
-
type: "organization",
|
316
|
-
target: organizationId,
|
317
|
-
role: invite.role
|
318
|
-
});
|
319
|
-
await membership.save();
|
320
|
-
res.status(200).json({ message: "Invites sent successfully!" });
|
321
|
-
} else {
|
322
|
-
const newInvite = new Invite({
|
323
|
-
code: uuid(),
|
324
|
-
organization: organizationId,
|
325
|
-
role: invite.role,
|
326
|
-
createdBy: userInviter._id,
|
327
|
-
invitedEmail: invite.contact.includes("@") ? invite.contact : null,
|
328
|
-
invitedPhone: !invite.contact.includes("@") ? invite.contact : null
|
329
|
-
});
|
330
|
-
const savedInvite = await newInvite.save();
|
331
|
-
if (savedInvite.invitedEmail) {
|
332
|
-
const to = savedInvite.invitedEmail;
|
333
|
-
const subject = "You have been added to the organization";
|
334
|
-
const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email"`;
|
335
|
-
await sendEmail(to, subject, text);
|
336
|
-
}
|
337
|
-
if (savedInvite.invitedPhone !== null) {
|
338
|
-
const phone = savedInvite.invitedPhone;
|
339
|
-
const message = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=phone`;
|
340
|
-
await sendSms(phone, message);
|
341
|
-
}
|
342
|
-
res.status(200).json({ message: "Invites sent successfully!" });
|
343
|
-
}
|
344
|
-
}
|
345
|
-
} catch (error) {
|
346
|
-
console.error(error);
|
347
|
-
res.status(500).json({ message: "Something went wrong" });
|
348
|
-
}
|
349
|
-
};
|
350
|
-
const deleteInvite = async (req, res) => {
|
351
|
-
try {
|
352
|
-
const invite = await Invite.findOneAndDelete({ _id: req.params._id });
|
353
|
-
if (!invite) {
|
354
|
-
return res.status(404).send({ message: "Invite not found" });
|
355
|
-
}
|
356
|
-
res.send({ message: "Invite deleted successfully" });
|
357
|
-
} catch (err) {
|
358
|
-
res.status(500).send({ message: err.message });
|
359
|
-
}
|
360
|
-
};
|
361
|
-
return {
|
362
|
-
getOneByCode,
|
363
|
-
read,
|
364
|
-
create,
|
365
|
-
delete: deleteInvite
|
366
|
-
};
|
367
|
-
};
|
368
|
-
var invites_controller = сontrollerFactory;
|
369
|
-
const controllerFactory$2 = invites_controller;
|
370
|
-
const middlewareFactory$2 = server;
|
371
|
-
var invites_routes = function(app, db) {
|
372
|
-
const controller = controllerFactory$2(db);
|
373
|
-
const { verifyInvites } = middlewareFactory$2(db);
|
374
|
-
app.use(function(req, res, next) {
|
375
|
-
res.header(
|
376
|
-
"Access-Control-Allow-Headers",
|
377
|
-
"Access-Control-Allow-Origin",
|
378
|
-
"x-access-token, Origin, Content-Type, Accept"
|
379
|
-
);
|
380
|
-
next();
|
381
|
-
});
|
382
|
-
app.get(
|
383
|
-
"/api/invites/get/:_id",
|
384
|
-
controller.getOneByCode
|
385
|
-
);
|
386
|
-
app.get(
|
387
|
-
"/api/invites/:_id",
|
388
|
-
controller.read
|
389
|
-
);
|
390
|
-
app.post(
|
391
|
-
"/api/invites/:_id/create",
|
392
|
-
[
|
393
|
-
verifyInvites.checkInviteExist,
|
394
|
-
verifyInvites.checkUsersExist
|
395
|
-
],
|
396
|
-
controller.create
|
397
|
-
);
|
398
|
-
app.delete(
|
399
|
-
"/api/invites/:_id/delete",
|
400
|
-
controller.delete
|
401
|
-
);
|
402
|
-
};
|
403
|
-
const controllerFactory$1 = auth_controller;
|
269
|
+
var twofa_controller = controllerFactory$1;
|
270
|
+
const controllerFactory = auth_controller;
|
404
271
|
const controllerFactoryTwofa = twofa_controller;
|
405
|
-
const middlewareFactory
|
272
|
+
const middlewareFactory = server;
|
406
273
|
var auth_routes = function(app, db, origins) {
|
407
|
-
const controller = controllerFactory
|
274
|
+
const controller = controllerFactory(db);
|
408
275
|
const controllerTwofa = controllerFactoryTwofa();
|
409
|
-
const { verifySignUp, verifyUser } = middlewareFactory
|
276
|
+
const { verifySignUp, verifyUser } = middlewareFactory(db);
|
410
277
|
app.use(function(req, res, next) {
|
411
278
|
const origin = req.headers.origin;
|
412
279
|
if (origins.includes(origin)) {
|
@@ -439,34 +306,6 @@ var auth_routes = function(app, db, origins) {
|
|
439
306
|
controller.updatePassword
|
440
307
|
);
|
441
308
|
};
|
442
|
-
const controllerFactory = twofa_controller;
|
443
|
-
const middlewareFactory = server;
|
444
|
-
var twofa_routes = function(app, db) {
|
445
|
-
const controller = controllerFactory();
|
446
|
-
const { verifySignUp, verifyUser } = middlewareFactory(db);
|
447
|
-
app.use(function(req, res, next) {
|
448
|
-
res.header(
|
449
|
-
"Access-Control-Allow-Headers",
|
450
|
-
"Access-Control-Allow-Origin",
|
451
|
-
"x-access-token, Origin, Content-Type, Accept"
|
452
|
-
);
|
453
|
-
next();
|
454
|
-
});
|
455
|
-
app.post(
|
456
|
-
"/api/twofa/sendcode",
|
457
|
-
[
|
458
|
-
verifySignUp.checkDuplicateUsernameOrEmail
|
459
|
-
],
|
460
|
-
controller.sendcode
|
461
|
-
);
|
462
|
-
app.post(
|
463
|
-
"/api/twofa/sendcodereset",
|
464
|
-
[
|
465
|
-
verifyUser.checkUserExist
|
466
|
-
],
|
467
|
-
controller.sendcode
|
468
|
-
);
|
469
|
-
};
|
470
309
|
var role_model = (mongoose) => {
|
471
310
|
const Role = mongoose.model(
|
472
311
|
"Role",
|
@@ -476,66 +315,16 @@ var role_model = (mongoose) => {
|
|
476
315
|
);
|
477
316
|
return Role;
|
478
317
|
};
|
479
|
-
var invite_model = (mongoose) => {
|
480
|
-
const InviteSchema = new mongoose.Schema({
|
481
|
-
code: {
|
482
|
-
type: String,
|
483
|
-
required: true,
|
484
|
-
unique: true
|
485
|
-
},
|
486
|
-
organization: {
|
487
|
-
type: mongoose.Schema.Types.ObjectId,
|
488
|
-
ref: "Organization",
|
489
|
-
required: true
|
490
|
-
},
|
491
|
-
status: {
|
492
|
-
type: String,
|
493
|
-
enum: ["active", "used"],
|
494
|
-
default: "active"
|
495
|
-
},
|
496
|
-
role: {
|
497
|
-
name: {
|
498
|
-
type: String,
|
499
|
-
default: "Сотрудник"
|
500
|
-
},
|
501
|
-
value: {
|
502
|
-
type: String,
|
503
|
-
default: "member"
|
504
|
-
}
|
505
|
-
},
|
506
|
-
createdBy: {
|
507
|
-
type: mongoose.Schema.Types.ObjectId,
|
508
|
-
ref: "User"
|
509
|
-
},
|
510
|
-
invitedEmail: {
|
511
|
-
type: String
|
512
|
-
},
|
513
|
-
invitedPhone: {
|
514
|
-
type: String
|
515
|
-
}
|
516
|
-
}, {
|
517
|
-
timestamps: true
|
518
|
-
});
|
519
|
-
const Invite = mongoose.model("Invite", InviteSchema);
|
520
|
-
return Invite;
|
521
|
-
};
|
522
318
|
const AuthController = auth_controller;
|
523
319
|
const TwoFaController = twofa_controller;
|
524
|
-
const InvitesController = invites_controller;
|
525
|
-
const invitesRoutes = invites_routes;
|
526
320
|
const authRoutes = auth_routes;
|
527
|
-
const twofaRoutes = twofa_routes;
|
528
321
|
const RoleModel = role_model;
|
529
|
-
const InviteModel = invite_model;
|
530
322
|
var auth_server = {
|
531
323
|
AuthController,
|
532
324
|
TwoFaController,
|
533
|
-
InvitesController,
|
534
|
-
invitesRoutes,
|
535
325
|
authRoutes,
|
536
326
|
twofaRoutes,
|
537
|
-
RoleModel
|
538
|
-
InviteModel
|
327
|
+
RoleModel
|
539
328
|
};
|
540
329
|
const auth_server$1 = /* @__PURE__ */ getDefaultExportFromCjs(auth_server);
|
541
330
|
export {
|
package/dist/community.server.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
3
3
|
const require$$0 = require("mongoose");
|
4
|
-
const metadata_schema = require("./metadata.schema-
|
4
|
+
const metadata_schema = require("./metadata.schema-CS6_9GLU.js");
|
5
5
|
require("util");
|
6
6
|
require("uuid");
|
7
7
|
const index = require("./index-CL9l0HRS.js");
|
8
|
+
const ownership_schema = require("./ownership.schema-DN0SlQL6.js");
|
8
9
|
function getPeriodConditions(period) {
|
9
10
|
const currentDate = /* @__PURE__ */ new Date();
|
10
11
|
const startDate = /* @__PURE__ */ new Date();
|
@@ -618,7 +619,7 @@ var reactions_routes = function(app, db) {
|
|
618
619
|
};
|
619
620
|
const applyCommonSchema = metadata_schema.common_schema;
|
620
621
|
const applyEngagementSchema = metadata_schema.engagement_schema;
|
621
|
-
const applyOwnershipSchema =
|
622
|
+
const applyOwnershipSchema = ownership_schema.ownership_schema;
|
622
623
|
const applyMetadataSchema = metadata_schema.metadata_schema;
|
623
624
|
var blogpost_model = (db) => {
|
624
625
|
const BlogpostSchema = new db.mongoose.Schema({
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
2
2
|
import require$$0 from "mongoose";
|
3
|
-
import { q as queryProcessor$3, c as common_schema, e as engagement_schema,
|
3
|
+
import { q as queryProcessor$3, c as common_schema, e as engagement_schema, m as metadata_schema } from "./metadata.schema-D88c1Ebp.mjs";
|
4
4
|
import "util";
|
5
5
|
import "uuid";
|
6
6
|
import { s as server$1 } from "./index-CGIn4v5E.mjs";
|
7
|
+
import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
|
7
8
|
function getPeriodConditions(period) {
|
8
9
|
const currentDate = /* @__PURE__ */ new Date();
|
9
10
|
const startDate = /* @__PURE__ */ new Date();
|