@ozdao/prometheus-framework 0.2.138 → 0.2.140

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/dist/auth.server.js +30 -15
  2. package/dist/auth.server.mjs +30 -15
  3. package/dist/community.server.js +3 -3
  4. package/dist/community.server.mjs +3 -3
  5. package/dist/events.server.js +3 -3
  6. package/dist/events.server.mjs +3 -3
  7. package/dist/files.server.js +3 -3
  8. package/dist/files.server.mjs +3 -3
  9. package/dist/gallery.server.js +4 -4
  10. package/dist/gallery.server.mjs +4 -4
  11. package/dist/index-DNI4aUP2.js +259 -0
  12. package/dist/index-Tcyehi73.mjs +260 -0
  13. package/dist/orders.server.js +9 -8
  14. package/dist/orders.server.mjs +9 -8
  15. package/dist/organizations.server.js +31 -15
  16. package/dist/organizations.server.mjs +31 -15
  17. package/dist/products.server.js +37 -5
  18. package/dist/products.server.mjs +37 -5
  19. package/dist/prometheus-framework/src/components/Completion/Completion.vue.cjs +1 -1
  20. package/dist/prometheus-framework/src/components/Completion/Completion.vue.js +19 -19
  21. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  22. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +1 -1
  23. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  24. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  25. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  26. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +2 -2
  27. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  28. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  29. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +2 -2
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +32 -31
  33. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +2 -2
  35. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  36. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +2 -2
  37. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +2 -2
  39. package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/auth/store/auth.js +50 -47
  41. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
  43. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  45. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +3 -3
  47. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +3 -3
  49. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  50. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +2 -2
  51. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  52. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  53. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  55. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +2 -2
  57. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  59. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +3 -3
  61. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +3 -3
  63. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.js +2 -2
  65. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +5 -5
  67. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  69. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
  71. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  72. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  73. package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.cjs +1 -1
  74. package/dist/prometheus-framework/src/modules/marketplace/store/marketplace.js +1 -1
  75. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  76. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
  77. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  78. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +16 -16
  79. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
  80. package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +5 -5
  81. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
  82. package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +2 -2
  83. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  84. package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
  85. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
  86. package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
  87. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  88. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +42 -39
  89. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  90. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  91. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  92. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +4 -4
  93. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  94. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +121 -112
  95. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +4 -4
  97. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
  98. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +17 -16
  99. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  100. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +3 -3
  101. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  102. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +121 -61
  103. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  104. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +6 -6
  105. package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
  106. package/dist/prometheus-framework/src/modules/organizations/store/invites.js +25 -24
  107. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  108. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +2 -2
  109. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  110. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  111. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  112. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  113. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  114. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  115. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  116. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  117. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  118. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +3 -3
  119. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  120. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +3 -3
  121. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  122. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
  123. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  124. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  125. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  126. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +3 -3
  127. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  128. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  129. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  130. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +3 -3
  131. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
  132. package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
  133. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
  134. package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +2 -2
  135. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  136. package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +4 -4
  137. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -1
  138. package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +66 -67
  139. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
  140. package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +4 -4
  141. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  142. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +3 -3
  143. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  144. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +78 -74
  145. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -1
  146. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +1 -1
  147. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
  148. package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +2 -2
  149. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
  150. package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +5 -5
  151. package/dist/reports.server.js +0 -3
  152. package/dist/reports.server.mjs +0 -3
  153. package/dist/style.css +1 -1
  154. package/dist/wallet.server.js +5 -5
  155. package/dist/wallet.server.mjs +8 -8
  156. package/package.json +1 -1
  157. package/src/components/Completion/Completion.vue +29 -30
  158. package/src/modules/auth/components/pages/Invite.vue +4 -2
  159. package/src/modules/auth/controllers/auth.controller.js +31 -13
  160. package/src/modules/auth/middlewares/authJwt.js +80 -0
  161. package/src/modules/{middlewares/server → auth/middlewares}/index.js +1 -3
  162. package/src/modules/{middlewares/server → auth/middlewares}/verifyAccesses.js +1 -1
  163. package/src/modules/auth/routes/auth.routes.js +2 -2
  164. package/src/modules/auth/routes/twofa.routes.js +1 -1
  165. package/src/modules/auth/store/auth.js +9 -0
  166. package/src/modules/chats/routes/chats.routes.js +1 -1
  167. package/src/modules/community/routes/blog.routes.js +2 -2
  168. package/src/modules/events/routes/events.routes.js +2 -2
  169. package/src/modules/files/routes/files.routes.js +2 -2
  170. package/src/modules/gallery/components/pages/Gallery.vue +1 -1
  171. package/src/modules/gallery/routes/gallery.routes.js +4 -5
  172. package/src/modules/globals/services/globals.crud.js +2 -2
  173. package/src/modules/marketplace/store/marketplace.js +1 -1
  174. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +2 -2
  175. package/src/modules/orders/components/sections/FormAddCustomer.vue +2 -2
  176. package/src/modules/orders/controllers/orders.controller.js +1 -2
  177. package/src/modules/orders/routes/applications.routes.js +2 -2
  178. package/src/modules/orders/routes/orders.routes.js +2 -2
  179. package/src/modules/organizations/components/blocks/CardOrganization.vue +9 -7
  180. package/src/modules/organizations/components/pages/Members.vue +26 -15
  181. package/src/modules/organizations/components/sections/DetailsTab.vue +1 -1
  182. package/src/modules/organizations/components/sections/MembersAdd.vue +101 -43
  183. package/src/modules/organizations/controllers/invites.controller.js +18 -13
  184. package/src/modules/organizations/controllers/memberships.controller.js +16 -9
  185. package/src/modules/organizations/controllers/organizations.controller.js +3 -4
  186. package/src/modules/organizations/models/membership.model.js +2 -0
  187. package/src/modules/organizations/models/organization.model.js +4 -0
  188. package/src/modules/organizations/routes/invites.routes.js +2 -2
  189. package/src/modules/organizations/store/invites.js +2 -1
  190. package/src/modules/products/controllers/leftovers.controller.js +1 -1
  191. package/src/modules/products/middlewares/index.js +11 -0
  192. package/src/modules/products/routes/categories.routes.js +2 -2
  193. package/src/modules/reports/routes/reports.routes.js +2 -2
  194. package/src/modules/spots/components/layouts/Spots.vue +2 -2
  195. package/src/modules/spots/components/pages/Map.vue +79 -78
  196. package/src/modules/users/components/pages/ProfileEdit.vue +37 -22
  197. package/src/modules/wallet/controllers/routes/payments.routes.js +2 -2
  198. package/src/modules/wallet/controllers/routes/rewards.routes.js +2 -2
  199. package/src/modules/middlewares/server/authJwt.js +0 -68
  200. /package/src/modules/{middlewares/server → auth/middlewares}/authSecret.js +0 -0
  201. /package/src/modules/{middlewares/server → auth/middlewares}/verifyInvites.js +0 -0
  202. /package/src/modules/{middlewares/server → auth/middlewares}/verifySignUp.js +0 -0
  203. /package/src/modules/{middlewares/server → auth/middlewares}/verifyUser.js +0 -0
  204. /package/src/modules/globals/services/{globals.cashe.js → globals.cache.js} +0 -0
  205. /package/src/modules/{middlewares/server → products/middlewares}/verifyCategory.js +0 -0
@@ -2,7 +2,7 @@
2
2
  const controllerFactory = require("../controllers/auth.controller");
3
3
  const controllerFactoryTwofa = require("../controllers/twofa.controller");
4
4
  // Middlewares
5
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
5
+ const middlewareFactory = require('@pf/src/modules/auth/middlewares');
6
6
  // Routes
7
7
  module.exports = function(app, db, origins) {
8
8
  const controller = controllerFactory(db);
@@ -40,7 +40,7 @@ module.exports = function(app, db, origins) {
40
40
  app.get(
41
41
  "/api/auth/check-accesses",
42
42
  [
43
- authJwt.verifyToken,
43
+ authJwt.verifyToken(true),
44
44
  ],
45
45
  controller.checkAccesses
46
46
  );
@@ -1,7 +1,7 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/twofa.controller");
3
3
  // Middlewares
4
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactory = require('@pf/src/modules/auth/middlewares');
5
5
  // Routes
6
6
  module.exports = function(app, db) {
7
7
  const controller = controllerFactory(db);
@@ -85,6 +85,8 @@
85
85
  roles: response.data.roles
86
86
  });
87
87
 
88
+ await initialize();
89
+
88
90
  return response.data;
89
91
  } catch (error) {
90
92
 
@@ -141,6 +143,8 @@
141
143
  roles: response.data.roles
142
144
  });
143
145
 
146
+ await initialize();
147
+
144
148
  return response.data;
145
149
  } catch (error) {
146
150
  setError(error);
@@ -153,6 +157,8 @@
153
157
  removeCookie('user');
154
158
 
155
159
  Object.assign(state.user, {
160
+ _id: undefined,
161
+ username: '',
156
162
  email: '',
157
163
  phone: '',
158
164
  password: '',
@@ -160,9 +166,12 @@
160
166
  });
161
167
 
162
168
  Object.assign(state.access, {
169
+ roles: null,
163
170
  token: null,
164
171
  status: false
165
172
  });
173
+
174
+ state.accesses = []
166
175
  },
167
176
 
168
177
  async resetPassword(user, type) {
@@ -1,7 +1,7 @@
1
1
  // Factories
2
2
  const controllerFactory = require('../controllers/chats.controller.js');
3
3
  // Middlewares
4
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactory = require('@pf/src/modules/auth/middlewares');
5
5
  // Routes
6
6
  module.exports = function(app, db, wss) {
7
7
  const controller = controllerFactory(db);
@@ -1,12 +1,12 @@
1
1
  const controllerFactory = require("../controllers/blog.controller");
2
2
 
3
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
3
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
4
4
  const middlewareFactoryCommunity = require('../middlewares/server');
5
5
 
6
6
  module.exports = function(app, db, origins) {
7
7
  const controller = controllerFactory(db);
8
8
 
9
- const { authJwt } = middlewareFactoryGlobal(db);
9
+ const { authJwt } = middlewareFactoryAuth(db);
10
10
  const { verifyBlogpost } = middlewareFactoryCommunity(db);
11
11
 
12
12
  app.get(
@@ -1,13 +1,13 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/events.controller");
3
3
  // Middlewares
4
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
5
  const middlewareFactoryEvents = require('../middlewares/server');
6
6
  // Routes
7
7
  module.exports = function(app, db, origins) {
8
8
  const controller = controllerFactory(db);
9
9
 
10
- const { authJwt } = middlewareFactoryGlobal(db);
10
+ const { authJwt } = middlewareFactoryAuth(db);
11
11
  const { verifyEvent } = middlewareFactoryEvents(db);
12
12
 
13
13
  app.get(
@@ -1,13 +1,13 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/files.controller");
3
3
  // Middlewares
4
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
5
  const middlewareFactoryFiles = require('../middlewares/server');
6
6
 
7
7
  module.exports = function(app, db, origins, publicPath) {
8
8
  const controller = controllerFactory(db, publicPath);
9
9
 
10
- const { authJwt } = middlewareFactoryGlobal(db);
10
+ const { authJwt } = middlewareFactoryAuth(db);
11
11
  const { middlewareBusboy } = middlewareFactoryFiles(db, publicPath);
12
12
 
13
13
  app.post(
@@ -48,7 +48,7 @@
48
48
  class="cols-3 gap-thin"
49
49
  >
50
50
  <div v-for="item in items" :key="item._id" class="bg-light radius-medium o-hidden flex-column pos-relative flex-wrap">
51
- <div class="w-100 h-100 pos-relative">
51
+ <div class="w-100 h-100 h-min-10r pos-relative">
52
52
  <img
53
53
  :src="(FILE_SERVER_URL || '') + item.cover"
54
54
  class="w-100 h-100 object-fit-cover bg-black " @click="openPreviewPopup(item)"
@@ -1,20 +1,19 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/gallery.controller");
3
3
  // Middlewares
4
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
5
- const middlewareFactoryAccesses = require('@pf/src/modules/middlewares/server/verifyAccesses')
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
+ const middlewareFactoryAccesses = require('@pf/src/modules/auth/middlewares/verifyAccesses')
6
6
 
7
7
  module.exports = function(app, db, origins) {
8
8
  const controller = controllerFactory(db);
9
9
 
10
- const { authJwt } = middlewareFactoryGlobal(db);
10
+ const { authJwt } = middlewareFactoryAuth(db);
11
11
  const { verifyRead } = middlewareFactoryAccesses(db)
12
12
 
13
-
14
13
  app.get(
15
14
  "/api/gallery/read",
16
15
  [
17
- authJwt.verifyToken,
16
+ authJwt.verifyToken(true),
18
17
  verifyRead('gallery'),
19
18
  ],
20
19
  controller.read
@@ -1,12 +1,12 @@
1
1
  const globalsQuery = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
2
2
 
3
- const Cashe = require('@pf/src/modules/globals/services/globals.cashe');
3
+ const Cache = require('@pf/src/modules/globals/services/globals.cache');
4
4
  const Logger = require('@pf/src/modules/globals/services/globals.logger');
5
5
 
6
6
  class CRUD {
7
7
  constructor(basePath, app, db, model) {
8
8
  this.model = model;
9
- this.cache = new Cashe();
9
+ this.cache = new Cache();
10
10
  this.logger = new Logger(db);
11
11
 
12
12
  this.app = app;
@@ -47,7 +47,7 @@ const state = reactive({
47
47
  value: 'views'
48
48
  },{
49
49
  label: 'Products',
50
- value: 'products'
50
+ value: 'numberOfProducts'
51
51
  }]
52
52
  }
53
53
  });
@@ -117,7 +117,7 @@
117
117
  @click="() => {
118
118
  orders.mutations.resetCustomer(orders.state.current.customer)
119
119
  }"
120
- class="bg-white pd-thin radius-medium w-100 mn-b-thin"
120
+ class="bg-white pd-thin h-4r radius-medium w-100 mn-b-thin"
121
121
  />
122
122
  <Feed
123
123
  v-else
@@ -152,7 +152,7 @@
152
152
  @click="() => {
153
153
  orders.state.current.customer = user
154
154
  }"
155
- class="bg-white pd-thin radius-medium w-100 mn-b-thin"
155
+ class="bg-white pd-thin h-4r radius-medium w-100 mn-b-thin"
156
156
  />
157
157
  </Feed>
158
158
 
@@ -15,7 +15,7 @@
15
15
  @click="() => {
16
16
  dataCustomer.user = null
17
17
  }"
18
- class="bg-white pd-thin radius-medium w-100"
18
+ class="bg-white h-2r pd-thin radius-medium w-100"
19
19
  />
20
20
 
21
21
  <div
@@ -54,7 +54,7 @@
54
54
  dataCustomer.email = user.email
55
55
  dataCustomer.socials = user.socials
56
56
  }"
57
- class="bg-white pd-thin radius-medium w-100 mn-b-thin"
57
+ class="bg-white h-2r pd-thin radius-medium w-100 mn-b-thin"
58
58
  />
59
59
  </Feed>
60
60
  </div>
@@ -2,8 +2,6 @@ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils
2
2
 
3
3
  const { sendChatMessageTelegram } = require('@pf/src/modules/globals/utils/mailing');
4
4
 
5
-
6
-
7
5
  function formatPositions(positions) {
8
6
  return positions.map(pos => `🔹 ${pos.name} - Price: $${pos.price}, Quantity: ${pos.quantity}`).join('\n');
9
7
  }
@@ -76,6 +74,7 @@ async function findOrCreateCustomer(Customer, customerInfo, orderOwner, orderCre
76
74
  const controllerFactory = (db) => {
77
75
  const Order = db.order;
78
76
  const Customer = db.customer;
77
+ const Leftover = db.leftover;
79
78
 
80
79
  // Создание заказа
81
80
  const create = async (req, res) => {
@@ -1,11 +1,11 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/applications.controller");
3
3
  // Middlewares
4
- const middlewareFactoryGlobal = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
5
  module.exports = function(app, db, origins) {
6
6
  const controller = controllerFactory(db);
7
7
 
8
- const { authJwt } = middlewareFactoryGlobal(db);
8
+ const { authJwt } = middlewareFactoryAuth(db);
9
9
 
10
10
  app.post(
11
11
  "/applications",
@@ -1,11 +1,11 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/orders.controller");
3
3
  // Middlewares
4
- const middlewareFactory = require('@pf/src/modules/middlewares/server');
4
+ const middlewareFactoryAuth = require('@pf/src/modules/auth/middlewares');
5
5
  // Routes
6
6
  module.exports = function(app, db, origins, publicPath) {
7
7
  const controller = controllerFactory(db);
8
- const middleware = middlewareFactory(db);
8
+ const middleware = middlewareFactoryAuth(db);
9
9
 
10
10
  app.post(
11
11
  "/api/orders/create",
@@ -69,14 +69,16 @@
69
69
  <IconTime class="i-medium mn-r-micro"/>
70
70
  <span class="mn-r-thin">{{
71
71
  organization.distance ?
72
- Math.ceil((5 + 5 + 3 * organization.distance) / 5) * 5
73
- + '-'
74
- + Math.ceil((15 + 5 + 3 * organization.distance) / 5) * 5
75
- + ' MIN' : 'Unavailable'
72
+ organization.distance > 50 ?
73
+ '3-5 days' :
74
+ Math.ceil((5 + 5 + 3 * organization.distance) / 5) * 5
75
+ + '-'
76
+ + Math.ceil((15 + 5 + 3 * organization.distance) / 5) * 5
77
+ + ' MIN' : 'Unavailable'
76
78
  }}
77
79
  </span>
78
- <span v-if="organization.distance" class="t-transp mn-r-thin">|</span>
79
- <span class="mn-r-thin">{{organization.distance ? organization.distance.toFixed(1) + ' KM' : ''}} </span>
80
+ <span v-if="organization.distance && organization.distance < 50" class="t-transp mn-r-thin">|</span>
81
+ <span v-if="organization.distance && organization.distance < 50" class="mn-r-thin">{{organization.distance ? organization.distance.toFixed(1) + ' KM' : ''}} </span>
80
82
  <!-- <span class="mn-r-thin">{{organization.nearestSpotDistance}}</span> -->
81
83
  <IconPrice class="i-medium mn-r-micro"/>
82
84
  <span class="mn-r-thin">{{returnCurrency()}}500 </span>
@@ -88,7 +90,7 @@
88
90
  <div class="w-max flex-nowrap flex gap-thin">
89
91
  <CardOrderItem
90
92
  @click.stop="$router.push({name: 'Product Organization', params: {_id: organization._id, product: product._id}})"
91
- v-for="product in organization.products.slice(0,10)"
93
+ v-for="product in organization.products.slice(0,5)"
92
94
  :key="product._id"
93
95
  :editable="false"
94
96
  :product="product"
@@ -120,7 +120,7 @@
120
120
  v-if="tab === 'invites'"
121
121
  >
122
122
  <Feed
123
- :search="true"
123
+ v-model:items="invitesState"
124
124
  :states="{
125
125
  empty: {
126
126
  title: 'No Invites Found',
@@ -183,6 +183,7 @@ import CardDepartment from '@pf/src/modules/organizations/components/blocks/Card
183
183
  import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue'
184
184
 
185
185
  import * as auth from '@pf/src/modules/auth/store/auth'
186
+ import * as globals from '@pf/src/modules/globals/store/globals'
186
187
  import * as invites from '@pf/src/modules/organizations/store/invites';
187
188
  import * as memberships from '@pf/src/modules/organizations/store/memberships';
188
189
  import * as organization from '@pf/src/modules/organizations/store/organizations'
@@ -194,6 +195,8 @@ const organizationData = ref(null)
194
195
 
195
196
  // Tab logic
196
197
  const tab = ref('members')
198
+ // States
199
+ const invitesState = ref([])
197
200
  // Popup
198
201
  const isOpenMembersAddPopup = ref(false);
199
202
 
@@ -222,19 +225,27 @@ const FirstLevelDepartments = computed(() => {
222
225
  );
223
226
  });
224
227
 
225
- async function handleSendInvite(list) {
226
- await invites.actions.create({
227
- owner: {
228
- type: 'Organization',
229
- target: organizationData.value._id
230
- },
231
- creator: {
232
- type: 'User',
233
- target: auth.state.user._id
234
- },
235
- invites: list,
236
- });
237
- closeMembersAddPopup()
228
+ async function handleSendInvite(list, resolve, reject) {
229
+ try {
230
+ const response = await invites.actions.create({
231
+ owner: {
232
+ type: 'Organization',
233
+ target: organizationData.value._id
234
+ },
235
+ creator: {
236
+ type: 'User',
237
+ target: auth.state.user._id
238
+ },
239
+ invites: list,
240
+ });
241
+ for (let invite of response.createdInvites) {
242
+ globals.actions.add(invitesState.value, invite)
243
+ }
244
+ closeMembersAddPopup();
245
+ resolve(); // Вызываем resolve, когда все операции завершены успешно
246
+ } catch (error) {
247
+ reject(error); // Вызываем reject, если произошла ошибка
248
+ }
238
249
  }
239
250
 
240
251
  async function removeMember(index,member) {
@@ -246,7 +257,7 @@ async function removeMember(index,member) {
246
257
 
247
258
  async function removeInvite(index,invite) {
248
259
  if (confirm("Confirm remove of member") == true) {
249
- invites.state.invites.splice(index, 1);
260
+ globals.actions.delete(invitesState.value, invite)
250
261
  await invites.actions.delete(invite._id);
251
262
  }
252
263
  }
@@ -91,7 +91,7 @@
91
91
  </div>
92
92
 
93
93
  <p class="w-max-50r mn-t-regular mn-b-medium p-big">
94
- <Text :text="organization.profile.description || ''" :maxLen="240" />
94
+ <Text :text="organization.profile.description || ''" :showToggleText="true" :maxLen="320" />
95
95
  </p>
96
96
 
97
97
  <Chips
@@ -1,48 +1,97 @@
1
1
  <template>
2
2
  <div>
3
3
  <p class="mn-b-thin t-transp p-medium">{{text}}</p>
4
- <section class="cols-1 mn-b-small radius-medium pd-semi bg-light">
5
- <div
6
- v-for="(member, index) in members"
7
- :key="index"
8
- class="
9
- br-1px br-solid br-grey-transp-25
10
- flex
11
- gap-thin
12
- radius-small
13
- mn-b-thin
14
- "
4
+
5
+ <div class="mn-b-thin pos-relative">
6
+ <BlockSearch
7
+ v-click-outside="() => {searchUserShow = false}"
8
+ @search="(event) => { searchUser = event; searchUserShow = true }"
9
+ placeholder="Enter name, phone or email"
10
+ class="bg-grey"
11
+ />
12
+
13
+ <div
14
+ v-if="searchUser && searchUserShow"
15
+ class="mn-t-thin pos-absolute w-100 pos-t-100 pos-l-0 z-index-3 bg-light pd-small radius-small
16
+ ">
17
+ <Feed
18
+ :states="{
19
+ empty: {
20
+ title: 'No User Found',
21
+ description: 'Currently, there are no such user.'
22
+ }
23
+ }"
24
+ :store="{
25
+ read: (options) => users.actions.read(options),
26
+ state: null
27
+ }"
28
+ :options="{
29
+ search: searchUser
30
+ }"
31
+ :showLoadMore="false"
32
+ v-slot="{
33
+ items
34
+ }"
35
+ class="h-max-20r o-scroll"
36
+ >
37
+ <CardUser
38
+ v-for="(user, index) in items" :key="user._id"
39
+ :user="user"
40
+ :photo="user.profile.photo"
41
+ :name="user.profile.name || user.phone || user.email"
42
+ @click="() => {
43
+ members.push({contact: user.email || user.phone})
44
+ searchUserShow = false
45
+ }"
46
+ class="bg-white h-2r pd-thin radius-medium w-100 mn-b-thin"
47
+ />
48
+ </Feed>
49
+ </div>
50
+ </div>
51
+
52
+ <section class="cols-1 mn-b-small radius-medium pd-semi bg-light pos-relative">
53
+
54
+ <div
55
+ v-for="(member, index) in members"
56
+ :key="index"
57
+ class="
58
+ br-1px br-solid br-grey-transp-25
59
+ flex
60
+ gap-thin
61
+ radius-small
62
+ mn-b-thin
63
+ "
64
+ >
65
+ <Field
66
+ v-model:field="member.contact"
67
+ placeholder="Enter email or phone"
68
+ class="w-100 pd-small radius-small bg-white"
69
+ :validation="contactValidation"
15
70
  >
16
- <Field
17
- v-model:field="member.contact"
18
- placeholder="Enter email or phone"
19
- class="w-100 pd-small radius-small bg-white"
20
- :validation="contactValidation"
71
+ <div
72
+ v-if="index < 1"
73
+ @click="() => members.push({contact: ''})"
74
+ class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-green"
21
75
  >
22
- <div
23
- v-if="index < 1"
24
- @click="() => members.push({contact: ''})"
25
- class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-green"
26
- >
27
- <IconAdd
28
- class="i-medium"
29
- :fill="'rgb(var(--white)'"
30
- />
31
- </div>
76
+ <IconAdd
77
+ class="i-medium"
78
+ :fill="'rgb(var(--white)'"
79
+ />
80
+ </div>
32
81
 
33
- <div
34
- v-else
35
- @click="() => members.splice(index, 1)"
36
- class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-red"
37
- >
38
- <IconDelete
39
- class="i-medium"
40
- :fill="'rgb(var(--white)'"
41
- />
42
- </div>
43
- </Field>
44
- </div>
45
- </section>
82
+ <div
83
+ v-else
84
+ @click="() => members.splice(index, 1)"
85
+ class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-red"
86
+ >
87
+ <IconDelete
88
+ class="i-medium"
89
+ :fill="'rgb(var(--white)'"
90
+ />
91
+ </div>
92
+ </Field>
93
+ </div>
94
+ </section>
46
95
 
47
96
 
48
97
  <Button
@@ -59,19 +108,26 @@
59
108
  import Field from '@pf/src/components/Field/Field.vue'
60
109
  import Select from '@pf/src/components/Select/Select.vue'
61
110
  import Button from '@pf/src/components/Button/Button.vue'
111
+ import Feed from '@pf/src/components/Feed/Feed.vue'
112
+
113
+ import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
114
+
115
+ import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
62
116
 
63
117
  import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';
64
118
  import IconAdd from '@pf/src/modules/icons/navigation/IconAdd.vue';
65
119
  // Import validation
66
120
  import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
67
-
68
- import * as invites from '@pf/src/modules/organizations/store/invites';
121
+ // Store
122
+ import * as users from '@pf/src/modules/users/store/users';
69
123
  // Props
70
124
  const props = defineProps({
71
125
  organization: Object,
72
126
  text: String,
73
127
  });
74
-
128
+ // User Search
129
+ let searchUser = ref(null)
130
+ let searchUserShow = ref(false)
75
131
  // Validation
76
132
  const contactValidation = ref(null)
77
133
  // Define Emits
@@ -80,6 +136,8 @@
80
136
  const members = ref([{ contact: ''}]);
81
137
 
82
138
  async function submitMembers() {
83
- emits('send-invite', members.value);
139
+ return new Promise((resolve, reject) => {
140
+ emits('send-invite', members.value, resolve, reject);
141
+ });
84
142
  }
85
143
  </script>
@@ -34,15 +34,20 @@ const сontrollerFactory = (db) => {
34
34
  };
35
35
 
36
36
  const create = async (req, res) => {
37
- const creator = req.body.creator
38
- const owner = req.body.owner
39
-
40
- const list = req.body.invites
37
+ const creator = req.body.creator;
38
+ const owner = req.body.owner;
39
+ const list = req.body.invites;
40
+ const createdInvites = [];
41
+ const createdMemberships = [];
41
42
 
42
43
  try {
43
44
  for (let invite of list) {
44
45
  let user = null;
45
46
 
47
+ if (!invite || !invite.contact) {
48
+ continue; // Пропускаем пустые объекты или объекты без contact
49
+ }
50
+
46
51
  if (invite.contact.includes('@')) {
47
52
  user = await User.findOne({ email: invite.contact });
48
53
  } else {
@@ -50,7 +55,6 @@ const сontrollerFactory = (db) => {
50
55
  }
51
56
 
52
57
  if (user) {
53
-
54
58
  const membership = new Membership({
55
59
  user: user._id,
56
60
  type: 'organization',
@@ -58,10 +62,9 @@ const сontrollerFactory = (db) => {
58
62
  role: 'member',
59
63
  label: 'member'
60
64
  });
61
-
62
- await membership.save();
65
+ const savedMembership = await membership.save();
66
+ createdMemberships.push(savedMembership);
63
67
  } else {
64
-
65
68
  const newInvite = new Invite({
66
69
  code: uuid(),
67
70
  creator: creator,
@@ -70,26 +73,28 @@ const сontrollerFactory = (db) => {
70
73
  email: invite.contact.includes('@') ? invite.contact : null,
71
74
  phone: !invite.contact.includes('@') ? invite.contact : null,
72
75
  });
73
-
74
76
  const savedInvite = await newInvite.save();
77
+ createdInvites.push(savedInvite);
75
78
 
76
79
  if (savedInvite.email !== null) {
77
80
  const to = savedInvite.email;
78
81
  const subject = 'You have been added to the organization';
79
- 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"`;
82
+ 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`;
80
83
 
81
84
  await sendEmail(to, subject, text);
82
85
  }
83
-
84
86
  if (savedInvite.phone !== null) {
85
87
  const phone = savedInvite.phone;
86
88
  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`;
87
-
88
89
  await sendSms(phone, message);
89
90
  }
90
91
  }
91
92
  }
92
- res.status(200).json({ message: 'Invites sent successfully!' });
93
+ res.status(200).json({
94
+ message: 'Invites sent successfully!',
95
+ createdInvites: createdInvites,
96
+ createdMemberships: createdMemberships
97
+ });
93
98
  } catch (error) {
94
99
  console.error(error);
95
100
  res.status(500).json({ message: 'Something went wrong' });