@ozdao/prometheus-framework 0.2.81 → 0.2.82

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. package/dist/auth.server.js +1 -1
  2. package/dist/auth.server.mjs +1 -1
  3. package/dist/community.server.js +3 -3
  4. package/dist/community.server.mjs +3 -3
  5. package/dist/credentials.schema-CDZCKfEI.mjs +106 -0
  6. package/dist/credentials.schema-CfhPcsuI.js +105 -0
  7. package/dist/events.server.js +4 -15
  8. package/dist/events.server.mjs +3 -14
  9. package/dist/files.server.js +1 -1
  10. package/dist/files.server.mjs +1 -1
  11. package/dist/gallery.server.js +1 -1
  12. package/dist/gallery.server.mjs +1 -1
  13. package/dist/index-B6a1mPgp.mjs +217 -0
  14. package/dist/index-BCCiEK_u.js +216 -0
  15. package/dist/main-8N2Jmsuk.js +91 -0
  16. package/dist/main-CkeuHuCY.mjs +13619 -0
  17. package/dist/main.css +1 -1
  18. package/dist/metadata.schema-Cu_mPkjE.js +77 -0
  19. package/dist/metadata.schema-cbFgazeK.mjs +78 -0
  20. package/dist/middlewares.server.js +1 -1
  21. package/dist/middlewares.server.mjs +1 -1
  22. package/dist/node_modules/@googlemaps/js-api-loader/dist/index.cjs +1 -0
  23. package/dist/node_modules/@googlemaps/js-api-loader/dist/index.js +238 -0
  24. package/dist/organizations.server.js +297 -134
  25. package/dist/organizations.server.mjs +295 -132
  26. package/dist/products.server.js +2 -2
  27. package/dist/products.server.mjs +2 -2
  28. package/dist/prometheus-framework/src/components/Address/Address.vue2.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/Address/Address.vue2.js +33 -24
  30. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/components/Block/Block.vue.js +23 -20
  32. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/components/Button/Button.vue.js +1 -225
  34. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  35. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +102 -1
  36. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  37. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +71 -60
  38. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/components/Field/Field.vue.js +1 -84
  40. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  41. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +84 -1
  42. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  43. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  44. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.js +325 -340
  46. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +2 -2
  48. package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
  49. package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +53 -44
  50. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  51. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +41 -40
  52. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  53. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +37 -31
  54. package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +18 -19
  56. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +1 -36
  58. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  59. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +36 -1
  60. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +45 -1
  62. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.cjs +1 -1
  63. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.js +1 -45
  64. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  66. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  68. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  70. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +30 -30
  72. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  74. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  76. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  78. package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/auth/store/auth.js +26 -26
  80. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +78 -103
  82. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
  84. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
  86. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +15 -15
  88. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  90. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +4 -4
  92. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  96. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
  98. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
  100. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +29 -27
  102. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  104. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
  106. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  108. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
  110. package/dist/prometheus-framework/src/modules/globals/components/sections/SectionPageTitle.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/globals/components/sections/SectionPageTitle.vue.js +33 -26
  112. package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.js +6 -3
  114. package/dist/prometheus-framework/src/modules/globals/services/globals.store.cjs +1 -0
  115. package/dist/prometheus-framework/src/modules/globals/services/globals.store.js +70 -0
  116. package/dist/prometheus-framework/src/modules/icons/entities/IconGallery.vue.cjs +1 -0
  117. package/dist/prometheus-framework/src/modules/icons/entities/IconGallery.vue.js +28 -0
  118. package/dist/prometheus-framework/src/modules/icons/entities/IconLeftovers.vue.cjs +1 -0
  119. package/dist/prometheus-framework/src/modules/icons/entities/IconLeftovers.vue.js +30 -0
  120. package/dist/prometheus-framework/src/modules/icons/entities/IconOrders.vue.cjs +1 -0
  121. package/dist/prometheus-framework/src/modules/icons/entities/IconOrders.vue.js +35 -0
  122. package/dist/prometheus-framework/src/modules/icons/entities/IconProducts.vue.cjs +1 -0
  123. package/dist/prometheus-framework/src/modules/icons/entities/IconProducts.vue.js +28 -0
  124. package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.js +63 -86
  126. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  128. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +174 -114
  130. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +40 -40
  132. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -0
  133. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +141 -0
  134. package/dist/prometheus-framework/src/modules/orders/components/sections/FormClientDetails.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/orders/components/sections/FormClientDetails.vue.js +1 -1
  136. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -0
  137. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +77 -0
  138. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +46 -35
  140. package/dist/prometheus-framework/src/modules/orders/store/customers.store.cjs +1 -0
  141. package/dist/prometheus-framework/src/modules/orders/store/customers.store.js +5 -0
  142. package/dist/prometheus-framework/src/modules/orders/store/models/customer.cjs +1 -0
  143. package/dist/prometheus-framework/src/modules/orders/store/models/customer.js +30 -0
  144. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/orders/store/orders.js +24 -25
  146. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +16 -16
  148. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  150. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +38 -49
  152. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  154. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  155. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +6 -6
  156. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  157. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +161 -138
  158. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  159. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +198 -78
  160. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  161. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +82 -125
  162. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  163. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  164. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  165. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  166. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  167. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
  168. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  169. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +59 -70
  170. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  171. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  172. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  173. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +34 -36
  174. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  175. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +38 -18
  176. package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
  177. package/dist/prometheus-framework/src/modules/organizations/store/invites.js +34 -35
  178. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  179. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  180. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +1 -1
  181. package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +41 -21
  182. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  183. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  184. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  185. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  186. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  187. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  188. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  189. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
  190. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  191. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
  192. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  193. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  194. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  195. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
  196. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  197. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +3 -3
  198. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  199. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  200. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  201. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  202. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  203. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  204. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  205. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +24 -26
  206. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -0
  207. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +78 -0
  208. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  209. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  210. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  211. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  212. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  213. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  214. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  215. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  216. package/dist/prometheus-framework/src/modules/users/store/users.cjs +1 -1
  217. package/dist/prometheus-framework/src/modules/users/store/users.js +13 -14
  218. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  219. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
  220. package/dist/prometheus-framework.cjs.js +1 -1
  221. package/dist/prometheus-framework.es.js +1 -1
  222. package/dist/queryProcessor-BJdKh0Ow.mjs +162 -0
  223. package/dist/queryProcessor-DRMo_GWK.js +161 -0
  224. package/dist/reports.server.js +1 -1
  225. package/dist/reports.server.mjs +1 -1
  226. package/dist/style.css +1 -1
  227. package/dist/users.server.js +69 -38
  228. package/dist/users.server.mjs +67 -36
  229. package/dist/wallet.server.js +2 -2
  230. package/dist/wallet.server.mjs +2 -2
  231. package/dist/web-CtVocufd.js +1 -0
  232. package/dist/web-DNq1tHCE.mjs +54 -0
  233. package/package.json +1 -1
  234. package/src/components/Address/Address.vue +13 -2
  235. package/src/components/Block/Block.vue +3 -2
  236. package/src/components/Button/Button.vue +9 -12
  237. package/src/components/Feed/Feed.vue +28 -6
  238. package/src/components/FieldPhone/FieldPhone.vue +592 -558
  239. package/src/components/LocationMarker/LocationMarker.vue +26 -22
  240. package/src/components/Popup/Popup.vue +22 -23
  241. package/src/components/Select/Select.vue +43 -32
  242. package/src/components/Slider/Slider.vue +3 -4
  243. package/src/modules/auth/components/pages/Invite.vue +7 -7
  244. package/src/modules/auth/store/auth.js +1 -1
  245. package/src/modules/backoffice/components/pages/Dashboard.vue +44 -29
  246. package/src/modules/community/components/sections/HotPosts.vue +1 -1
  247. package/src/modules/events/components/blocks/CardEvent.vue +4 -3
  248. package/src/modules/events/components/pages/Events.vue +23 -6
  249. package/src/modules/globals/components/sections/SectionPageTitle.vue +19 -7
  250. package/src/modules/globals/controllers/utils/queryProcessor.js +21 -7
  251. package/src/modules/globals/localization/vue-i18n.js +3 -0
  252. package/src/modules/globals/models/credentials.schema.js +7 -0
  253. package/src/modules/globals/models/metadata.schema.js +17 -0
  254. package/src/modules/globals/models/profile.schema.js +23 -0
  255. package/src/modules/globals/models/socials.schema.js +22 -0
  256. package/src/modules/globals/router/routerGuards.js +1 -0
  257. package/src/modules/globals/services/globals.cashe.js +26 -0
  258. package/src/modules/globals/services/globals.crud.js +115 -0
  259. package/src/modules/globals/services/globals.logger.js +41 -0
  260. package/src/modules/globals/services/globals.store.js +114 -0
  261. package/src/modules/icons/entities/IconGallery.vue +14 -0
  262. package/src/modules/icons/entities/IconLeftovers.vue +14 -0
  263. package/src/modules/icons/entities/IconOrders.vue +15 -0
  264. package/src/modules/icons/entities/IconProducts.vue +14 -0
  265. package/src/modules/landing/components/sections/HeroSection.vue +1 -1
  266. package/src/modules/landing/components/sections/MobileApp.vue +4 -4
  267. package/src/modules/landing/router/landing.js +1 -1
  268. package/src/modules/marketplace/components/sections/Filters.vue +3 -3
  269. package/src/modules/middlewares/server/accessors/AccessController.js +33 -0
  270. package/src/modules/middlewares/server/accessors/ReadDepartments.js +101 -0
  271. package/src/modules/middlewares/server/verifyAccesses.js +33 -0
  272. package/src/modules/middlewares/server/verifyInvites.js +4 -4
  273. package/src/modules/orders/components/pages/OrderCreate.vue +2 -2
  274. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +105 -68
  275. package/src/modules/orders/components/pages/Orders.vue +2 -2
  276. package/src/modules/orders/components/sections/FormAddCustomer.vue +152 -0
  277. package/src/modules/orders/components/sections/FormCustomerDetails.vue +67 -0
  278. package/src/modules/orders/components/sections/FormDelivery.vue +17 -3
  279. package/src/modules/orders/controllers/applications.controller.js +2 -0
  280. package/src/modules/orders/controllers/orders.controller.js +77 -52
  281. package/src/modules/orders/models/customer.model.js +54 -18
  282. package/src/modules/orders/models/order.model.js +1 -1
  283. package/src/modules/orders/orders.client.js +51 -51
  284. package/src/modules/orders/orders.server.js +32 -12
  285. package/src/modules/orders/router/orders.router.js +36 -41
  286. package/src/modules/orders/routes/orders.routes.js +3 -21
  287. package/src/modules/orders/store/customers.store.js +5 -0
  288. package/src/modules/orders/store/models/customer.js +29 -0
  289. package/src/modules/orders/store/orders.js +14 -20
  290. package/src/modules/organizations/components/blocks/CardDepartment.vue +3 -3
  291. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
  292. package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +1 -12
  293. package/src/modules/organizations/components/pages/Department.vue +1 -1
  294. package/src/modules/organizations/components/pages/DepartmentEdit.vue +72 -48
  295. package/src/modules/organizations/components/pages/Members.vue +178 -64
  296. package/src/modules/organizations/components/pages/Organization.vue +1 -41
  297. package/src/modules/organizations/components/sections/MembersAdd.vue +44 -52
  298. package/src/modules/organizations/controllers/departments.controller.js +2 -4
  299. package/src/modules/organizations/controllers/invites.controller.js +24 -23
  300. package/src/modules/organizations/controllers/organizations.controller.js +1 -1
  301. package/src/modules/organizations/models/department.model.js +52 -2
  302. package/src/modules/organizations/models/invite.model.js +29 -32
  303. package/src/modules/organizations/models/membership.model.js +2 -0
  304. package/src/modules/organizations/models/organization.model.js +2 -1
  305. package/src/modules/organizations/organizations.client.js +0 -2
  306. package/src/modules/organizations/routes/departments.routes.js +18 -7
  307. package/src/modules/organizations/routes/invites.routes.js +2 -2
  308. package/src/modules/organizations/store/departments.js +22 -1
  309. package/src/modules/organizations/store/invites.js +74 -90
  310. package/src/modules/products/components/blocks/CardProduct.vue +24 -0
  311. package/src/modules/products/components/pages/Products.vue +1 -1
  312. package/src/modules/reports/components/sections/FormReport.vue +40 -40
  313. package/src/modules/spots/components/pages/Spot.vue +1 -1
  314. package/src/modules/spots/components/pages/SpotEdit.vue +1 -1
  315. package/src/modules/users/components/blocks/CardUser.vue +85 -0
  316. package/src/modules/users/controllers/users.controller.js +36 -13
  317. package/src/modules/users/middlewares/visitor.logger.js +66 -0
  318. package/src/modules/users/models/request.model.js +18 -0
  319. package/src/modules/users/models/user.model.js +26 -55
  320. package/src/modules/users/models/visitor.model.js +14 -0
  321. package/src/modules/users/store/users.js +2 -11
  322. package/src/modules/wallet/controllers/routes/payments.routes.js +2 -0
  323. package/src/components/FieldPhone/FieldPhone(script-setup).vue +0 -1646
  324. package/src/components/FieldPhone/FieldPhone2.vue +0 -671
  325. package/src/modules/orders/components/sections/FormClientDetails.vue +0 -61
  326. package/src/modules/organizations/components/blocks/User.vue +0 -69
  327. /package/src/modules/backoffice/components/admin/{User.vue → UserEdit.vue} +0 -0
@@ -5,26 +5,26 @@ import "bcryptjs";
5
5
  import require$$3 from "uuidv4";
6
6
  import require$$0 from "mongoose";
7
7
  import require$$5 from "@googlemaps/google-maps-services-js";
8
- import { a as addUserStatusFields_1, b as addMembersQuantity_1 } from "./addMembersQuantity-BXp_LeQd.mjs";
8
+ import { a as addUserStatusFields_1, b as addMembersQuantity_1, c as credentials_schema } from "./credentials.schema-CDZCKfEI.mjs";
9
9
  import { m as mailing } from "./mailing-Cdp8NXhP.mjs";
10
- import { s as server } from "./index-CGIn4v5E.mjs";
10
+ import { s as server } from "./index-B6a1mPgp.mjs";
11
11
  import require$$0$2 from "mongodb";
12
+ import { o as ownership_schema } from "./ownership.schema-oyx6eNkZ.mjs";
12
13
  const controllerFactory$6 = (db) => {
13
14
  const Department = db.department;
14
- const readOne = (req, res) => {
15
+ const readOne = (req, res2) => {
15
16
  Department.findOne({ _id: req.params._id }).populate("members.user").populate("subdepartments").then((department) => {
16
17
  if (!department) {
17
- return res.status(404).send({ message: "Отдел не найден" });
18
+ return res2.status(404).send({ message: "Отдел не найден" });
18
19
  }
19
- res.send(department);
20
+ res2.send(department);
20
21
  }).catch((err) => {
21
- res.status(500).send({ message: err.message });
22
+ res2.status(500).send({ message: err.message });
22
23
  });
23
24
  };
24
- const read = (req, res) => {
25
+ const read = (req, res2) => {
25
26
  let query = {};
26
27
  let options = {};
27
- console.log(req.query);
28
28
  if (req.query.organization) {
29
29
  query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
30
30
  }
@@ -33,43 +33,43 @@ const controllerFactory$6 = (db) => {
33
33
  }
34
34
  Department.find(query, null, options).populate("members.user").populate("subdepartments").then((departments) => {
35
35
  if (!departments) {
36
- return res.status(404).send({ message: "Departments not found" });
36
+ return res2.status(404).send({ message: "Departments not found" });
37
37
  }
38
- res.send(departments);
38
+ res2.send(departments);
39
39
  }).catch((err) => {
40
- res.status(500).send({ message: err.message });
40
+ res2.status(500).send({ message: err.message });
41
41
  });
42
42
  };
43
- const create = async (req, res) => {
43
+ const create = async (req, res2) => {
44
44
  try {
45
45
  const newDepartment = new Department({
46
46
  ...req.body,
47
47
  organization: req.params._id
48
48
  });
49
49
  const data = await newDepartment.save();
50
- res.send(data);
50
+ res2.send(data);
51
51
  } catch (err) {
52
- res.status(500).send({ message: err.message });
52
+ res2.status(500).send({ message: err.message });
53
53
  }
54
54
  };
55
- const update = (req, res) => {
55
+ const update = (req, res2) => {
56
56
  Department.findOneAndUpdate({ _id: req.body._id }, req.body, { new: true }).then((department) => {
57
57
  if (!department) {
58
- return res.status(404).send({ message: "Department not found" });
58
+ return res2.status(404).send({ message: "Department not found" });
59
59
  }
60
- res.send(department);
60
+ res2.send(department);
61
61
  }).catch((err) => {
62
- res.status(500).send({ message: err.message });
62
+ res2.status(500).send({ message: err.message });
63
63
  });
64
64
  };
65
- const deleteDepartment = (req, res) => {
65
+ const deleteDepartment = (req, res2) => {
66
66
  Department.findOneAndRemove({ _id: req.body._id, organization: req.params._id }).then((department) => {
67
67
  if (!department) {
68
- return res.status(404).send({ message: "Department not found" });
68
+ return res2.status(404).send({ message: "Department not found" });
69
69
  }
70
- res.send({ message: "Department deleted successfully" });
70
+ res2.send({ message: "Department deleted successfully" });
71
71
  }).catch((err) => {
72
- res.status(500).send({ message: err.message });
72
+ res2.status(500).send({ message: err.message });
73
73
  });
74
74
  };
75
75
  return {
@@ -92,7 +92,7 @@ const controllerFactory$5 = (db) => {
92
92
  const Membership = db.membership;
93
93
  db.user;
94
94
  db.role;
95
- const read = async (req, res) => {
95
+ const read = async (req, res2) => {
96
96
  const Organization2 = db.organization;
97
97
  db.membership;
98
98
  db.user;
@@ -160,11 +160,11 @@ const controllerFactory$5 = (db) => {
160
160
  ];
161
161
  console.log(userLocation);
162
162
  } else {
163
- return res.status(400).send({ message: "Unable to geocode the provided location." });
163
+ return res2.status(400).send({ message: "Unable to geocode the provided location." });
164
164
  }
165
165
  } catch (err) {
166
166
  console.log(err);
167
- return res.status(500).send({ message: "Error occurred while geocoding." });
167
+ return res2.status(500).send({ message: "Error occurred while geocoding." });
168
168
  }
169
169
  const radius = city ? 500 : state ? 1e3 : 5e3;
170
170
  matchConditions.push({
@@ -350,13 +350,13 @@ const controllerFactory$5 = (db) => {
350
350
  console.log(stages);
351
351
  const organizations = await Organization2.aggregate(stages);
352
352
  console.log(organizations);
353
- res.status(200).send(organizations);
353
+ res2.status(200).send(organizations);
354
354
  } catch (err) {
355
355
  console.log(err);
356
- return res.status(500).send({ message: err });
356
+ return res2.status(500).send({ message: err });
357
357
  }
358
358
  };
359
- const fetch = async (req, res) => {
359
+ const fetch = async (req, res2) => {
360
360
  const Organization2 = db.organization;
361
361
  let query = {};
362
362
  console.log(req.query);
@@ -375,14 +375,14 @@ const controllerFactory$5 = (db) => {
375
375
  try {
376
376
  const organizations = await Organization2.find(query, null, options);
377
377
  if (!organizations || organizations.length === 0) {
378
- return res.status(404).send({ message: "Organizations not found." });
378
+ return res2.status(404).send({ message: "Organizations not found." });
379
379
  }
380
- res.status(200).send(organizations);
380
+ res2.status(200).send(organizations);
381
381
  } catch (err) {
382
- return res.status(500).send({ message: err });
382
+ return res2.status(500).send({ message: err });
383
383
  }
384
384
  };
385
- const create = async (req, res) => {
385
+ const create = async (req, res2) => {
386
386
  if (req.body._id === null) {
387
387
  delete req.body._id;
388
388
  }
@@ -396,13 +396,13 @@ const controllerFactory$5 = (db) => {
396
396
  role: "owner"
397
397
  });
398
398
  const savedMembership = await membership.save();
399
- res.status(201).json(savedOrganization);
399
+ res2.status(201).json(savedOrganization);
400
400
  } catch (error) {
401
401
  console.error("Error:", error);
402
- res.status(500).send(error);
402
+ res2.status(500).send(error);
403
403
  }
404
404
  };
405
- const update = async (req, res) => {
405
+ const update = async (req, res2) => {
406
406
  try {
407
407
  const organizationId = req.params._id;
408
408
  const updatedData = req.body;
@@ -411,17 +411,17 @@ const controllerFactory$5 = (db) => {
411
411
  runValidators: true
412
412
  });
413
413
  if (!organization) {
414
- return res.status(404).json({ message: "Organization not found" });
414
+ return res2.status(404).json({ message: "Organization not found" });
415
415
  }
416
- res.status(200).json({ message: "Organization updated successfully", organization });
416
+ res2.status(200).json({ message: "Organization updated successfully", organization });
417
417
  } catch (error) {
418
- res.status(500).json({ error: error.message });
418
+ res2.status(500).json({ error: error.message });
419
419
  }
420
420
  };
421
- const deleteOrganization = async (req, res) => {
421
+ const deleteOrganization = async (req, res2) => {
422
422
  Organization.findOneAndRemove({ _id: req.params._id }).then((organization) => {
423
423
  if (!organization) {
424
- return res.status(404).send({ message: "Organization not found" });
424
+ return res2.status(404).send({ message: "Organization not found" });
425
425
  }
426
426
  Membership.deleteMany({ organization: req.params._id }).then(() => {
427
427
  const newToken = jwt.sign({
@@ -431,12 +431,12 @@ const controllerFactory$5 = (db) => {
431
431
  expiresIn: 86400
432
432
  // 24 hours
433
433
  });
434
- res.send({ newToken });
434
+ res2.send({ newToken });
435
435
  }).catch((err) => {
436
- res.status(500).send({ message: "Error deleting memberships: " + err.message });
436
+ res2.status(500).send({ message: "Error deleting memberships: " + err.message });
437
437
  });
438
438
  }).catch((err) => {
439
- res.status(500).send({ message: err.message });
439
+ res2.status(500).send({ message: err.message });
440
440
  });
441
441
  };
442
442
  return {
@@ -452,7 +452,7 @@ var organizations_controller = controllerFactory$5;
452
452
  const ObjectId$1 = require$$0.Types.ObjectId;
453
453
  const controllerFactory$4 = (db) => {
454
454
  const Membership = db.membership;
455
- const read = async (req, res) => {
455
+ const read = async (req, res2) => {
456
456
  try {
457
457
  const memberships = await Membership.aggregate([
458
458
  {
@@ -476,15 +476,15 @@ const controllerFactory$4 = (db) => {
476
476
  }
477
477
  ]);
478
478
  if (!memberships || memberships.length === 0) {
479
- return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
479
+ return res2.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
480
480
  }
481
- res.send(memberships);
481
+ res2.send(memberships);
482
482
  } catch (err) {
483
483
  console.log(err);
484
- res.status(500).send({ errorCode: "SERVER_ERROR" });
484
+ res2.status(500).send({ errorCode: "SERVER_ERROR" });
485
485
  }
486
486
  };
487
- const create = async (req, res) => {
487
+ const create = async (req, res2) => {
488
488
  console.log(req.body);
489
489
  const newMembership = new Membership({
490
490
  user: req.body.user,
@@ -494,35 +494,35 @@ const controllerFactory$4 = (db) => {
494
494
  });
495
495
  try {
496
496
  const data = await newMembership.save();
497
- res.send(data);
497
+ res2.send(data);
498
498
  } catch (err) {
499
- res.status(500).send({ errorCode: "SERVER_ERROR" });
499
+ res2.status(500).send({ errorCode: "SERVER_ERROR" });
500
500
  }
501
501
  };
502
- const update = async (req, res) => {
502
+ const update = async (req, res2) => {
503
503
  try {
504
504
  const membership = await Membership.findByIdAndUpdate(req.body._id, req.body, { new: true });
505
505
  if (!membership) {
506
- return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
506
+ return res2.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
507
507
  }
508
- res.send(membership);
508
+ res2.send(membership);
509
509
  } catch (err) {
510
- res.status(500).send({ errorCode: "SERVER_ERROR" });
510
+ res2.status(500).send({ errorCode: "SERVER_ERROR" });
511
511
  }
512
512
  };
513
- const deleteMembership = async (req, res) => {
513
+ const deleteMembership = async (req, res2) => {
514
514
  console.log(req.body);
515
515
  try {
516
516
  const membership = await Membership.findOneAndDelete({ _id: new ObjectId$1(req.body._id) });
517
517
  if (!membership) {
518
- return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
518
+ return res2.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
519
519
  } else {
520
520
  await Membership.deleteOne({ _id: membership._id });
521
- res.status(200).send(membership);
521
+ res2.status(200).send(membership);
522
522
  }
523
523
  } catch (error) {
524
524
  console.log(error);
525
- res.status(500).send({ errorCode: "SERVER_ERROR" });
525
+ res2.status(500).send({ errorCode: "SERVER_ERROR" });
526
526
  }
527
527
  };
528
528
  return {
@@ -539,34 +539,34 @@ const сontrollerFactory = (db) => {
539
539
  const User = db.user;
540
540
  const Invite = db.invite;
541
541
  const Membership = db.membership;
542
- const getOneByCode = async (req, res) => {
542
+ const getOneByCode = async (req, res2) => {
543
543
  try {
544
544
  const invite = await Invite.findOne({ code: req.params._id });
545
545
  if (!invite) {
546
- return res.status(404).send({ message: "Приглашение не найдено" });
546
+ return res2.status(404).send({ message: "Приглашение не найдено" });
547
547
  }
548
- res.send(invite);
548
+ res2.send(invite);
549
549
  } catch (err) {
550
- res.status(500).send({ message: err.message });
550
+ res2.status(500).send({ message: err.message });
551
551
  }
552
552
  };
553
- const read = async (req, res) => {
553
+ const read = async (req, res2) => {
554
554
  try {
555
- const invites = await Invite.find({ organization: req.params._id });
556
- if (!invites) {
557
- return res.status(404).send({ message: "Invites not found" });
555
+ const invites = await Invite.find({ "owner.target": req.params._id });
556
+ if (!invites || invites.length === 0) {
557
+ return res2.status(200).send([]);
558
558
  }
559
- res.send(invites);
559
+ res2.send(invites);
560
560
  } catch (err) {
561
- res.status(500).send({ message: err.message });
561
+ res2.status(500).send({ message: err.message });
562
562
  }
563
563
  };
564
- const create = async (req, res) => {
565
- const userInviter = JSON.parse(req.cookies.user);
566
- const organizationId = req.params._id;
564
+ const create = async (req, res2) => {
565
+ const creator = req.body.creator;
566
+ const owner = req.body.owner;
567
+ const list = req.body.invites;
567
568
  try {
568
- const invites = req.body;
569
- for (let invite of invites) {
569
+ for (let invite of list) {
570
570
  let user2 = null;
571
571
  if (invite.contact.includes("@")) {
572
572
  user2 = await User.findOne({ email: invite.contact });
@@ -574,53 +574,52 @@ const сontrollerFactory = (db) => {
574
574
  user2 = await User.findOne({ phone: invite.contact });
575
575
  }
576
576
  if (user2) {
577
- console.log(invite);
578
577
  const membership = new Membership({
579
578
  user: user2._id,
580
579
  type: "organization",
581
- target: organizationId,
582
- role: invite.role
580
+ target: req.body.owner.target,
581
+ role: "member",
582
+ label: "member"
583
583
  });
584
584
  await membership.save();
585
- res.status(200).json({ message: "Invites sent successfully!" });
586
585
  } else {
587
586
  const newInvite = new Invite({
588
587
  code: uuid(),
589
- organization: organizationId,
590
- role: invite.role,
591
- createdBy: userInviter._id,
592
- invitedEmail: invite.contact.includes("@") ? invite.contact : null,
593
- invitedPhone: !invite.contact.includes("@") ? invite.contact : null
588
+ creator,
589
+ owner,
590
+ role: "member",
591
+ email: invite.contact.includes("@") ? invite.contact : null,
592
+ phone: !invite.contact.includes("@") ? invite.contact : null
594
593
  });
595
594
  const savedInvite = await newInvite.save();
596
- if (savedInvite.invitedEmail) {
597
- const to = savedInvite.invitedEmail;
595
+ if (savedInvite.email !== null) {
596
+ const to = savedInvite.email;
598
597
  const subject = "You have been added to the organization";
599
598
  const text = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=email"`;
600
599
  await sendEmail(to, subject, text);
601
600
  }
602
- if (savedInvite.invitedPhone !== null) {
603
- const phone = savedInvite.invitedPhone;
601
+ if (savedInvite.phone !== null) {
602
+ const phone = savedInvite.phone;
604
603
  const message = `You have been invited to join an organization on ${process.env.APP_NAME}! Use this link to register: ${process.env.API_URL}/auth/invite?inviteCode=${newInvite.code}&type=phone`;
605
604
  await sendSms(phone, message);
606
605
  }
607
- res.status(200).json({ message: "Invites sent successfully!" });
608
606
  }
609
607
  }
608
+ res2.status(200).json({ message: "Invites sent successfully!" });
610
609
  } catch (error) {
611
610
  console.error(error);
612
- res.status(500).json({ message: "Something went wrong" });
611
+ res2.status(500).json({ message: "Something went wrong" });
613
612
  }
614
613
  };
615
- const deleteInvite = async (req, res) => {
614
+ const deleteInvite = async (req, res2) => {
616
615
  try {
617
616
  const invite = await Invite.findOneAndDelete({ _id: req.params._id });
618
617
  if (!invite) {
619
- return res.status(404).send({ message: "Invite not found" });
618
+ return res2.status(404).send({ message: "Invite not found" });
620
619
  }
621
- res.send({ message: "Invite deleted successfully" });
620
+ res2.send({ message: "Invite deleted successfully" });
622
621
  } catch (err) {
623
- res.status(500).send({ message: err.message });
622
+ res2.status(500).send({ message: err.message });
624
623
  }
625
624
  };
626
625
  return {
@@ -631,18 +630,135 @@ const сontrollerFactory = (db) => {
631
630
  };
632
631
  };
633
632
  var invites_controller = сontrollerFactory;
633
+ let AccessController$1 = class AccessController {
634
+ db = null;
635
+ rule = null;
636
+ next = null;
637
+ entity = null;
638
+ /**
639
+ * @param {String} rule - Права на проверку (read, create, ...)
640
+ * @param {String} entity - Сущность на проверку (departments, post, ...)
641
+ */
642
+ check(rule, entity) {
643
+ if (this.rule === rule && this.entity === entity) {
644
+ return this.access.bind(this);
645
+ } else if (this.next) {
646
+ this.next.check(rule, entity);
647
+ } else {
648
+ console.error("Неудачная попытка вызова посредника verifyAccesses");
649
+ console.error("Переданные аргументы:", this.rule, this.entity);
650
+ return async (req, res2, next) => {
651
+ return res2.status(403).send({ message: "Access Denied. Middleware not founded" });
652
+ };
653
+ }
654
+ }
655
+ };
656
+ var AccessController_1 = AccessController$1;
657
+ const AccessController2 = AccessController_1;
658
+ let ReadDepartments$1 = class ReadDepartments extends AccessController2 {
659
+ rule = "read";
660
+ entity = "departments";
661
+ async access(req, res2, next) {
662
+ const Department = this.db.department;
663
+ try {
664
+ const userId = req.cookies.user._id;
665
+ const organization = req.query.organization;
666
+ const departments = await Department.find({
667
+ organization: { $eq: organization },
668
+ members: { $elemMatch: { user: userId } }
669
+ });
670
+ if (!departments.length) {
671
+ return res2.status(403).send({
672
+ message: "Access Denied. Read Departments. Департаменты не найдены"
673
+ });
674
+ }
675
+ let hasAccess = false;
676
+ departments.forEach((departament) => {
677
+ const accesses = departament.accesses;
678
+ if (getNestedProperty(accesses, rulePath)) {
679
+ hasAccess = true;
680
+ }
681
+ });
682
+ if (hasAccess) {
683
+ next();
684
+ } else {
685
+ return res2.status(403).send({ message: "Access Denied. Read Departments. No access" });
686
+ }
687
+ } catch (error) {
688
+ console.error("[canReadDepartments]", error);
689
+ return res2.status(500).send({ message: error.message });
690
+ }
691
+ }
692
+ /**
693
+ * // note: пока не использовался метод
694
+ * @param {Object} req объект
695
+ * @returns
696
+ */
697
+ async departmentsWhereUserIsMember(req) {
698
+ const Department = this.db.department;
699
+ try {
700
+ const userId = req.cookies.user._id;
701
+ const organization = req.query.organization;
702
+ const departments = await Department.find({
703
+ organization: { $eq: organization },
704
+ members: { $elemMatch: { user: userId } }
705
+ });
706
+ return departments;
707
+ } catch (error) {
708
+ console.error("[canReadDepartments]", error);
709
+ return res.status(500).send({ message: error.message });
710
+ }
711
+ }
712
+ };
713
+ var ReadDepartments_1 = ReadDepartments$1;
714
+ function getNestedProperty(obj, propertyPath) {
715
+ const properties = propertyPath.split(".");
716
+ let value = obj;
717
+ for (const property of properties) {
718
+ if (!value.hasOwnProperty(property)) {
719
+ return void 0;
720
+ }
721
+ value = value[property];
722
+ }
723
+ return value;
724
+ }
725
+ const ReadDepartments2 = ReadDepartments_1;
726
+ var verifyAccesses = (db) => {
727
+ const instances = [];
728
+ const middlewares = [
729
+ ReadDepartments2
730
+ ];
731
+ let nextMiddleware = null;
732
+ for (let i = middlewares.length - 1; i >= 0; i--) {
733
+ const Middleware = middlewares[i];
734
+ const middleware = new Middleware();
735
+ middleware.db = db;
736
+ middleware.next = nextMiddleware;
737
+ instances.unshift(middleware);
738
+ nextMiddleware = middleware;
739
+ }
740
+ return (rule, entity) => instances[0].check(rule, entity);
741
+ };
634
742
  const controllerFactory$3 = departments_controller;
743
+ const accessMiddlewaresFactory = verifyAccesses;
635
744
  var departments_routes = function(app, db) {
636
745
  const controller = controllerFactory$3(db);
637
- app.use(function(req, res, next) {
638
- res.header(
746
+ accessMiddlewaresFactory(db);
747
+ app.use(function(req, res2, next) {
748
+ res2.header(
639
749
  "Access-Control-Allow-Headers",
640
750
  "Access-Control-Allow-Origin",
641
751
  "x-access-token, Origin, Content-Type, Accept"
642
752
  );
643
753
  next();
644
754
  });
645
- app.get("/api/departments/read", controller.read);
755
+ app.get(
756
+ "/api/departments/read",
757
+ // [
758
+ // verifyAccesses('read', 'departments'),
759
+ // ],
760
+ controller.read
761
+ );
646
762
  app.get("/api/departments/get/:_id", controller.readOne);
647
763
  app.post("/api/departments/:_id/create", controller.create);
648
764
  app.post("/api/departments/:_id/update", controller.update);
@@ -651,8 +767,8 @@ var departments_routes = function(app, db) {
651
767
  const controllerFactory$2 = organizations_controller;
652
768
  var organizations_routes = function(app, db) {
653
769
  const controller = controllerFactory$2(db);
654
- app.use(function(req, res, next) {
655
- res.header(
770
+ app.use(function(req, res2, next) {
771
+ res2.header(
656
772
  "Access-Control-Allow-Headers",
657
773
  "Access-Control-Allow-Origin",
658
774
  "x-access-token, Origin, Content-Type, Accept"
@@ -679,8 +795,8 @@ var organizations_routes = function(app, db) {
679
795
  const controllerFactory$1 = memberships_controller;
680
796
  var memberships_routes = function(app, db) {
681
797
  const controller = controllerFactory$1(db);
682
- app.use(function(req, res, next) {
683
- res.header(
798
+ app.use(function(req, res2, next) {
799
+ res2.header(
684
800
  "Access-Control-Allow-Headers",
685
801
  "Access-Control-Allow-Origin",
686
802
  "x-access-token, Origin, Content-Type, Accept"
@@ -709,8 +825,8 @@ const middlewareFactory = server;
709
825
  var invites_routes = function(app, db) {
710
826
  const controller = controllerFactory(db);
711
827
  const { verifyInvites } = middlewareFactory(db);
712
- app.use(function(req, res, next) {
713
- res.header(
828
+ app.use(function(req, res2, next) {
829
+ res2.header(
714
830
  "Access-Control-Allow-Headers",
715
831
  "Access-Control-Allow-Origin",
716
832
  "x-access-token, Origin, Content-Type, Accept"
@@ -726,7 +842,7 @@ var invites_routes = function(app, db) {
726
842
  controller.read
727
843
  );
728
844
  app.post(
729
- "/api/invites/:_id/create",
845
+ "/api/invites/create",
730
846
  [
731
847
  verifyInvites.checkInviteExist,
732
848
  verifyInvites.checkUsersExist
@@ -734,7 +850,7 @@ var invites_routes = function(app, db) {
734
850
  controller.create
735
851
  );
736
852
  app.delete(
737
- "/api/invites/:_id/delete",
853
+ "/api/invites/delete/:_id",
738
854
  controller.delete
739
855
  );
740
856
  };
@@ -765,6 +881,50 @@ var department_model = (mongoose) => {
765
881
  type: Boolean,
766
882
  default: false
767
883
  },
884
+ accesses: {
885
+ products: {
886
+ read: {
887
+ type: Boolean,
888
+ default: false
889
+ },
890
+ edit: {
891
+ type: Boolean,
892
+ default: false
893
+ },
894
+ delete: {
895
+ type: Boolean,
896
+ default: false
897
+ }
898
+ },
899
+ orders: {
900
+ read: {
901
+ type: Boolean,
902
+ default: false
903
+ },
904
+ confirm: {
905
+ type: Boolean,
906
+ default: false
907
+ },
908
+ delete: {
909
+ type: Boolean,
910
+ default: false
911
+ }
912
+ },
913
+ departments: {
914
+ read: {
915
+ type: Boolean,
916
+ default: false
917
+ },
918
+ edit: {
919
+ type: Boolean,
920
+ default: false
921
+ },
922
+ delete: {
923
+ type: Boolean,
924
+ default: false
925
+ }
926
+ }
927
+ },
768
928
  // Marketplace options
769
929
  delivery: [String],
770
930
  payment: [String],
@@ -786,6 +946,8 @@ var department_model = (mongoose) => {
786
946
  ref: "Department"
787
947
  }
788
948
  ]
949
+ }, {
950
+ timestamps: true
789
951
  });
790
952
  departmentSchema.index({ organization: 1 });
791
953
  const Department = mongoose.model("Department", departmentSchema);
@@ -854,6 +1016,8 @@ var organization_model = (mongoose) => {
854
1016
  },
855
1017
  amount: Number
856
1018
  }
1019
+ }, {
1020
+ timestamps: true
857
1021
  });
858
1022
  const Organization = mongoose.model("Organization", OrganizationSchema);
859
1023
  return Organization;
@@ -890,51 +1054,50 @@ var membership_model = (mongoose) => {
890
1054
  },
891
1055
  required: true
892
1056
  }
1057
+ }, {
1058
+ timestamps: true
893
1059
  });
894
1060
  const Membership = mongoose.model("Membership", MembershipSchema);
895
1061
  return Membership;
896
1062
  };
897
- var invite_model = (mongoose) => {
898
- const InviteSchema = new mongoose.Schema({
1063
+ const applyOwnershipSchema = ownership_schema;
1064
+ const applyCredentialsSchema = credentials_schema;
1065
+ var invite_model = (db) => {
1066
+ const InviteSchema = new db.mongoose.Schema({
899
1067
  code: {
900
1068
  type: String,
901
1069
  required: true,
902
1070
  unique: true
903
1071
  },
904
- organization: {
905
- type: mongoose.Schema.Types.ObjectId,
906
- ref: "Organization",
907
- required: true
908
- },
909
1072
  status: {
910
1073
  type: String,
911
- enum: ["active", "used"],
1074
+ enum: ["active", "used", "deactivated"],
912
1075
  default: "active"
913
- },
914
- role: {
915
- name: {
916
- type: String,
917
- default: "Сотрудник"
918
- },
919
- value: {
920
- type: String,
921
- default: "member"
922
- }
923
- },
924
- createdBy: {
925
- type: mongoose.Schema.Types.ObjectId,
926
- ref: "User"
927
- },
928
- invitedEmail: {
929
- type: String
930
- },
931
- invitedPhone: {
932
- type: String
933
1076
  }
934
1077
  }, {
935
1078
  timestamps: true
936
1079
  });
937
- const Invite = mongoose.model("Invite", InviteSchema);
1080
+ applyOwnershipSchema(InviteSchema, db);
1081
+ applyCredentialsSchema(InviteSchema);
1082
+ InviteSchema.index({
1083
+ owner: 1,
1084
+ email: 1
1085
+ }, {
1086
+ unique: true,
1087
+ partialFilterExpression: {
1088
+ email: { $exists: true, $ne: "" }
1089
+ }
1090
+ });
1091
+ InviteSchema.index({
1092
+ owner: 1,
1093
+ phone: 1
1094
+ }, {
1095
+ unique: true,
1096
+ partialFilterExpression: {
1097
+ phone: { $exists: true, $ne: "" }
1098
+ }
1099
+ });
1100
+ const Invite = db.mongoose.model("Invite", InviteSchema);
938
1101
  return Invite;
939
1102
  };
940
1103
  const DepartmentsController = departments_controller;