@ozdao/prometheus-framework 0.2.48 → 0.2.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. package/dist/auth.server.js +27 -25
  2. package/dist/auth.server.mjs +27 -25
  3. package/dist/community.server.js +1 -1
  4. package/dist/community.server.mjs +1 -1
  5. package/dist/events.server.js +1 -1
  6. package/dist/events.server.mjs +1 -1
  7. package/dist/files.server.js +1 -1
  8. package/dist/files.server.mjs +1 -1
  9. package/dist/gallery.server.js +1 -1
  10. package/dist/gallery.server.mjs +1 -1
  11. package/dist/index-3981e903.mjs +217 -0
  12. package/dist/index-4eecfdb9.js +216 -0
  13. package/dist/main-203b36b6.mjs +13628 -0
  14. package/dist/main-_b1_i8mt.mjs +13606 -0
  15. package/dist/main-a7ae4ce5.js +91 -0
  16. package/dist/main-uiQFxEks.js +91 -0
  17. package/dist/main.css +1 -1
  18. package/dist/middlewares.server.js +1 -1
  19. package/dist/middlewares.server.mjs +1 -1
  20. package/dist/node_modules/vue-select/dist/vue-select.es.cjs +1 -3
  21. package/dist/node_modules/vue-select/dist/vue-select.es.js +49 -645
  22. package/dist/organizations.server.js +35 -43
  23. package/dist/organizations.server.mjs +35 -43
  24. package/dist/products.server.js +107 -24
  25. package/dist/products.server.mjs +107 -24
  26. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/components/Button/Button.vue.js +2 -225
  28. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +225 -2
  30. package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue.js +61 -2
  32. package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.cjs +1 -1
  33. package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.js +2 -61
  34. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/components/Field/Field.vue.js +2 -76
  36. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  37. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +76 -2
  38. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  40. package/dist/prometheus-framework/src/components/SelectMulti/SelectMulti.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/components/SelectMulti/SelectMulti.vue.js +6 -6
  42. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  43. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +2 -44
  44. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  45. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +44 -2
  46. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  48. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  50. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  52. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +44 -32
  54. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  56. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  58. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  60. package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/auth/store/auth.js +45 -44
  62. package/dist/prometheus-framework/src/modules/auth/store/invites.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/auth/store/invites.js +5 -5
  64. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
  66. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +3 -3
  68. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  70. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  72. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +3 -3
  74. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +1 -1
  76. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  78. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
  80. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
  82. package/dist/prometheus-framework/src/modules/globals/store/globals.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/globals/store/globals.js +22 -21
  84. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +3 -3
  86. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +11 -2
  88. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +2 -11
  90. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.js +1 -1
  96. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +17 -17
  98. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +49 -42
  100. package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.js +48 -15
  102. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  104. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +38 -37
  106. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +249 -61
  108. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +78 -45
  110. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +160 -86
  112. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  114. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  115. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  116. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  117. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  118. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  119. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +52 -54
  120. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  121. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +20 -26
  122. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  123. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -46
  124. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +34 -30
  126. package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +30 -28
  128. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +18 -18
  130. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  132. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  133. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  134. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  136. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  137. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  138. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.js +33 -28
  140. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  141. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +123 -113
  142. package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.cjs +1 -1
  143. package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.js +1 -1
  144. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  146. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  148. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  150. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  152. package/dist/prometheus-framework/src/modules/products/store/products.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/products/store/products.js +1 -1
  154. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  155. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
  156. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  157. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +3 -3
  158. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  159. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  160. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  161. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  162. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  163. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  164. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  165. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +1 -1
  166. package/dist/prometheus-framework.cjs.js +1 -1
  167. package/dist/prometheus-framework.es.js +1 -1
  168. package/dist/reports.server.js +1 -1
  169. package/dist/reports.server.mjs +1 -1
  170. package/dist/style.css +1 -1
  171. package/dist/web-7p76PGnO.mjs +55 -0
  172. package/dist/web-c63f0ecc.js +1 -0
  173. package/dist/web-d8173758.mjs +55 -0
  174. package/dist/web-dn8vgptQ.js +1 -0
  175. package/package.json +1 -1
  176. package/src/components/SelectMulti/SelectMulti.vue +1 -1
  177. package/src/modules/auth/components/pages/Invite.vue +17 -6
  178. package/src/modules/auth/controllers/auth.controller.js +24 -16
  179. package/src/modules/auth/controllers/invites.controller.js +17 -8
  180. package/src/modules/auth/store/auth.js +8 -1
  181. package/src/modules/auth/store/invites.js +1 -0
  182. package/src/modules/globals/store/globals.js +5 -1
  183. package/src/modules/landing/components/blocks/MapBlock.vue +37 -0
  184. package/src/modules/landing/components/pages/404.vue +3 -0
  185. package/src/modules/landing/components/pages/Governance.vue +155 -0
  186. package/src/modules/landing/components/pages/Home.vue +52 -0
  187. package/src/modules/landing/components/pages/Hotel.vue +54 -0
  188. package/src/modules/landing/components/pages/Page.vue +184 -0
  189. package/src/modules/landing/components/sections/AboutSection.vue +69 -0
  190. package/src/modules/landing/components/sections/Examples.vue +90 -0
  191. package/src/modules/landing/components/sections/FeatureSection.vue +80 -0
  192. package/src/modules/landing/components/sections/GiftSection.vue +63 -0
  193. package/src/modules/landing/components/sections/HeroSection.vue +74 -0
  194. package/src/modules/landing/components/sections/HowItWorksSection.vue +88 -0
  195. package/src/modules/landing/components/sections/HowToBuyWDR.vue +131 -0
  196. package/src/modules/landing/components/sections/InstagramSection.vue +181 -0
  197. package/src/modules/landing/components/sections/MapSection.vue +91 -0
  198. package/src/modules/landing/components/sections/SectionsSection.vue +69 -0
  199. package/src/modules/landing/components/sections/SliderFeatures.vue +131 -0
  200. package/src/modules/landing/components/sections/WhatIsWDRSection.vue +116 -0
  201. package/src/modules/landing/router/landing.js +34 -0
  202. package/src/modules/middlewares/server/verifySignUp.js +4 -0
  203. package/src/modules/mobile/components/BottomNavigation/BottomNavigation.vue +86 -0
  204. package/src/modules/mobile/components/BottomSheet/BottomSheet.vue +86 -0
  205. package/src/modules/mobile/components/NavigationBar/NavigationBar.vue +132 -0
  206. package/src/modules/mobile/components/Walkthrough/Walkthrough.vue +195 -0
  207. package/src/modules/organizations/components/blocks/CardDepartment.vue +3 -3
  208. package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +52 -44
  209. package/src/modules/organizations/components/blocks/User.vue +42 -10
  210. package/src/modules/organizations/components/pages/Department.vue +7 -6
  211. package/src/modules/organizations/components/pages/DepartmentEdit.vue +110 -134
  212. package/src/modules/organizations/components/pages/Members.vue +85 -26
  213. package/src/modules/organizations/components/pages/Organization.vue +59 -4
  214. package/src/modules/organizations/components/sections/MembersAdd.vue +27 -34
  215. package/src/modules/organizations/components/sections/Organizations.vue +0 -1
  216. package/src/modules/organizations/controllers/memberships.controller.js +33 -26
  217. package/src/modules/organizations/controllers/organizations.controller.js +1 -1
  218. package/src/modules/organizations/models/department.model.js +0 -19
  219. package/src/modules/organizations/models/membership.model.js +4 -0
  220. package/src/modules/organizations/organizations.client.js +1 -6
  221. package/src/modules/organizations/store/departments.js +48 -44
  222. package/src/modules/organizations/store/memberships.js +11 -3
  223. package/src/modules/products/components/blocks/CardPosition.vue +2 -2
  224. package/src/modules/products/components/pages/Product.vue +6 -1
  225. package/src/modules/products/components/pages/ProductEdit.vue +48 -28
  226. package/src/modules/products/controllers/products.controller.js +99 -33
  227. package/src/modules/products/models/product.model.js +16 -1
  228. package/src/modules/products/store/products.js +1 -1
  229. package/src/modules/users/components/pages/ProfileOrganizations.vue +41 -7
  230. package/src/styles/layout.scss +1 -1
  231. package/src/modules/organizations/components/sections/FeedDepartments.vue +0 -64
  232. package/src/modules/organizations/components/sections/MembersList.vue +0 -85
  233. package/src/modules/organizations/store/invites.js +0 -93
@@ -72,7 +72,7 @@ const controllerFactory$5 = (db) => {
72
72
  };
73
73
  var departments_controller = controllerFactory$5;
74
74
  const jwt = require$$0$1;
75
- const ObjectId$1 = require$$0.Types.ObjectId;
75
+ const ObjectId$2 = require$$0.Types.ObjectId;
76
76
  const { Client } = require$$5;
77
77
  const client = new Client({});
78
78
  const addUserStatusFields = addMembersQuantity$1.addUserStatusFields_1;
@@ -116,15 +116,15 @@ const controllerFactory$4 = (db) => {
116
116
  }));
117
117
  }
118
118
  const matchConditions = [
119
- ...req.query._id ? [{ _id: new ObjectId$1(req.query._id) }] : [],
120
- ...req.query.owner ? [{ owner: new ObjectId$1(req.query.owner) }] : [],
121
- ...req.query.member ? [{ "memberships.user": new ObjectId$1(req.query.member), "memberships.role": { $nin: ["subscriber", "owner"] } }] : [],
122
- ...req.query.subscriber ? [{ "memberships.user": new ObjectId$1(req.query.subscriber), "memberships.role": "subscriber" }] : [],
123
- ...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$1(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$1(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
119
+ ...req.query._id ? [{ _id: new ObjectId$2(req.query._id) }] : [],
120
+ ...req.query.owner ? [{ owner: new ObjectId$2(req.query.owner) }] : [],
121
+ ...req.query.member ? [{ "memberships.user": new ObjectId$2(req.query.member), "memberships.role": "member" }] : [],
122
+ ...req.query.subscriber ? [{ "memberships.user": new ObjectId$2(req.query.subscriber), "memberships.role": "subscriber" }] : [],
123
+ ...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$2(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$2(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
124
124
  ...req.query.types ? [{ types: { $in: req.query.types } }] : [],
125
125
  // Если req.query.types - строка
126
126
  // to remove
127
- ...req.query.onlyuser ? [{ "memberships.user": new ObjectId$1(req.query.onlyuser) }] : [],
127
+ ...req.query.onlyuser ? [{ "memberships.user": new ObjectId$2(req.query.onlyuser) }] : [],
128
128
  ...categories.length > 0 ? [{ "products.category": { $in: categories } }] : [],
129
129
  ...delivery.length > 0 ? [{ "spots.delivery": { $all: delivery } }] : [],
130
130
  ...priceConditions.length > 0 ? [{ $or: priceConditions }] : [],
@@ -425,26 +425,33 @@ const controllerFactory$4 = (db) => {
425
425
  };
426
426
  };
427
427
  var organizations_controller = controllerFactory$4;
428
+ const ObjectId$1 = require$$0.Types.ObjectId;
428
429
  const controllerFactory$3 = (db) => {
429
430
  const Membership = db.membership;
430
431
  const read = async (req, res) => {
431
- let query = {};
432
- let options = {};
433
- if (req.query.user) {
434
- query.user = req.query.user;
435
- }
436
- if (req.query.type) {
437
- query.type = req.query.type;
438
- }
439
- if (req.query.target) {
440
- query.target = req.query.target;
441
- }
442
- if (req.query.role) {
443
- query.role = req.query.role;
444
- }
445
432
  try {
446
- const memberships = await Membership.find(query, null, options).populate("user");
447
- if (!memberships) {
433
+ const memberships = await Membership.aggregate([
434
+ {
435
+ $match: {
436
+ ...req.query.user && { user: req.query.user },
437
+ ...req.query.type && { type: req.query.type },
438
+ ...req.query.target && { target: req.query.target },
439
+ ...req.query.role && { role: req.query.role }
440
+ }
441
+ },
442
+ {
443
+ $lookup: {
444
+ from: "users",
445
+ localField: "user",
446
+ foreignField: "_id",
447
+ as: "user"
448
+ }
449
+ },
450
+ {
451
+ $unwind: "$user"
452
+ }
453
+ ]);
454
+ if (!memberships || memberships.length === 0) {
448
455
  return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
449
456
  }
450
457
  res.send(memberships);
@@ -480,10 +487,9 @@ const controllerFactory$3 = (db) => {
480
487
  }
481
488
  };
482
489
  const deleteMembership = async (req, res) => {
483
- const { type, target, user: user2, role } = req.body;
484
490
  console.log(req.body);
485
491
  try {
486
- const membership = await Membership.findOne({ type, target, user: user2, role });
492
+ const membership = await Membership.findOneAndDelete({ _id: new ObjectId$1(req.body._id) });
487
493
  if (!membership) {
488
494
  return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
489
495
  } else {
@@ -592,23 +598,6 @@ var department_model = (mongoose) => {
592
598
  description: { type: String },
593
599
  categories: [String]
594
600
  },
595
- // Working hours
596
- address: String,
597
- // Position on map
598
- location: {
599
- lat: Number,
600
- lng: Number,
601
- type: {
602
- type: String,
603
- enum: ["Point"],
604
- // 'location.type' must be 'Point'
605
- required: true
606
- },
607
- coordinates: {
608
- type: [Number],
609
- required: true
610
- }
611
- },
612
601
  worktime: [{
613
602
  day: String,
614
603
  time: {
@@ -639,7 +628,6 @@ var department_model = (mongoose) => {
639
628
  ]
640
629
  });
641
630
  departmentSchema.index({ organization: 1 });
642
- departmentSchema.index({ location: "2dsphere" });
643
631
  const Department = mongoose.model("Department", departmentSchema);
644
632
  return Department;
645
633
  };
@@ -727,6 +715,10 @@ var membership_model = (mongoose) => {
727
715
  type: String,
728
716
  default: "subscriber"
729
717
  },
718
+ label: {
719
+ type: String,
720
+ default: "subscriber"
721
+ },
730
722
  target: {
731
723
  // заменяем 'organization' на 'target', так как это может быть или User, или Organization
732
724
  type: mongoose.Schema.Types.ObjectId,
@@ -71,7 +71,7 @@ const controllerFactory$5 = (db) => {
71
71
  };
72
72
  var departments_controller = controllerFactory$5;
73
73
  const jwt = require$$0$1;
74
- const ObjectId$1 = require$$0.Types.ObjectId;
74
+ const ObjectId$2 = require$$0.Types.ObjectId;
75
75
  const { Client } = require$$5;
76
76
  const client = new Client({});
77
77
  const addUserStatusFields = addUserStatusFields_1;
@@ -115,15 +115,15 @@ const controllerFactory$4 = (db) => {
115
115
  }));
116
116
  }
117
117
  const matchConditions = [
118
- ...req.query._id ? [{ _id: new ObjectId$1(req.query._id) }] : [],
119
- ...req.query.owner ? [{ owner: new ObjectId$1(req.query.owner) }] : [],
120
- ...req.query.member ? [{ "memberships.user": new ObjectId$1(req.query.member), "memberships.role": { $nin: ["subscriber", "owner"] } }] : [],
121
- ...req.query.subscriber ? [{ "memberships.user": new ObjectId$1(req.query.subscriber), "memberships.role": "subscriber" }] : [],
122
- ...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$1(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$1(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
118
+ ...req.query._id ? [{ _id: new ObjectId$2(req.query._id) }] : [],
119
+ ...req.query.owner ? [{ owner: new ObjectId$2(req.query.owner) }] : [],
120
+ ...req.query.member ? [{ "memberships.user": new ObjectId$2(req.query.member), "memberships.role": "member" }] : [],
121
+ ...req.query.subscriber ? [{ "memberships.user": new ObjectId$2(req.query.subscriber), "memberships.role": "subscriber" }] : [],
122
+ ...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$2(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$2(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
123
123
  ...req.query.types ? [{ types: { $in: req.query.types } }] : [],
124
124
  // Если req.query.types - строка
125
125
  // to remove
126
- ...req.query.onlyuser ? [{ "memberships.user": new ObjectId$1(req.query.onlyuser) }] : [],
126
+ ...req.query.onlyuser ? [{ "memberships.user": new ObjectId$2(req.query.onlyuser) }] : [],
127
127
  ...categories.length > 0 ? [{ "products.category": { $in: categories } }] : [],
128
128
  ...delivery.length > 0 ? [{ "spots.delivery": { $all: delivery } }] : [],
129
129
  ...priceConditions.length > 0 ? [{ $or: priceConditions }] : [],
@@ -424,26 +424,33 @@ const controllerFactory$4 = (db) => {
424
424
  };
425
425
  };
426
426
  var organizations_controller = controllerFactory$4;
427
+ const ObjectId$1 = require$$0.Types.ObjectId;
427
428
  const controllerFactory$3 = (db) => {
428
429
  const Membership = db.membership;
429
430
  const read = async (req, res) => {
430
- let query = {};
431
- let options = {};
432
- if (req.query.user) {
433
- query.user = req.query.user;
434
- }
435
- if (req.query.type) {
436
- query.type = req.query.type;
437
- }
438
- if (req.query.target) {
439
- query.target = req.query.target;
440
- }
441
- if (req.query.role) {
442
- query.role = req.query.role;
443
- }
444
431
  try {
445
- const memberships = await Membership.find(query, null, options).populate("user");
446
- if (!memberships) {
432
+ const memberships = await Membership.aggregate([
433
+ {
434
+ $match: {
435
+ ...req.query.user && { user: req.query.user },
436
+ ...req.query.type && { type: req.query.type },
437
+ ...req.query.target && { target: req.query.target },
438
+ ...req.query.role && { role: req.query.role }
439
+ }
440
+ },
441
+ {
442
+ $lookup: {
443
+ from: "users",
444
+ localField: "user",
445
+ foreignField: "_id",
446
+ as: "user"
447
+ }
448
+ },
449
+ {
450
+ $unwind: "$user"
451
+ }
452
+ ]);
453
+ if (!memberships || memberships.length === 0) {
447
454
  return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
448
455
  }
449
456
  res.send(memberships);
@@ -479,10 +486,9 @@ const controllerFactory$3 = (db) => {
479
486
  }
480
487
  };
481
488
  const deleteMembership = async (req, res) => {
482
- const { type, target, user: user2, role } = req.body;
483
489
  console.log(req.body);
484
490
  try {
485
- const membership = await Membership.findOne({ type, target, user: user2, role });
491
+ const membership = await Membership.findOneAndDelete({ _id: new ObjectId$1(req.body._id) });
486
492
  if (!membership) {
487
493
  return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
488
494
  } else {
@@ -591,23 +597,6 @@ var department_model = (mongoose) => {
591
597
  description: { type: String },
592
598
  categories: [String]
593
599
  },
594
- // Working hours
595
- address: String,
596
- // Position on map
597
- location: {
598
- lat: Number,
599
- lng: Number,
600
- type: {
601
- type: String,
602
- enum: ["Point"],
603
- // 'location.type' must be 'Point'
604
- required: true
605
- },
606
- coordinates: {
607
- type: [Number],
608
- required: true
609
- }
610
- },
611
600
  worktime: [{
612
601
  day: String,
613
602
  time: {
@@ -638,7 +627,6 @@ var department_model = (mongoose) => {
638
627
  ]
639
628
  });
640
629
  departmentSchema.index({ organization: 1 });
641
- departmentSchema.index({ location: "2dsphere" });
642
630
  const Department = mongoose.model("Department", departmentSchema);
643
631
  return Department;
644
632
  };
@@ -726,6 +714,10 @@ var membership_model = (mongoose) => {
726
714
  type: String,
727
715
  default: "subscriber"
728
716
  },
717
+ label: {
718
+ type: String,
719
+ default: "subscriber"
720
+ },
729
721
  target: {
730
722
  // заменяем 'organization' на 'target', так как это может быть или User, или Organization
731
723
  type: mongoose.Schema.Types.ObjectId,
@@ -5,7 +5,7 @@ require("uuid");
5
5
  const require$$0 = require("mongoose");
6
6
  require("path");
7
7
  const require$$3 = require("openai");
8
- const index = require("./index-a8dffc0c.js");
8
+ const index = require("./index-4eecfdb9.js");
9
9
  require("jsonwebtoken");
10
10
  require("mongodb");
11
11
  var product_model = (mongoose) => {
@@ -27,7 +27,22 @@ var product_model = (mongoose) => {
27
27
  images: { type: Array },
28
28
  popularity: { type: Number },
29
29
  localization: { type: Array },
30
- ingredients: { type: Array },
30
+ ingredients: [{
31
+ _id: {
32
+ type: mongoose.Schema.Types.ObjectId,
33
+ ref: "Product"
34
+ },
35
+ price: {
36
+ type: Number,
37
+ required: true,
38
+ min: [0, "Price cannot be less than 0"]
39
+ },
40
+ quantity: {
41
+ type: Number,
42
+ required: true,
43
+ min: [1, "Quantity cannot be less than 1"]
44
+ }
45
+ }],
31
46
  information: [{
32
47
  name: { type: String },
33
48
  value: { type: String }
@@ -212,7 +227,10 @@ var leftover_model = (mongoose) => {
212
227
  const leftover_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(leftover_model);
213
228
  const ObjectId$1 = require$$0.Types.ObjectId;
214
229
  const OpenAI = require$$3;
215
- const openai = new OpenAI();
230
+ console.log(process.env.OPENAI_API_KEY);
231
+ const openai = new OpenAI({
232
+ apiKey: process.env.OPENAI_API_KEY
233
+ });
216
234
  const controllerFactory$5 = (db) => {
217
235
  const Product = db.product;
218
236
  db.modification;
@@ -293,7 +311,7 @@ const controllerFactory$5 = (db) => {
293
311
  const Update = async (req, res) => {
294
312
  try {
295
313
  const { _id } = req.params;
296
- console.log(_id);
314
+ console.log(req.body.ingredients);
297
315
  const updatedProduct = await Product.findOneAndUpdate(
298
316
  { _id },
299
317
  {
@@ -307,7 +325,8 @@ const controllerFactory$5 = (db) => {
307
325
  information: req.body.information,
308
326
  localization: req.body.localization,
309
327
  quantity: req.body.quantity,
310
- quantityDiscount: req.body.quantityDiscount
328
+ quantityDiscount: req.body.quantityDiscount,
329
+ ingredients: req.body.ingredients
311
330
  },
312
331
  { new: true }
313
332
  );
@@ -338,19 +357,19 @@ const controllerFactory$5 = (db) => {
338
357
  "withIngredients": [
339
358
  {
340
359
  $match: {
341
- ingridients: { $exists: true, $not: { $size: 0 } }
360
+ ingredients: { $exists: true, $not: { $size: 0 } }
342
361
  // Продукты с ингредиентами
343
362
  }
344
363
  },
345
364
  {
346
365
  $lookup: {
347
366
  from: "products",
348
- localField: "ingridients",
367
+ localField: "ingredients",
349
368
  foreignField: "_id",
350
369
  as: "ingredientDetails"
351
370
  }
352
371
  },
353
- { $unwind: "$ingredientDetails" },
372
+ // { $unwind: "$ingredientDetails" },
354
373
  {
355
374
  $lookup: {
356
375
  from: "leftovers",
@@ -385,9 +404,9 @@ const controllerFactory$5 = (db) => {
385
404
  {
386
405
  $match: {
387
406
  $or: [
388
- { ingridients: { $exists: false } },
407
+ { ingredients: { $exists: false } },
389
408
  // Продукты без ингредиентов
390
- { ingridients: { $size: 0 } }
409
+ { ingredients: { $size: 0 } }
391
410
  ]
392
411
  }
393
412
  },
@@ -449,13 +468,13 @@ const controllerFactory$5 = (db) => {
449
468
  console.log("no products");
450
469
  return res.status(404).send({ message: "Products not found." });
451
470
  }
452
- const productsList = products.map((p) => `
453
- ${p._id}:
454
- ${p.name}
455
- (${p.information[0].value})
456
- (${p.information[1].value}%)
457
- (${p.information[2].value})
458
- `).join(", ");
471
+ const productsList = products.map((p) => {
472
+ const info = p.information || [];
473
+ const value0 = info[0] ? info[0].value : "";
474
+ const value1 = info[1] ? `(${info[1].value}%)` : "";
475
+ const value2 = info[2] ? `(${info[2].value})` : "";
476
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
477
+ }).join(", ");
459
478
  const prompt = `
460
479
  1. When asked how the client wants to feel, they responded "${mood}".
461
480
  2. Here is a list of products in our store: ${productsList}.
@@ -469,7 +488,7 @@ const controllerFactory$5 = (db) => {
469
488
  while (true) {
470
489
  try {
471
490
  response = await openai.chat.completions.create({
472
- model: "gpt-4",
491
+ model: "gpt-3.5-turbo",
473
492
  messages: [{ role: "user", content: prompt }]
474
493
  });
475
494
  console.log(response);
@@ -521,13 +540,21 @@ const controllerFactory$5 = (db) => {
521
540
  {
522
541
  $lookup: {
523
542
  from: "leftovers",
524
- let: { productId: "$_id", ingredients: { $ifNull: ["$ingredients", []] } },
543
+ let: { productId: "$_id", ingredientsIds: "$ingredients._id" },
525
544
  pipeline: [
526
545
  {
527
546
  $unwind: "$positions"
528
547
  },
529
548
  {
530
- "$match": { "$expr": { "$eq": ["$positions._id", "$$productId"] } }
549
+ $match: {
550
+ $expr: {
551
+ $or: [
552
+ { $eq: ["$positions._id", "$$productId"] },
553
+ { $in: ["$positions._id", { $ifNull: ["$$ingredientsIds", []] }] }
554
+ // Исправлено
555
+ ]
556
+ }
557
+ }
531
558
  },
532
559
  {
533
560
  "$addFields": {
@@ -548,18 +575,75 @@ const controllerFactory$5 = (db) => {
548
575
  }
549
576
  }
550
577
  ],
551
- as: "variants"
578
+ as: "leftovers"
579
+ }
580
+ },
581
+ {
582
+ $addFields: {
583
+ ingredientsQuantities: {
584
+ $cond: {
585
+ if: { $isArray: "$ingredients" },
586
+ then: {
587
+ $map: {
588
+ input: "$ingredients",
589
+ as: "ingredient",
590
+ in: {
591
+ $let: {
592
+ vars: {
593
+ ingredientId: "$$ingredient._id",
594
+ ingredientQuantity: { $ifNull: ["$$ingredient.quantity", 0] }
595
+ },
596
+ in: {
597
+ $divide: [
598
+ {
599
+ $sum: {
600
+ $map: {
601
+ input: "$leftovers",
602
+ as: "leftover",
603
+ in: {
604
+ $cond: {
605
+ if: { $eq: ["$$leftover._id", "$$ingredientId"] },
606
+ then: "$$leftover.quantity",
607
+ else: 0
608
+ }
609
+ }
610
+ }
611
+ }
612
+ },
613
+ {
614
+ $cond: {
615
+ if: { $eq: ["$$ingredientQuantity", 0] },
616
+ then: 1,
617
+ else: "$$ingredientQuantity"
618
+ }
619
+ }
620
+ ]
621
+ }
622
+ }
623
+ }
624
+ }
625
+ },
626
+ else: []
627
+ }
628
+ }
552
629
  }
553
630
  },
554
631
  {
555
632
  $set: {
556
633
  quantity: {
557
- $sum: ["$quantity", { $sum: "$variants.quantity" }]
634
+ $cond: {
635
+ if: { $gt: [{ $size: { $ifNull: ["$ingredients", []] } }, 0] },
636
+ // Снова проверяем, не пустой ли массив ингредиентов
637
+ then: { $floor: { $min: "$ingredientsQuantities" } },
638
+ else: { $sum: "$leftovers.quantity" }
639
+ // Просто суммируем quantity из leftovers, если ингредиентов нет
640
+ }
558
641
  }
559
642
  }
560
643
  },
561
- { $unset: "variants" }
644
+ { $unset: ["leftovers", "ingredientsQuantities"] }
562
645
  ]);
646
+ console.log(product);
563
647
  if (!product || product.length < 1) {
564
648
  return res.status(404).send({ message: "Product not found." });
565
649
  }
@@ -568,7 +652,6 @@ const controllerFactory$5 = (db) => {
568
652
  { $inc: { popularity: 1 } },
569
653
  { new: true }
570
654
  );
571
- console.log("Popularity updated:", updatedProduct);
572
655
  res.status(200).send(product);
573
656
  } catch (err) {
574
657
  console.error("Error:", err);