@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
@@ -5,7 +5,10 @@ const path = require('path');
5
5
 
6
6
  const OpenAI = require("openai");
7
7
 
8
- const openai = new OpenAI();
8
+ console.log(process.env.OPENAI_API_KEY)
9
+ const openai = new OpenAI({
10
+ apiKey: process.env.OPENAI_API_KEY
11
+ });
9
12
 
10
13
  // Factory
11
14
  const controllerFactory = (db) => {
@@ -119,7 +122,7 @@ const controllerFactory = (db) => {
119
122
  const Update = async (req, res) => {
120
123
  try {
121
124
  const { _id } = req.params;
122
- console.log(_id);
125
+ console.log(req.body.ingredients);
123
126
 
124
127
  const updatedProduct = await Product.findOneAndUpdate(
125
128
  { _id },
@@ -134,7 +137,8 @@ const controllerFactory = (db) => {
134
137
  information: req.body.information,
135
138
  localization: req.body.localization,
136
139
  quantity: req.body.quantity,
137
- quantityDiscount: req.body.quantityDiscount
140
+ quantityDiscount: req.body.quantityDiscount,
141
+ ingredients: req.body.ingredients
138
142
  },
139
143
  { new: true }
140
144
  );
@@ -213,18 +217,18 @@ const controllerFactory = (db) => {
213
217
  "withIngredients": [
214
218
  {
215
219
  $match: {
216
- ingridients: { $exists: true, $not: {$size: 0} } // Продукты с ингредиентами
220
+ ingredients: { $exists: true, $not: {$size: 0} } // Продукты с ингредиентами
217
221
  }
218
222
  },
219
223
  {
220
224
  $lookup: {
221
225
  from: "products",
222
- localField: "ingridients",
226
+ localField: "ingredients",
223
227
  foreignField: "_id",
224
228
  as: "ingredientDetails"
225
229
  }
226
230
  },
227
- { $unwind: "$ingredientDetails" },
231
+ // { $unwind: "$ingredientDetails" },
228
232
  {
229
233
  $lookup: {
230
234
  from: "leftovers",
@@ -259,8 +263,8 @@ const controllerFactory = (db) => {
259
263
  {
260
264
  $match: {
261
265
  $or: [
262
- { ingridients: { $exists: false } }, // Продукты без ингредиентов
263
- { ingridients: { $size: 0 } }
266
+ { ingredients: { $exists: false } }, // Продукты без ингредиентов
267
+ { ingredients: { $size: 0 } }
264
268
  ]
265
269
  }
266
270
  },
@@ -326,13 +330,13 @@ const controllerFactory = (db) => {
326
330
  return res.status(404).send({ message: "Products not found." });
327
331
  }
328
332
 
329
- const productsList = products.map(p => `
330
- ${p._id}:
331
- ${p.name}
332
- (${p.information[0].value})
333
- (${p.information[1].value}%)
334
- (${p.information[2].value})
335
- `).join(', ');
333
+ const productsList = products.map(p => {
334
+ const info = p.information || [];
335
+ const value0 = info[0] ? info[0].value : '';
336
+ const value1 = info[1] ? `(${info[1].value}%)` : '';
337
+ const value2 = info[2] ? `(${info[2].value})` : '';
338
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
339
+ }).join(', ');
336
340
 
337
341
  const prompt = `
338
342
  1. When asked how the client wants to feel, they responded "${mood}".
@@ -351,7 +355,7 @@ const controllerFactory = (db) => {
351
355
  while (true) {
352
356
  try {
353
357
  response = await openai.chat.completions.create({
354
- model: "gpt-4",
358
+ model: "gpt-3.5-turbo",
355
359
  messages: [{role: "user", content: prompt}],
356
360
  });
357
361
 
@@ -403,22 +407,29 @@ const controllerFactory = (db) => {
403
407
  // Get product
404
408
  const getProduct = async (req, res) => {
405
409
  try {
406
- const product = await Product.aggregate([
407
- {
408
- $match: { "_id": new ObjectId(req.params._id) }
410
+ const product = await Product.aggregate([
411
+ {
412
+ $match: { "_id": new ObjectId(req.params._id) }
409
413
  },
410
414
  {
411
415
  $lookup: {
412
416
  from: "leftovers",
413
- let: { productId: "$_id", ingredients: { $ifNull: ["$ingredients", []] } },
417
+ let: { productId: "$_id", ingredientsIds: "$ingredients._id" },
414
418
  pipeline: [
415
419
  {
416
420
  $unwind: "$positions"
417
421
  },
418
- {
419
- "$match": { "$expr": { "$eq": ["$positions._id", "$$productId"] }}
422
+ {
423
+ $match: {
424
+ $expr: {
425
+ $or: [
426
+ { $eq: ["$positions._id", "$$productId"] },
427
+ { $in: ["$positions._id", { $ifNull: ["$$ingredientsIds", []] }] } // Исправлено
428
+ ]
429
+ }
430
+ }
420
431
  },
421
- {
432
+ {
422
433
  "$addFields": {
423
434
  "positions.quantity": {
424
435
  $cond: {
@@ -429,7 +440,7 @@ const controllerFactory = (db) => {
429
440
  }
430
441
  }
431
442
  },
432
- {
443
+ {
433
444
  "$project": {
434
445
  _id: "$positions._id",
435
446
  quantity: "$positions.quantity",
@@ -437,19 +448,74 @@ const controllerFactory = (db) => {
437
448
  }
438
449
  }
439
450
  ],
440
- as: "variants"
451
+ as: "leftovers"
452
+ }
453
+ },
454
+ {
455
+ $addFields: {
456
+ ingredientsQuantities: {
457
+ $cond: {
458
+ if: { $isArray: "$ingredients" },
459
+ then: {
460
+ $map: {
461
+ input: "$ingredients",
462
+ as: "ingredient",
463
+ in: {
464
+ $let: {
465
+ vars: {
466
+ ingredientId: "$$ingredient._id",
467
+ ingredientQuantity: { $ifNull: ["$$ingredient.quantity", 0] }
468
+ },
469
+ in: {
470
+ $divide: [
471
+ {
472
+ $sum: {
473
+ $map: {
474
+ input: "$leftovers",
475
+ as: "leftover",
476
+ in: {
477
+ $cond: {
478
+ if: { $eq: ["$$leftover._id", "$$ingredientId"] },
479
+ then: "$$leftover.quantity",
480
+ else: 0
481
+ }
482
+ }
483
+ }
484
+ }
485
+ },
486
+ {
487
+ $cond: {
488
+ if: { $eq: ["$$ingredientQuantity", 0] },
489
+ then: 1,
490
+ else: "$$ingredientQuantity"
491
+ }
492
+ }
493
+ ]
494
+ }
495
+ }
496
+ }
497
+ }
498
+ },
499
+ else: []
500
+ }
501
+ }
441
502
  }
442
503
  },
443
- {
444
- $set: {
504
+ {
505
+ $set: {
445
506
  quantity: {
446
- $sum: ["$quantity", {$sum: "$variants.quantity"}]
447
- }
448
- }
507
+ $cond: {
508
+ if: { $gt: [{ $size: { $ifNull: ["$ingredients", []] } }, 0] }, // Снова проверяем, не пустой ли массив ингредиентов
509
+ then: { $floor: { $min: "$ingredientsQuantities" } },
510
+ else: { $sum: "$leftovers.quantity" } // Просто суммируем quantity из leftovers, если ингредиентов нет
511
+ }
512
+ }
513
+ }
449
514
  },
515
+ { $unset: ["leftovers", "ingredientsQuantities"] }
516
+ ]);
450
517
 
451
- { $unset: "variants" }
452
- ]);
518
+ console.log(product)
453
519
 
454
520
  if (!product || product.length < 1) {
455
521
  return res.status(404).send({ message: "Product not found." });
@@ -461,7 +527,7 @@ const controllerFactory = (db) => {
461
527
  { new: true }
462
528
  );
463
529
 
464
- console.log('Popularity updated:', updatedProduct);
530
+ // console.log('Popularity updated:', updatedProduct);
465
531
 
466
532
  res.status(200).send(product);
467
533
  } catch (err) {
@@ -18,7 +18,22 @@ module.exports = (mongoose) => {
18
18
  images: {type: Array},
19
19
  popularity: {type: Number},
20
20
  localization: {type: Array},
21
- ingredients: {type: Array},
21
+ ingredients: [{
22
+ _id: {
23
+ type: mongoose.Schema.Types.ObjectId,
24
+ ref: 'Product',
25
+ },
26
+ price: {
27
+ type: Number,
28
+ required: true,
29
+ min: [0, 'Price cannot be less than 0']
30
+ },
31
+ quantity: {
32
+ type: Number,
33
+ required: true,
34
+ min: [1, 'Quantity cannot be less than 1']
35
+ },
36
+ }],
22
37
  information: [{
23
38
  name: {type: String},
24
39
  value: {type: String}
@@ -26,7 +26,7 @@ const state = reactive({
26
26
  localization: [],
27
27
  modifications: [],
28
28
  quantityDiscount: [],
29
- ingridients: [],
29
+ ingredients: [],
30
30
  description: ''
31
31
  }
32
32
  });
@@ -22,20 +22,49 @@
22
22
  />
23
23
 
24
24
  <transition name="slide-fade">
25
- <Feed
25
+ <Feed
26
26
  v-if="tabOrganization === 'member'"
27
- :user="auth.state.user._id"
28
- :owner="route.params._id"
29
- />
27
+ :states="{
28
+ empty: {
29
+ title: 'No Organization Found',
30
+ description: 'Currently, there are no organization available.'
31
+ }
32
+ }"
33
+ :store="{
34
+ read: (options) => organizations.actions.read(options),
35
+ state: organizations.state
36
+ }"
37
+ :options="{
38
+ user: auth.state.user._id,
39
+ member: auth.state.user._id,
40
+ limit: 10
41
+ }"
42
+ v-slot="{
43
+ items
44
+ }"
45
+ >
46
+ <CardOrganization
47
+ v-for="organization in items"
48
+ :key="organization._id"
49
+ :organization="organization"
50
+ :user="auth.state.user"
51
+ :showProducts="false"
52
+ :showRating="false"
53
+ :showFeatured="false"
54
+ :showFollowers="false"
55
+ @updateMembership="handleMembershipUpdate"
56
+ class="mn-b-thin w-100 pd-0 bg-white radius-big o-hidden"
57
+ />
58
+ </Feed>
30
59
  </transition>
31
60
 
32
- <transition name="slide-fade">
61
+ <!-- <transition name="slide-fade">
33
62
  <Feed
34
63
  v-if="tabOrganization === 'follower'"
35
64
  :user="auth.state.user._id"
36
65
  :subscriber="route.params._id"
37
66
  />
38
- </transition>
67
+ </transition> -->
39
68
  </div>
40
69
  </template>
41
70
 
@@ -44,9 +73,14 @@
44
73
  import { useRoute, useRouter } from 'vue-router'
45
74
  // Components
46
75
  import Tab from '@pf/src/components/Tab/Tab.vue'
47
- import Feed from '@pf/src/modules/organizations/components/sections/Feed.vue';
76
+ import Feed from '@pf/src/components/Feed/Feed.vue'
77
+
78
+ import CardOrganization from '@pf/src/modules/organizations/components/blocks/CardOrganization.vue'
79
+
80
+ // import Feed from '@pf/src/modules/organizations/components/sections/Feed.vue';
48
81
 
49
82
  import * as auth from '@pf/src/modules/auth/store/auth';
83
+ import * as organizations from '@pf/src/modules/organizations/store/organizations'
50
84
  // Accessing router
51
85
  const route = useRoute()
52
86
  const router = useRouter()
@@ -25,7 +25,7 @@ body {
25
25
  overflow-x: hidden;
26
26
  }
27
27
 
28
- #app {
28
+ #app-wrapper {
29
29
  display: grid;
30
30
  position: relative;
31
31
  height: 100vh;
@@ -1,64 +0,0 @@
1
- <template>
2
- <transition name="slide-fade">
3
- <div>
4
- <EmptyState
5
- v-if="FirstLevelDepartments.length < 1"
6
- title="You don't have any spots yet."
7
- description="Add spots to your hub."
8
- action="Add spot"
9
- :callback="() => $router.push(`/organizations/${props.organization._id}/departments/create`)"
10
- />
11
-
12
- <div>
13
- <CardDepartment
14
- v-for="(department, index) in FirstLevelDepartments"
15
- :key="index"
16
- :department="department"
17
- :organization="organization"
18
- class="radius-big bg-grey mn-b-thin"
19
- />
20
- <button
21
- v-if="FirstLevelDepartments.length > 0 && auth.state.user._id === organization.owner"
22
- @click="$router.push(`/organizations/${props.organization._id}/departments/create`)"
23
- class="mn-b-thin button w-100"
24
- >
25
- Add spot
26
- </button>
27
- </div>
28
- </div>
29
- </transition>
30
- </template>
31
-
32
- <script setup>
33
- import { ref, computed } from 'vue';
34
- import Tab from '@pf/src/components/Tab/Tab.vue';
35
- import EmptyState from '@pf/src/modules/organizations/components/blocks/EmptyState.vue';
36
- import CardDepartment from '@pf/src/modules/organizations/components/blocks/CardDepartment.vue';
37
- import { state as departmentState, actions as departmentActions } from '@pf/src/modules/organizations/store/departments';
38
- import * as auth from '@pf/src/modules/auth/store/auth'
39
-
40
- const props = defineProps({
41
- organization: Object,
42
- units: Array,
43
- memberships: Array
44
- });
45
-
46
- const tabStructure = ref('departments');
47
-
48
- await departmentActions.read(props.organization._id);
49
-
50
- const FirstLevelDepartments = computed(() => {
51
- const departments = departmentState.departments;
52
-
53
- const subdepartmentIds = departments.flatMap(department =>
54
- department.subdepartments.map(subdepartment => subdepartment._id)
55
- );
56
-
57
- return departments.filter(department =>
58
- !subdepartmentIds.includes(department._id)
59
- );
60
- });
61
- </script>
62
-
63
- <style scoped>
64
- </style>
@@ -1,85 +0,0 @@
1
- <template>
2
- <section class="mn-b-big radius-medium bg-white">
3
- <Tab
4
- v-model:selected="tabMemberships"
5
- class="br-grey br-b br-solid radius-small"
6
- :tabs="[
7
- { name: 'Участники', value: 'members' },
8
- { name: 'Приглашения', value: 'invites' },
9
- ]"
10
- />
11
- <!-- Members -->
12
- <div
13
- v-if="tabMemberships === 'members'"
14
- class="pd-semi"
15
- >
16
- <div
17
- v-for="(member, index) in memberships"
18
- class="br-grey br-1px br-solid radius-small flex-nowrap flex-v-center flex pd-medium"
19
- >
20
- <span class="w-100 mn-r-small">{{member.user.email}} {{member.user.phone}}</span>
21
- <span class="t-transp">{{member.position}}</span>
22
-
23
- <div v-if="member.position !== 'Основатель'" class="mn-l-medium flex-v-center flex">
24
- <button @click="removeMember(index,member)" class="button-small button">×</button>
25
- </div>
26
-
27
- </div>
28
- </div>
29
- <!-- Invites -->
30
- <div
31
- v-if="tabMemberships === 'invites'"
32
- class="pd-semi"
33
- >
34
- <span v-if="invites.length < 1">В организации нет приглашений</span>
35
- <div
36
- v-for="(invite, index) in invites"
37
- class="br-grey br-1px br-solid radius-small mn-b-thin flex-nowrap flex-v-center flex pd-medium"
38
- >
39
-
40
- <span class="w-100 mn-r-small">{{invite.invitedEmail}} {{invite.invitedPhone}}</span>
41
- <span class="t-transp">{{invite.status}}</span>
42
-
43
- <div class="mn-l-medium flex-v-center flex">
44
- <button @click="removeInvite(index,invite)" class="button-small button">×</button>
45
- </div>
46
-
47
- </div>
48
- </div>
49
-
50
-
51
- </section>
52
- </template>
53
-
54
- <script setup>
55
- import { ref } from "vue";
56
- // Import components
57
- // Global
58
- import Tab from '@pf/src/components/Tab/Tab.vue'
59
- // Define props
60
- const props = defineProps({
61
- organization: Object,
62
- memberships: Array,
63
- invites: Array,
64
- });
65
-
66
- const emits = defineEmits([['removeMember','removeInvite']])
67
- // Define emits
68
-
69
- // Accesing state
70
- const tabMemberships = ref('members')
71
-
72
- function removeMember(index,member) {
73
- props.memberships.splice(index, 1);
74
- emits('removeMember', member)
75
- }
76
-
77
- function removeInvite(index,invite) {
78
- props.invites.splice(index, 1);
79
- emits('removeInvite', invite)
80
- }
81
-
82
-
83
-
84
-
85
- </script>
@@ -1,93 +0,0 @@
1
- // Dependencies
2
- import axios from 'axios';
3
- import Cookies from 'js-cookie'
4
- // Vue modules
5
- import { reactive, watch } from "vue";
6
- // Globals
7
- import { setError } from '@pf/src/modules/globals/store/globals'
8
- // State
9
- import * as auth from '@pf/src/modules/auth/store/auth'
10
- // Setup Axios
11
- const $axios = axios.create({baseURL: process.env.API_URL, withCredentials: true})
12
- // Setup Cookies
13
- $axios.defaults.withCredentials = true
14
- // State
15
- const state = reactive({
16
- invites: [],
17
- invite: null,
18
- error: null,
19
- });
20
- // Methods
21
- const actions = {
22
- async read(organizationId) {
23
- await $axios
24
- .get(`/api/invites/${organizationId}`)
25
- .then(response => {
26
- state.invites = response.data;
27
- state.error = null;
28
- })
29
- .catch(error => {
30
- setError(error)
31
- });
32
- },
33
- async readOne(inviteId) {
34
-
35
- await $axios
36
- .get(`/api/invites/get/${inviteId}`) // Измените URL, чтобы использовать inviteId
37
- .then(response => {
38
- state.invite = response.data; // Используйте отдельное свойство для хранения одного инвайта
39
-
40
- auth.state.user.phone = response.data.invitedPhone
41
- auth.state.user.email = response.data.invitedEmail
42
-
43
- })
44
- .catch(error => {
45
- setError(error);
46
- });
47
- },
48
- async create(organizationId, invite) {
49
- await $axios
50
- .post(`/api/invites/${organizationId}/create`, invite)
51
- .then(() => {
52
- state.error = null;
53
- })
54
- .catch(error => {
55
- setError(error)
56
- });
57
- },
58
- async update(organizationId, membership) {
59
- await $axios
60
- .put(`/api/invites/${organizationId}/update`, membership)
61
- .then(() => {
62
- state.error = null;
63
- })
64
- .catch(error => {
65
- setError(error)
66
- });
67
- },
68
- async delete(inviteID) {
69
- await $axios
70
- .delete(`/api/invites/${inviteID}/delete`)
71
- .then(() => {
72
- state.error = null;
73
- })
74
- .catch(error => {
75
- setError(error)
76
- });
77
- },
78
- };
79
-
80
- // // History
81
- const history = []
82
- history.push(state)
83
-
84
- // // Watch
85
- watch(state, (newState, oldState) => {
86
- history.push(newState)
87
- })
88
-
89
- // Module Export
90
- export {
91
- state,
92
- actions,
93
- }