@ozdao/prometheus-framework 0.2.60 → 0.2.61

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. package/dist/auth.server.js +12 -223
  2. package/dist/auth.server.mjs +12 -223
  3. package/dist/community.server.js +3 -2
  4. package/dist/community.server.mjs +2 -1
  5. package/dist/events.server.js +101 -29
  6. package/dist/events.server.mjs +100 -28
  7. package/dist/files.server.js +7 -7
  8. package/dist/files.server.mjs +7 -7
  9. package/dist/gallery.server.js +2 -2
  10. package/dist/gallery.server.mjs +2 -2
  11. package/dist/main-DsseFd2d.mjs +13753 -0
  12. package/dist/main-U466Gwzt.js +91 -0
  13. package/dist/main.css +1 -1
  14. package/dist/metadata.schema-CS6_9GLU.js +174 -0
  15. package/dist/metadata.schema-D88c1Ebp.mjs +175 -0
  16. package/dist/organizations.server.js +212 -16
  17. package/dist/organizations.server.mjs +212 -16
  18. package/dist/ownership.schema-DN0SlQL6.js +36 -0
  19. package/dist/ownership.schema-oyx6eNkZ.mjs +37 -0
  20. package/dist/products.server.js +8 -5
  21. package/dist/products.server.mjs +8 -5
  22. package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs +1 -1
  23. package/dist/prometheus-framework/src/components/Chips/Chips.vue.js +19 -14
  24. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +27 -27
  26. package/dist/prometheus-framework/src/components/Loader/Loader.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/components/Loader/Loader.vue.js +1 -51
  28. package/dist/prometheus-framework/src/components/Loader/Loader.vue2.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/Loader/Loader.vue2.js +51 -1
  30. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -72
  32. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  33. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +72 -1
  34. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/components/Select/Select.vue.js +1 -97
  36. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  37. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +97 -1
  38. package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +1 -1
  40. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +1 -36
  42. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
  43. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +36 -1
  44. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
  46. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  47. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
  48. package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +1 -1
  50. package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/auth/auth.client.js +12 -14
  52. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +1 -1
  54. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +1 -1
  56. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +2 -2
  58. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +1 -1
  60. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +1 -1
  62. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +1 -1
  64. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  66. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/community/components/pages/BlogPost.vue.js +1 -1
  68. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
  70. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
  72. package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/community/components/sections/Feed.vue.js +1 -1
  74. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  76. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
  78. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +198 -184
  80. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -0
  81. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +168 -0
  82. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.cjs +1 -0
  83. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.js +1 -0
  84. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +1 -1
  86. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +3 -3
  88. package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/events/components/sections/Feed.vue.js +1 -1
  90. package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/events/components/sections/List.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/events/router/events.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/events/router/events.js +11 -2
  94. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  96. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
  98. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +67 -64
  100. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +2 -2
  102. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  104. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +1 -1
  106. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  108. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  110. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +4 -4
  112. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +3 -3
  114. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  115. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +24 -24
  116. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  117. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  118. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  119. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  120. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  121. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  122. package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.cjs +1 -1
  123. package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +1 -1
  124. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  126. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  128. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -38
  130. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +19 -19
  132. package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
  133. package/dist/prometheus-framework/src/modules/organizations/store/invites.js +5 -5
  134. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.js +36 -27
  136. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  137. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  138. package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/products/components/blocks/Images360.vue.js +1 -1
  140. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  141. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  142. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  143. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  144. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +7 -7
  146. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +21 -21
  148. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
  150. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/products/components/pages/ProductRecommmendation.vue.js +1 -1
  152. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +36 -50
  154. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  155. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
  156. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  157. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  158. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
  159. package/dist/prometheus-framework/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
  160. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  161. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  162. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  163. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  164. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  165. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +1 -1
  166. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  167. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  168. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  169. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
  170. package/dist/prometheus-framework.cjs.js +1 -1
  171. package/dist/prometheus-framework.es.js +1 -1
  172. package/dist/style.css +1 -1
  173. package/dist/web-D7bW32Ul.mjs +54 -0
  174. package/dist/web-DpE9HxA3.js +1 -0
  175. package/package.json +1 -1
  176. package/src/components/Chips/Chips.vue +2 -2
  177. package/src/components/Feed/Feed.vue +2 -1
  178. package/src/modules/auth/auth.client.js +0 -2
  179. package/src/modules/auth/auth.server.js +1 -7
  180. package/src/modules/auth/components/pages/Invite.vue +1 -1
  181. package/src/modules/events/components/pages/EditEvent.vue +19 -0
  182. package/src/modules/events/components/pages/EditEventTickets.vue +194 -0
  183. package/src/modules/events/controllers/tickets.controller.js +103 -28
  184. package/src/modules/events/models/ticket.model.js +22 -4
  185. package/src/modules/events/router/events.js +5 -0
  186. package/src/modules/events/routes/tickets.routes.js +2 -2
  187. package/src/modules/events/store/tickets.js +1 -0
  188. package/src/modules/globals/components/blocks/CardHeader.vue +6 -6
  189. package/src/modules/organizations/components/pages/Members.vue +1 -1
  190. package/src/modules/organizations/components/pages/Organization.vue +4 -4
  191. package/src/modules/organizations/components/sections/MembersAdd.vue +1 -1
  192. package/src/modules/organizations/controllers/departments.controller.js +14 -1
  193. package/src/modules/organizations/models/department.model.js +5 -1
  194. package/src/modules/organizations/organizations.client.js +2 -0
  195. package/src/modules/organizations/organizations.server.js +6 -2
  196. package/src/modules/organizations/routes/departments.routes.js +1 -1
  197. package/src/modules/organizations/store/departments.js +3 -2
  198. package/src/modules/products/components/blocks/CardLeftover.vue +19 -7
  199. package/src/modules/products/components/pages/EditLeftover.vue +1 -1
  200. package/src/modules/products/components/pages/Leftovers.vue +14 -3
  201. package/src/modules/products/components/pages/Products.vue +8 -8
  202. package/src/modules/products/models/leftover.model.js +9 -5
  203. package/src/modules/users/models/client.model.js +60 -0
  204. /package/src/modules/{auth → organizations}/controllers/invites.controller.js +0 -0
  205. /package/src/modules/{auth → organizations}/models/invite.model.js +0 -0
  206. /package/src/modules/{auth → organizations}/routes/invites.routes.js +0 -0
  207. /package/src/modules/{auth → organizations}/store/invites.js +0 -0
@@ -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$4 = (db) => {
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$4;
243
- const { sendEmail: sendEmail$1, sendSms: sendSms$1 } = mailing.mailing;
244
- const controllerFactory$3 = (db) => {
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$1(req.body.email, `${process.env.APP_NAME} Verification Code`, `Your ${process.env.APP_NAME} verification code is ${code}`);
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$1(req.body.phone, `Your ${process.env.APP_NAME} verification code: ${code}`);
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$3;
272
- const { uuid } = require$$0$2;
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$1 = index.server;
273
+ const middlewareFactory = index.server;
407
274
  var auth_routes = function(app, db, origins) {
408
- const controller = controllerFactory$1(db);
275
+ const controller = controllerFactory(db);
409
276
  const controllerTwofa = controllerFactoryTwofa();
410
- const { verifySignUp, verifyUser } = middlewareFactory$1(db);
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;
@@ -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$4 = (db) => {
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$4;
242
- const { sendEmail: sendEmail$1, sendSms: sendSms$1 } = mailing;
243
- const controllerFactory$3 = (db) => {
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$1(req.body.email, `${process.env.APP_NAME} Verification Code`, `Your ${process.env.APP_NAME} verification code is ${code}`);
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$1(req.body.phone, `Your ${process.env.APP_NAME} verification code: ${code}`);
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$3;
271
- const { uuid } = require$$0$2;
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$1 = server;
272
+ const middlewareFactory = server;
406
273
  var auth_routes = function(app, db, origins) {
407
- const controller = controllerFactory$1(db);
274
+ const controller = controllerFactory(db);
408
275
  const controllerTwofa = controllerFactoryTwofa();
409
- const { verifySignUp, verifyUser } = middlewareFactory$1(db);
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 {
@@ -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-doiYQfuO.js");
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 = metadata_schema.ownership_schema;
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, o as ownership_schema, m as metadata_schema } from "./metadata.schema-CjpDDEnW.mjs";
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();