@ozdao/prometheus-framework 0.2.126 → 0.2.128

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. package/dist/auth.server.js +54 -2
  2. package/dist/auth.server.mjs +54 -2
  3. package/dist/gallery.server.js +55 -3
  4. package/dist/gallery.server.mjs +55 -3
  5. package/dist/main-CF35oB7q.js +92 -0
  6. package/dist/main-CmL_j3wv.mjs +14223 -0
  7. package/dist/organizations.server.js +112 -184
  8. package/dist/organizations.server.mjs +112 -184
  9. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  11. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  12. package/dist/prometheus-framework/src/components/Button/Button.vue.js +1 -94
  13. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  14. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +94 -1
  15. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  16. package/dist/prometheus-framework/src/components/Field/Field.vue.js +1 -84
  17. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  18. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +84 -1
  19. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  20. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  21. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  22. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -77
  23. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  24. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +77 -1
  25. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
  26. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +1 -45
  27. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.cjs +1 -1
  28. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.js +45 -1
  29. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  33. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +2 -2
  35. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  36. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +2 -2
  37. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +2 -2
  39. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +2 -2
  41. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +2 -2
  43. package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/auth/store/auth.js +57 -50
  45. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +68 -62
  47. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
  49. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  50. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +3 -3
  51. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  52. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  53. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  55. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +2 -2
  57. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  59. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +3 -3
  61. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +3 -3
  63. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
  65. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
  67. package/dist/prometheus-framework/src/modules/gallery/gallery.client.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/gallery/gallery.client.js +4 -4
  69. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  71. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  72. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
  73. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  74. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  75. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  76. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
  77. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  78. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +3 -3
  79. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  80. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
  81. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  82. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
  83. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  84. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
  85. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  86. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +14 -14
  87. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  88. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  89. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  90. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +116 -94
  91. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  92. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +3 -3
  93. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  94. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  95. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +3 -3
  97. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  98. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  99. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  100. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  101. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  102. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +9 -4
  103. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  104. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  105. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  106. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  107. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  108. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  109. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  110. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  111. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  112. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  113. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  114. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
  115. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  116. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +2 -2
  117. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  118. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
  119. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  120. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  121. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  122. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  123. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  124. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  125. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  126. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  127. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  128. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  129. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  130. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +2 -2
  131. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  132. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +3 -3
  133. package/dist/prometheus-framework.cjs.js +1 -1
  134. package/dist/prometheus-framework.es.js +1 -1
  135. package/dist/style.css +1 -1
  136. package/dist/web-BDaOF322.js +1 -0
  137. package/dist/web-DtWmpLE-.mjs +54 -0
  138. package/package.json +1 -1
  139. package/src/modules/auth/controllers/auth.controller.js +54 -2
  140. package/src/modules/auth/routes/auth.routes.js +8 -1
  141. package/src/modules/auth/store/auth.js +21 -9
  142. package/src/modules/backoffice/components/pages/Dashboard.vue +6 -0
  143. package/src/modules/gallery/gallery.client.js +1 -1
  144. package/src/modules/gallery/routes/gallery.routes.js +7 -3
  145. package/src/modules/globals/mixins/mixins.js +17 -0
  146. package/src/modules/middlewares/server/verifyAccesses.js +100 -23
  147. package/src/modules/organizations/components/blocks/CardDepartment.vue +1 -1
  148. package/src/modules/organizations/components/pages/DepartmentEdit.vue +24 -2
  149. package/src/modules/organizations/components/pages/Members.vue +1 -1
  150. package/src/modules/organizations/models/department.model.js +42 -2
  151. package/src/modules/organizations/routes/departments.routes.js +1 -8
  152. package/src/modules/organizations/store/departments.js +5 -0
@@ -14,17 +14,17 @@ import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
14
14
  import { c as credentials_schema } from "./credentials.schema-C9dmNy7o.mjs";
15
15
  const controllerFactory$6 = (db) => {
16
16
  const Department = db.department;
17
- const readOne = (req, res2) => {
17
+ const readOne = (req, res) => {
18
18
  Department.findOne({ _id: req.params._id }).populate("members.user").populate("subdepartments").then((department) => {
19
19
  if (!department) {
20
- return res2.status(404).send({ message: "Отдел не найден" });
20
+ return res.status(404).send({ message: "Отдел не найден" });
21
21
  }
22
- res2.send(department);
22
+ res.send(department);
23
23
  }).catch((err) => {
24
- res2.status(500).send({ message: err.message });
24
+ res.status(500).send({ message: err.message });
25
25
  });
26
26
  };
27
- const read = (req, res2) => {
27
+ const read = (req, res) => {
28
28
  let query = {};
29
29
  let options = {};
30
30
  if (req.query.organization) {
@@ -35,43 +35,43 @@ const controllerFactory$6 = (db) => {
35
35
  }
36
36
  Department.find(query, null, options).populate("members.user").populate("subdepartments").then((departments) => {
37
37
  if (!departments) {
38
- return res2.status(404).send({ message: "Departments not found" });
38
+ return res.status(404).send({ message: "Departments not found" });
39
39
  }
40
- res2.send(departments);
40
+ res.send(departments);
41
41
  }).catch((err) => {
42
- res2.status(500).send({ message: err.message });
42
+ res.status(500).send({ message: err.message });
43
43
  });
44
44
  };
45
- const create = async (req, res2) => {
45
+ const create = async (req, res) => {
46
46
  try {
47
47
  const newDepartment = new Department({
48
48
  ...req.body,
49
49
  organization: req.params._id
50
50
  });
51
51
  const data = await newDepartment.save();
52
- res2.send(data);
52
+ res.send(data);
53
53
  } catch (err) {
54
- res2.status(500).send({ message: err.message });
54
+ res.status(500).send({ message: err.message });
55
55
  }
56
56
  };
57
- const update = (req, res2) => {
57
+ const update = (req, res) => {
58
58
  Department.findOneAndUpdate({ _id: req.body._id }, req.body, { new: true }).then((department) => {
59
59
  if (!department) {
60
- return res2.status(404).send({ message: "Department not found" });
60
+ return res.status(404).send({ message: "Department not found" });
61
61
  }
62
- res2.send(department);
62
+ res.send(department);
63
63
  }).catch((err) => {
64
- res2.status(500).send({ message: err.message });
64
+ res.status(500).send({ message: err.message });
65
65
  });
66
66
  };
67
- const deleteDepartment = (req, res2) => {
67
+ const deleteDepartment = (req, res) => {
68
68
  Department.findOneAndRemove({ _id: req.body._id, organization: req.params._id }).then((department) => {
69
69
  if (!department) {
70
- return res2.status(404).send({ message: "Department not found" });
70
+ return res.status(404).send({ message: "Department not found" });
71
71
  }
72
- res2.send({ message: "Department deleted successfully" });
72
+ res.send({ message: "Department deleted successfully" });
73
73
  }).catch((err) => {
74
- res2.status(500).send({ message: err.message });
74
+ res.status(500).send({ message: err.message });
75
75
  });
76
76
  };
77
77
  return {
@@ -94,7 +94,7 @@ const controllerFactory$5 = (db) => {
94
94
  const Membership = db.membership;
95
95
  db.user;
96
96
  db.role;
97
- const read = async (req, res2) => {
97
+ const read = async (req, res) => {
98
98
  const sortParam = req.query.sortParam || "numberOfProducts";
99
99
  const sortOrder = req.query.sortOrder || "desc";
100
100
  const sort = {
@@ -174,11 +174,11 @@ const controllerFactory$5 = (db) => {
174
174
  ];
175
175
  console.log(userLocation);
176
176
  } else {
177
- return res2.status(400).send({ message: "Unable to geocode the provided location." });
177
+ return res.status(400).send({ message: "Unable to geocode the provided location." });
178
178
  }
179
179
  } catch (err) {
180
180
  console.log(err);
181
- return res2.status(500).send({ message: "Error occurred while geocoding." });
181
+ return res.status(500).send({ message: "Error occurred while geocoding." });
182
182
  }
183
183
  const radius = city ? 500 : state ? 1e3 : 5e3;
184
184
  matchConditions.push({
@@ -348,13 +348,13 @@ const controllerFactory$5 = (db) => {
348
348
  try {
349
349
  console.log(stages);
350
350
  const organizations = await Organization.aggregate(stages);
351
- res2.status(200).send(organizations);
351
+ res.status(200).send(organizations);
352
352
  } catch (err) {
353
353
  console.log(err);
354
- return res2.status(500).send({ message: err });
354
+ return res.status(500).send({ message: err });
355
355
  }
356
356
  };
357
- const fetch = async (req, res2) => {
357
+ const fetch = async (req, res) => {
358
358
  const Organization2 = db.organization;
359
359
  let query = {};
360
360
  console.log(req.query);
@@ -373,14 +373,14 @@ const controllerFactory$5 = (db) => {
373
373
  try {
374
374
  const organizations = await Organization2.find(query, null, options);
375
375
  if (!organizations || organizations.length === 0) {
376
- return res2.status(404).send({ message: "Organizations not found." });
376
+ return res.status(404).send({ message: "Organizations not found." });
377
377
  }
378
- res2.status(200).send(organizations);
378
+ res.status(200).send(organizations);
379
379
  } catch (err) {
380
- return res2.status(500).send({ message: err });
380
+ return res.status(500).send({ message: err });
381
381
  }
382
382
  };
383
- const create = async (req, res2) => {
383
+ const create = async (req, res) => {
384
384
  if (req.body._id === null) {
385
385
  delete req.body._id;
386
386
  }
@@ -395,13 +395,13 @@ const controllerFactory$5 = (db) => {
395
395
  label: "owner"
396
396
  });
397
397
  const savedMembership = await membership.save();
398
- res2.status(201).json(savedOrganization);
398
+ res.status(201).json(savedOrganization);
399
399
  } catch (error) {
400
400
  console.error("Error:", error);
401
- res2.status(500).send(error);
401
+ res.status(500).send(error);
402
402
  }
403
403
  };
404
- const update = async (req, res2) => {
404
+ const update = async (req, res) => {
405
405
  try {
406
406
  const organizationId = req.params._id;
407
407
  const updatedData = req.body;
@@ -410,17 +410,17 @@ const controllerFactory$5 = (db) => {
410
410
  runValidators: true
411
411
  });
412
412
  if (!organization) {
413
- return res2.status(404).json({ message: "Organization not found" });
413
+ return res.status(404).json({ message: "Organization not found" });
414
414
  }
415
- res2.status(200).json({ message: "Organization updated successfully", organization });
415
+ res.status(200).json({ message: "Organization updated successfully", organization });
416
416
  } catch (error) {
417
- res2.status(500).json({ error: error.message });
417
+ res.status(500).json({ error: error.message });
418
418
  }
419
419
  };
420
- const deleteOrganization = async (req, res2) => {
420
+ const deleteOrganization = async (req, res) => {
421
421
  Organization.findOneAndRemove({ _id: req.params._id }).then((organization) => {
422
422
  if (!organization) {
423
- return res2.status(404).send({ message: "Organization not found" });
423
+ return res.status(404).send({ message: "Organization not found" });
424
424
  }
425
425
  Membership.deleteMany({ target: req.params._id }).then(() => {
426
426
  const newToken = jwt.sign({
@@ -430,12 +430,12 @@ const controllerFactory$5 = (db) => {
430
430
  expiresIn: 86400
431
431
  // 24 hours
432
432
  });
433
- res2.send({ newToken });
433
+ res.send({ newToken });
434
434
  }).catch((err) => {
435
- res2.status(500).send({ message: "Error deleting memberships: " + err.message });
435
+ res.status(500).send({ message: "Error deleting memberships: " + err.message });
436
436
  });
437
437
  }).catch((err) => {
438
- res2.status(500).send({ message: err.message });
438
+ res.status(500).send({ message: err.message });
439
439
  });
440
440
  };
441
441
  return {
@@ -452,7 +452,7 @@ const ObjectId = require$$0.Types.ObjectId;
452
452
  const queryProcessorGlobals = queryProcessor;
453
453
  const controllerFactory$4 = (db) => {
454
454
  const Membership = db.membership;
455
- const read = async (req, res2) => {
455
+ const read = async (req, res) => {
456
456
  try {
457
457
  let search = req.query.search;
458
458
  let regexPattern = "";
@@ -503,16 +503,16 @@ const controllerFactory$4 = (db) => {
503
503
  )
504
504
  ]);
505
505
  if (!memberships || memberships.length === 0) {
506
- return res2.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
506
+ return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
507
507
  }
508
508
  console.log("membership is", memberships[0].user);
509
- res2.send(memberships);
509
+ res.send(memberships);
510
510
  } catch (err) {
511
511
  console.log(err);
512
- res2.status(500).send({ errorCode: "SERVER_ERROR" });
512
+ res.status(500).send({ errorCode: "SERVER_ERROR" });
513
513
  }
514
514
  };
515
- const create = async (req, res2) => {
515
+ const create = async (req, res) => {
516
516
  const newMembership = new Membership({
517
517
  user: req.body.user,
518
518
  type: req.body.type,
@@ -521,35 +521,35 @@ const controllerFactory$4 = (db) => {
521
521
  });
522
522
  try {
523
523
  const data = await newMembership.save();
524
- res2.send(data);
524
+ res.send(data);
525
525
  } catch (err) {
526
- res2.status(500).send({ errorCode: "SERVER_ERROR" });
526
+ res.status(500).send({ errorCode: "SERVER_ERROR" });
527
527
  }
528
528
  };
529
- const update = async (req, res2) => {
529
+ const update = async (req, res) => {
530
530
  try {
531
531
  const membership = await Membership.findByIdAndUpdate(req.body._id, req.body, { new: true });
532
532
  if (!membership) {
533
- return res2.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
533
+ return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
534
534
  }
535
- res2.send(membership);
535
+ res.send(membership);
536
536
  } catch (err) {
537
- res2.status(500).send({ errorCode: "SERVER_ERROR" });
537
+ res.status(500).send({ errorCode: "SERVER_ERROR" });
538
538
  }
539
539
  };
540
- const deleteMembership = async (req, res2) => {
540
+ const deleteMembership = async (req, res) => {
541
541
  console.log(req.body);
542
542
  try {
543
543
  const membership = await Membership.findOneAndDelete({ _id: new ObjectId(req.body._id) });
544
544
  if (!membership) {
545
- return res2.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
545
+ return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
546
546
  } else {
547
547
  await Membership.deleteOne({ _id: membership._id });
548
- res2.status(200).send(membership);
548
+ res.status(200).send(membership);
549
549
  }
550
550
  } catch (error) {
551
551
  console.log(error);
552
- res2.status(500).send({ errorCode: "SERVER_ERROR" });
552
+ res.status(500).send({ errorCode: "SERVER_ERROR" });
553
553
  }
554
554
  };
555
555
  return {
@@ -566,29 +566,29 @@ const сontrollerFactory = (db) => {
566
566
  const User = db.user;
567
567
  const Invite = db.invite;
568
568
  const Membership = db.membership;
569
- const getOneByCode = async (req, res2) => {
569
+ const getOneByCode = async (req, res) => {
570
570
  try {
571
571
  const invite = await Invite.findOne({ code: req.params._id });
572
572
  if (!invite) {
573
- return res2.status(404).send({ message: "Приглашение не найдено" });
573
+ return res.status(404).send({ message: "Приглашение не найдено" });
574
574
  }
575
- res2.send(invite);
575
+ res.send(invite);
576
576
  } catch (err) {
577
- res2.status(500).send({ message: err.message });
577
+ res.status(500).send({ message: err.message });
578
578
  }
579
579
  };
580
- const read = async (req, res2) => {
580
+ const read = async (req, res) => {
581
581
  try {
582
582
  const invites = await Invite.find({ "owner.target": req.params._id });
583
583
  if (!invites || invites.length === 0) {
584
- return res2.status(200).send([]);
584
+ return res.status(200).send([]);
585
585
  }
586
- res2.send(invites);
586
+ res.send(invites);
587
587
  } catch (err) {
588
- res2.status(500).send({ message: err.message });
588
+ res.status(500).send({ message: err.message });
589
589
  }
590
590
  };
591
- const create = async (req, res2) => {
591
+ const create = async (req, res) => {
592
592
  const creator = req.body.creator;
593
593
  const owner = req.body.owner;
594
594
  const list = req.body.invites;
@@ -632,21 +632,21 @@ const сontrollerFactory = (db) => {
632
632
  }
633
633
  }
634
634
  }
635
- res2.status(200).json({ message: "Invites sent successfully!" });
635
+ res.status(200).json({ message: "Invites sent successfully!" });
636
636
  } catch (error) {
637
637
  console.error(error);
638
- res2.status(500).json({ message: "Something went wrong" });
638
+ res.status(500).json({ message: "Something went wrong" });
639
639
  }
640
640
  };
641
- const deleteInvite = async (req, res2) => {
641
+ const deleteInvite = async (req, res) => {
642
642
  try {
643
643
  const invite = await Invite.findOneAndDelete({ _id: req.params._id });
644
644
  if (!invite) {
645
- return res2.status(404).send({ message: "Invite not found" });
645
+ return res.status(404).send({ message: "Invite not found" });
646
646
  }
647
- res2.send({ message: "Invite deleted successfully" });
647
+ res.send({ message: "Invite deleted successfully" });
648
648
  } catch (err) {
649
- res2.status(500).send({ message: err.message });
649
+ res.status(500).send({ message: err.message });
650
650
  }
651
651
  };
652
652
  return {
@@ -657,125 +657,11 @@ const сontrollerFactory = (db) => {
657
657
  };
658
658
  };
659
659
  var invites_controller = сontrollerFactory;
660
- let AccessController$1 = class AccessController {
661
- db = null;
662
- rule = null;
663
- next = null;
664
- entity = null;
665
- /**
666
- * @param {String} rule - Права на проверку (read, create, ...)
667
- * @param {String} entity - Сущность на проверку (departments, post, ...)
668
- */
669
- check(rule, entity) {
670
- if (this.rule === rule && this.entity === entity) {
671
- return this.access.bind(this);
672
- } else if (this.next) {
673
- this.next.check(rule, entity);
674
- } else {
675
- console.error("Неудачная попытка вызова посредника verifyAccesses");
676
- console.error("Переданные аргументы:", this.rule, this.entity);
677
- return async (req, res2, next) => {
678
- return res2.status(403).send({ message: "Access Denied. Middleware not founded" });
679
- };
680
- }
681
- }
682
- };
683
- var AccessController_1 = AccessController$1;
684
- const AccessController2 = AccessController_1;
685
- let ReadDepartments$1 = class ReadDepartments extends AccessController2 {
686
- rule = "read";
687
- entity = "departments";
688
- async access(req, res2, next) {
689
- const Department = this.db.department;
690
- try {
691
- const userId = req.cookies.user._id;
692
- const organization = req.query.organization;
693
- const departments = await Department.find({
694
- organization: { $eq: organization },
695
- members: { $elemMatch: { user: userId } }
696
- });
697
- if (!departments.length) {
698
- return res2.status(403).send({
699
- message: "Access Denied. Read Departments. Департаменты не найдены"
700
- });
701
- }
702
- let hasAccess = false;
703
- departments.forEach((departament) => {
704
- const accesses = departament.accesses;
705
- if (getNestedProperty(accesses, rulePath)) {
706
- hasAccess = true;
707
- }
708
- });
709
- if (hasAccess) {
710
- next();
711
- } else {
712
- return res2.status(403).send({ message: "Access Denied. Read Departments. No access" });
713
- }
714
- } catch (error) {
715
- console.error("[canReadDepartments]", error);
716
- return res2.status(500).send({ message: error.message });
717
- }
718
- }
719
- /**
720
- * // note: пока не использовался метод
721
- * @param {Object} req объект
722
- * @returns
723
- */
724
- async departmentsWhereUserIsMember(req) {
725
- const Department = this.db.department;
726
- try {
727
- const userId = req.cookies.user._id;
728
- const organization = req.query.organization;
729
- const departments = await Department.find({
730
- organization: { $eq: organization },
731
- members: { $elemMatch: { user: userId } }
732
- });
733
- return departments;
734
- } catch (error) {
735
- console.error("[canReadDepartments]", error);
736
- return res.status(500).send({ message: error.message });
737
- }
738
- }
739
- };
740
- var ReadDepartments_1 = ReadDepartments$1;
741
- function getNestedProperty(obj, propertyPath) {
742
- const properties = propertyPath.split(".");
743
- let value = obj;
744
- for (const property of properties) {
745
- if (!value.hasOwnProperty(property)) {
746
- return void 0;
747
- }
748
- value = value[property];
749
- }
750
- return value;
751
- }
752
- const ReadDepartments2 = ReadDepartments_1;
753
- var verifyAccesses = (db) => {
754
- const instances = [];
755
- const middlewares = [
756
- ReadDepartments2
757
- ];
758
- let nextMiddleware = null;
759
- for (let i = middlewares.length - 1; i >= 0; i--) {
760
- const Middleware = middlewares[i];
761
- const middleware = new Middleware();
762
- middleware.db = db;
763
- middleware.next = nextMiddleware;
764
- instances.unshift(middleware);
765
- nextMiddleware = middleware;
766
- }
767
- return (rule, entity) => instances[0].check(rule, entity);
768
- };
769
660
  const controllerFactory$3 = departments_controller;
770
- const accessMiddlewaresFactory = verifyAccesses;
771
661
  var departments_routes = function(app, db) {
772
662
  const controller = controllerFactory$3(db);
773
- accessMiddlewaresFactory(db);
774
663
  app.get(
775
664
  "/api/departments/read",
776
- // [
777
- // verifyAccesses('read', 'departments'),
778
- // ],
779
665
  controller.read
780
666
  );
781
667
  app.get("/api/departments/get/:_id", controller.readOne);
@@ -877,6 +763,48 @@ var department_model = (mongoose) => {
877
763
  default: false
878
764
  },
879
765
  accesses: {
766
+ members: {
767
+ read: {
768
+ type: Boolean,
769
+ default: false
770
+ },
771
+ edit: {
772
+ type: Boolean,
773
+ default: false
774
+ },
775
+ delete: {
776
+ type: Boolean,
777
+ default: false
778
+ }
779
+ },
780
+ gallery: {
781
+ read: {
782
+ type: Boolean,
783
+ default: false
784
+ },
785
+ edit: {
786
+ type: Boolean,
787
+ default: false
788
+ },
789
+ delete: {
790
+ type: Boolean,
791
+ default: false
792
+ }
793
+ },
794
+ leftovers: {
795
+ read: {
796
+ type: Boolean,
797
+ default: false
798
+ },
799
+ edit: {
800
+ type: Boolean,
801
+ default: false
802
+ },
803
+ delete: {
804
+ type: Boolean,
805
+ default: false
806
+ }
807
+ },
880
808
  products: {
881
809
  read: {
882
810
  type: Boolean,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.vue.cjs"),a={class:"bg-light pd-medium radius-big"},c={key:0,class:"mn-b-small flex-v-center flex-nowrap flex"},s={key:0,class:"mn-r-thin t-medium p-big"},u=["onClick"],d=e.createElementVNode("p",{class:"bg-main radius-small t-center i-medium"},"i",-1),m={key:1,class:"w-100"},h={__name:"Block",props:{title:{type:String,default:null},tooltip:{type:String,default:null},actions:{type:Array,default:null},placeholder:{type:String,default:"Nothing here"},options:{type:Object,default:{theme:"white"}}},setup(t){e.useSlots();const r=(n,o={})=>n?n(o).some(l=>Array.isArray(l.children)?!!l.children.length:l.type!==e.Comment):!1;return(n,o)=>(e.openBlock(),e.createElementBlock("div",a,[t.title||t.actions?(e.openBlock(),e.createElementBlock("div",c,[t.title?(e.openBlock(),e.createElementBlock("p",s,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.actions,l=>(e.openBlock(),e.createElementBlock("button",{onClick:l.function,class:e.normalizeClass(["pd-thin button-delete button",l.class||"bg-main radius-small t-center i-medium"])},e.toDisplayString(l.label),11,u))),256)),t.tooltip?(e.openBlock(),e.createBlock(i.default,{key:1,text:t.tooltip},{default:e.withCtx(()=>[d]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r(n.$slots.default)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(t.placeholder),1)),e.renderSlot(n.$slots,"default")]))}};exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../Tooltip/Tooltip.vue2.cjs"),a={class:"bg-light pd-medium radius-big"},c={key:0,class:"mn-b-small flex-v-center flex-nowrap flex"},s={key:0,class:"mn-r-thin t-medium p-big"},u=["onClick"],d=e.createElementVNode("p",{class:"bg-main radius-small t-center i-medium"},"i",-1),m={key:1,class:"w-100"},h={__name:"Block",props:{title:{type:String,default:null},tooltip:{type:String,default:null},actions:{type:Array,default:null},placeholder:{type:String,default:"Nothing here"},options:{type:Object,default:{theme:"white"}}},setup(t){e.useSlots();const r=(n,o={})=>n?n(o).some(l=>Array.isArray(l.children)?!!l.children.length:l.type!==e.Comment):!1;return(n,o)=>(e.openBlock(),e.createElementBlock("div",a,[t.title||t.actions?(e.openBlock(),e.createElementBlock("div",c,[t.title?(e.openBlock(),e.createElementBlock("p",s,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.actions,l=>(e.openBlock(),e.createElementBlock("button",{onClick:l.function,class:e.normalizeClass(["pd-thin button-delete button",l.class||"bg-main radius-small t-center i-medium"])},e.toDisplayString(l.label),11,u))),256)),t.tooltip?(e.openBlock(),e.createBlock(i.default,{key:1,text:t.tooltip},{default:e.withCtx(()=>[d]),_:1},8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r(n.$slots.default)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(t.placeholder),1)),e.renderSlot(n.$slots,"default")]))}};exports.default=h;
@@ -1,5 +1,5 @@
1
1
  import { useSlots as u, openBlock as l, createElementBlock as n, toDisplayString as o, createCommentVNode as r, Fragment as c, renderList as d, normalizeClass as m, createBlock as h, withCtx as f, renderSlot as p, createElementVNode as y, Comment as g } from "vue";
2
- import b from "../Tooltip/Tooltip.vue.js";
2
+ import b from "../Tooltip/Tooltip.vue2.js";
3
3
  const k = { class: "bg-light pd-medium radius-big" }, C = {
4
4
  key: 0,
5
5
  class: "mn-b-small flex-v-center flex-nowrap flex"
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../Loader/Loader.vue2.cjs");require("./Button.vue2.cjs");const v=["disabled"],b={key:2,class:"t-semi loading t-black"},m={key:3,class:"error"},y={key:0,class:"button-counter"},k={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},emits:["error"],setup(t,{emit:r}){const o=t,i=r,l=e.ref(null),a=e.ref(null),s=e.ref(!1),n=e.ref(!1);async function d(){l.value.style["pointer-events"]="none",a.value=null,s.value=!0;const c=()=>{l.value&&(l.value.classList.replace("bg-second","bg-main"),l.value.style.pointerEvents="auto",s.value=!1,n.value=!1,a.value=null)};try{await o.submit(),l.value.classList.replace("bg-main","bg-second"),s.value=!1,o.showSucces?(n.value=!0,setTimeout(c,500)):c(),o.callback&&setTimeout(()=>o.callback(),o.callbackDelay)}catch(u){i("error",u),l.value.classList.replace("bg-main","bg-fourth-nano"),a.value=o.error,setTimeout(()=>{c(),l.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(c,u)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(d,["stop"]),disabled:t.validation,ref_key:"button",ref:l,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!s.value&&!a.value&&!n.value||!t.showLoader?e.renderSlot(c.$slots,"default",{key:0}):s.value&&!a.value&&t.showLoader?(e.openBlock(),e.createBlock(f.default,{key:1,class:"pos-relative pos-t-0 pos-l-0 loading"})):n.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",b,e.toDisplayString(t.text.success),1)):a.value?(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",y,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,v))}};exports.default=k;
1
+ "use strict";
@@ -1,94 +1 @@
1
- import { ref as n, openBlock as c, createElementBlock as r, withModifiers as y, createVNode as k, Transition as h, withCtx as p, renderSlot as g, createBlock as B, toDisplayString as i, createCommentVNode as f } from "vue";
2
- import w from "../Loader/Loader.vue2.js";
3
- import "./Button.vue2.js";
4
- const L = ["disabled"], S = {
5
- key: 2,
6
- class: "t-semi loading t-black"
7
- }, T = {
8
- key: 3,
9
- class: "error"
10
- }, x = {
11
- key: 0,
12
- class: "button-counter"
13
- }, j = {
14
- __name: "Button",
15
- props: {
16
- submit: {
17
- type: Function,
18
- default: async () => {
19
- console.log("Button click.");
20
- }
21
- },
22
- text: {
23
- type: Object,
24
- default: (e) => (console.log(e), e = {
25
- ...e.text,
26
- success: "✔",
27
- error: "✖"
28
- })
29
- },
30
- counter: {
31
- type: Object
32
- },
33
- callback: {
34
- type: Function,
35
- default: async () => {
36
- console.log("Button callback.");
37
- }
38
- },
39
- callbackDelay: {
40
- type: Number,
41
- default: 750
42
- },
43
- showSucces: {
44
- type: Boolean,
45
- default: !0
46
- },
47
- showLoader: {
48
- type: Boolean,
49
- default: !0
50
- },
51
- validation: {
52
- type: Boolean,
53
- default: !1
54
- }
55
- },
56
- emits: ["error"],
57
- setup(e, { emit: b }) {
58
- const l = e, v = b, t = n(null), a = n(null), o = n(!1), u = n(!1);
59
- async function m() {
60
- t.value.style["pointer-events"] = "none", a.value = null, o.value = !0;
61
- const s = () => {
62
- t.value && (t.value.classList.replace("bg-second", "bg-main"), t.value.style.pointerEvents = "auto", o.value = !1, u.value = !1, a.value = null);
63
- };
64
- try {
65
- await l.submit(), t.value.classList.replace("bg-main", "bg-second"), o.value = !1, l.showSucces ? (u.value = !0, setTimeout(s, 500)) : s(), l.callback && setTimeout(() => l.callback(), l.callbackDelay);
66
- } catch (d) {
67
- v("error", d), t.value.classList.replace("bg-main", "bg-fourth-nano"), a.value = l.error, setTimeout(() => {
68
- s(), t.value.classList.replace("bg-fourth-nano", "bg-main");
69
- }, 1330);
70
- }
71
- }
72
- return (s, d) => (c(), r("button", {
73
- onClick: y(m, ["stop"]),
74
- disabled: e.validation,
75
- ref_key: "button",
76
- ref: t,
77
- class: "button"
78
- }, [
79
- k(h, { name: "moveFromTopAbsolute" }, {
80
- default: p(() => [
81
- !o.value && !a.value && !u.value || !e.showLoader ? g(s.$slots, "default", { key: 0 }) : o.value && !a.value && e.showLoader ? (c(), B(w, {
82
- key: 1,
83
- class: "pos-relative pos-t-0 pos-l-0 loading"
84
- })) : u.value && e.showSucces ? (c(), r("span", S, i(e.text.success), 1)) : a.value ? (c(), r("span", T, i(a.value), 1)) : f("", !0)
85
- ]),
86
- _: 3
87
- }),
88
- e.counter ? (c(), r("p", x, i(e.counter), 1)) : f("", !0)
89
- ], 8, L));
90
- }
91
- };
92
- export {
93
- j as default
94
- };
1
+
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../Loader/Loader.vue2.cjs");require("./Button.vue.cjs");const v=["disabled"],b={key:2,class:"t-semi loading t-black"},m={key:3,class:"error"},y={key:0,class:"button-counter"},k={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},emits:["error"],setup(t,{emit:r}){const o=t,i=r,l=e.ref(null),a=e.ref(null),s=e.ref(!1),n=e.ref(!1);async function d(){l.value.style["pointer-events"]="none",a.value=null,s.value=!0;const c=()=>{l.value&&(l.value.classList.replace("bg-second","bg-main"),l.value.style.pointerEvents="auto",s.value=!1,n.value=!1,a.value=null)};try{await o.submit(),l.value.classList.replace("bg-main","bg-second"),s.value=!1,o.showSucces?(n.value=!0,setTimeout(c,500)):c(),o.callback&&setTimeout(()=>o.callback(),o.callbackDelay)}catch(u){i("error",u),l.value.classList.replace("bg-main","bg-fourth-nano"),a.value=o.error,setTimeout(()=>{c(),l.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(c,u)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(d,["stop"]),disabled:t.validation,ref_key:"button",ref:l,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!s.value&&!a.value&&!n.value||!t.showLoader?e.renderSlot(c.$slots,"default",{key:0}):s.value&&!a.value&&t.showLoader?(e.openBlock(),e.createBlock(f.default,{key:1,class:"pos-relative pos-t-0 pos-l-0 loading"})):n.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",b,e.toDisplayString(t.text.success),1)):a.value?(e.openBlock(),e.createElementBlock("span",m,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",y,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,v))}};exports.default=k;