@ozdao/prometheus-framework 0.1.29 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. package/dist/BackofficeGallery-02c9721b.mjs +304 -0
  2. package/dist/BackofficeGallery-1d117a40.js +1 -0
  3. package/dist/BackofficeReports-cb4b180d.mjs +44 -0
  4. package/dist/BackofficeReports-d021871f.js +1 -0
  5. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-505c3ca5.js +1 -0
  6. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-b1873cb7.mjs +1945 -0
  7. package/dist/Button-2ca405bd.js +1 -0
  8. package/dist/Button-c59d387c.mjs +283 -0
  9. package/dist/Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js +1 -0
  10. package/dist/Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs +1 -0
  11. package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-0ea8fbf8.js +1 -0
  12. package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-4ed993c7.mjs +1 -0
  13. package/dist/CardOrganization-18c1e3fa.mjs +297 -0
  14. package/dist/CardOrganization-7d679e75.js +1 -0
  15. package/dist/Chips-2ada5eda.mjs +200 -0
  16. package/dist/Chips-8d0a1d2c.js +1 -0
  17. package/dist/Dashboard-239fb7a6.mjs +52 -0
  18. package/dist/Dashboard-94267906.js +1 -0
  19. package/dist/EULA-8265b0cf.mjs +4218 -0
  20. package/dist/EULA-cbb27503.js +1 -0
  21. package/dist/Feed-66095e66.js +1 -0
  22. package/dist/Feed-76fc4475.mjs +383 -0
  23. package/dist/Feed-e55bc6fa.js +1 -0
  24. package/dist/Feed-ef6c6ca3.mjs +371 -0
  25. package/dist/IconEdit-c98d3d06.mjs +339 -0
  26. package/dist/IconEdit-e4d0cc6e.js +1 -0
  27. package/dist/Image-052a3cc2.mjs +480 -0
  28. package/dist/Image-c90ee624.js +9 -0
  29. package/dist/MenuItem-0b249b94.mjs +93 -0
  30. package/dist/MenuItem-8b70d2cf.js +1 -0
  31. package/dist/Product-4b58701f.js +7 -0
  32. package/dist/Product-a6251018.mjs +844 -0
  33. package/dist/ProductEdit-3ff2af92.js +1 -0
  34. package/dist/ProductEdit-f901314c.mjs +306 -0
  35. package/dist/ProfileBlogposts-57931834.mjs +70 -0
  36. package/dist/ProfileBlogposts-af88ce98.js +1 -0
  37. package/dist/ProfileEvents-588eadf9.js +1 -0
  38. package/dist/ProfileEvents-ed7f9603.mjs +62 -0
  39. package/dist/ProfileOrganizations-7911deec.mjs +219 -0
  40. package/dist/ProfileOrganizations-ae258581.js +1 -0
  41. package/dist/Publics-50c0ff6c.js +1 -0
  42. package/dist/Publics-f34131bf.mjs +45 -0
  43. package/dist/Select-11ddabf5.mjs +79 -0
  44. package/dist/Select-3ca5ab39.js +1 -0
  45. package/dist/Socials-3fe01af1.mjs +275 -0
  46. package/dist/Socials-b19d0cb1.js +1 -0
  47. package/dist/addMembersQuantity-ea216f92.mjs +85 -0
  48. package/dist/addMembersQuantity-f922d82b.js +84 -0
  49. package/dist/auth-98fe3efb.mjs +612 -0
  50. package/dist/auth-acbe3ae1.js +7 -0
  51. package/dist/auth.client.cjs +7 -8
  52. package/dist/auth.client.js +449 -441
  53. package/dist/auth.validation-495e9d6d.js +1 -0
  54. package/dist/auth.validation-e265b496.mjs +23 -0
  55. package/dist/backoffice.client.cjs +1 -1
  56. package/dist/backoffice.client.js +55 -28
  57. package/dist/click-outside-0b0727d1.js +2 -0
  58. package/dist/click-outside-6101836c.mjs +19 -0
  59. package/dist/community.client.cjs +1 -1
  60. package/dist/community.client.js +121 -121
  61. package/dist/community.server.js +35 -5
  62. package/dist/community.server.mjs +35 -5
  63. package/dist/components/Button/Button.vue.d.ts +3 -0
  64. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  65. package/dist/components/CardHeader/CardHeader.vue.d.ts +3 -0
  66. package/dist/components/Dropdown/Dropdown.vue.d.ts +3 -0
  67. package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
  68. package/dist/components/Field/Field.vue.d.ts +1 -1
  69. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  70. package/dist/components/Popup/Popup.vue.d.ts +2 -1
  71. package/dist/components/Popup/Popup.vue.d.ts.map +1 -1
  72. package/dist/components/Select/Select.vue.d.ts +1 -1
  73. package/dist/components/Select/Select.vue.d.ts.map +1 -1
  74. package/dist/components/Upload/Upload.vue.d.ts +1 -1
  75. package/dist/events.client.cjs +2 -2
  76. package/dist/events.client.js +219 -217
  77. package/dist/events.server.js +2 -9
  78. package/dist/events.server.mjs +2 -9
  79. package/dist/legal.client.cjs +1 -1
  80. package/dist/legal.client.js +2565 -2545
  81. package/dist/main.css +1 -1
  82. package/dist/main.d.ts +1 -1
  83. package/dist/modules/backoffice/components/pages/Dashboard.vue.d.ts +6 -0
  84. package/dist/modules/icons/navigation/IconCross.vue.d.ts +4 -0
  85. package/dist/modules/legal/components/pages/legal/EULA.vue.d.ts +2 -0
  86. package/dist/modules/organizations/components/elements/ButtonFollow.vue.d.ts +1 -1
  87. package/dist/modules/organizations/components/elements/ButtonToggleMembership.vue.d.ts +12 -0
  88. package/dist/modules/organizations/components/sections/DetailsTab.vue.d.ts +2 -58
  89. package/dist/modules/organizations/components/sections/Feed.vue.d.ts +1 -1
  90. package/dist/modules/reports/components/pages/BackofficeReports.vue.d.ts +2 -0
  91. package/dist/modules/reports/components/sections/FormReport.vue.d.ts +75 -0
  92. package/dist/modules/reports/store/reports.d.ts +41 -0
  93. package/dist/organizations-a241b21d.js +1 -0
  94. package/dist/organizations-ea9de495.mjs +122 -0
  95. package/dist/organizations.client-292e8444.js +3 -0
  96. package/dist/organizations.client-6fc91683.mjs +3072 -0
  97. package/dist/organizations.client.cjs +1 -1
  98. package/dist/organizations.client.js +51 -49
  99. package/dist/organizations.server.js +20 -28
  100. package/dist/organizations.server.mjs +20 -28
  101. package/dist/prometheus-framework.cjs.js +19 -19
  102. package/dist/prometheus-framework.es.js +1635 -1608
  103. package/dist/reports-270f69df.js +1 -0
  104. package/dist/reports-79cd9459.mjs +91 -0
  105. package/dist/reports.client.cjs +1 -0
  106. package/dist/reports.client.js +8 -0
  107. package/dist/reports.server.js +159 -0
  108. package/dist/reports.server.mjs +160 -0
  109. package/dist/states.validation-02ba0aee.js +1 -0
  110. package/dist/states.validation-e5f4fa3a.mjs +13 -0
  111. package/dist/style.css +1 -1
  112. package/dist/users.client.cjs +1 -1
  113. package/dist/users.client.js +286 -242
  114. package/dist/users.server.js +6 -18
  115. package/dist/users.server.mjs +6 -18
  116. package/package.json +9 -1
  117. package/src/components/Button/Button.vue +66 -60
  118. package/src/components/CardHeader/CardHeader.vue +51 -50
  119. package/src/components/Dropdown/Dropdown.vue +28 -12
  120. package/src/components/FieldPhone/click-outside.js +0 -48
  121. package/src/components/Popup/Popup.vue +74 -23
  122. package/src/components/Select/Select.vue +10 -6
  123. package/src/main.ts +1 -1
  124. package/src/modules/auth/components/pages/EnterPassword.vue +13 -1
  125. package/src/modules/auth/components/pages/SignIn.vue +7 -1
  126. package/src/modules/auth/router/auth.js +1 -1
  127. package/src/modules/auth/store/auth.js +1 -1
  128. package/src/modules/backoffice/components/layouts/Backoffice.vue +3 -3
  129. package/src/modules/backoffice/components/pages/Dashboard.vue +62 -0
  130. package/src/modules/backoffice/router/backoffice.js +26 -0
  131. package/src/modules/community/components/blocks/CardBlogpost.vue +3 -0
  132. package/src/modules/community/components/layouts/Community.vue +4 -4
  133. package/src/modules/community/components/pages/CreateBlogPost.vue +27 -28
  134. package/src/modules/community/components/sections/Comments.vue +4 -2
  135. package/src/modules/community/components/sections/Feed.vue +1 -1
  136. package/src/modules/community/controllers/blog.controller.js +22 -3
  137. package/src/modules/community/controllers/comments.controller.js +23 -5
  138. package/src/modules/events/components/blocks/CardEvent.vue +4 -0
  139. package/src/modules/events/components/pages/EditEvent.vue +27 -28
  140. package/src/modules/events/components/sections/Feed.vue +1 -1
  141. package/src/modules/events/controllers/events.controller.js +3 -10
  142. package/src/modules/gallery/components/sections/BackofficeGallery.vue +7 -23
  143. package/src/modules/icons/navigation/IconCross.vue +22 -0
  144. package/src/modules/legal/components/pages/Legal.vue +3 -0
  145. package/src/modules/legal/components/pages/legal/EULA.vue +2148 -0
  146. package/src/modules/legal/router/legal.js +11 -4
  147. package/src/modules/middlewares/client/auth.validation.js +14 -0
  148. package/src/modules/mobile/components/Menu/Menu.vue +1 -1
  149. package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
  150. package/src/modules/organizations/components/elements/ButtonFollow.vue +9 -7
  151. package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +101 -0
  152. package/src/modules/organizations/components/pages/Organization.vue +1 -34
  153. package/src/modules/organizations/components/sections/DetailsTab.vue +86 -8
  154. package/src/modules/organizations/controllers/memberships.controller.js +10 -7
  155. package/src/modules/organizations/controllers/organizations.controller.js +9 -20
  156. package/src/modules/organizations/controllers/utils/addMembersQuantity.js +21 -0
  157. package/src/modules/organizations/controllers/utils/addUserStatusFields.js +65 -0
  158. package/src/modules/organizations/controllers/utils/excludeBlockedMembers.js +18 -0
  159. package/src/modules/organizations/models/membership.model.js +5 -5
  160. package/src/modules/organizations/store/memberships.js +6 -6
  161. package/src/modules/organizations/store/organizations.js +0 -1
  162. package/src/modules/products/products.server.js +5 -0
  163. package/src/modules/reports/components/pages/BackofficeReports.vue +67 -0
  164. package/src/modules/reports/components/sections/FormReport.vue +114 -0
  165. package/src/modules/reports/controllers/reports.controller.js +67 -0
  166. package/src/modules/reports/models/report.model.js +58 -0
  167. package/src/modules/reports/reports.client.js +17 -0
  168. package/src/modules/reports/reports.server.js +13 -0
  169. package/src/modules/reports/routes/reports.routes.js +43 -0
  170. package/src/modules/reports/store/reports.js +118 -0
  171. package/src/modules/users/components/pages/Profile.vue +57 -10
  172. package/src/modules/users/controllers/users.controller.js +6 -19
  173. package/src/styles/base/all.scss +2 -0
  174. package/src/styles/layout.scss +39 -63
  175. package/src/styles/theme.scss +0 -1
  176. package/src/styles/components/popup.scss +0 -55
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./organizations.client-85a2ae66.js"),i=require("./CardOrganization-bf366e4e.js"),t=require("./Socials-821bd677.js"),n=require("./Publics-4438ca51.js"),r=require("./ButtonFollow-7c0180b3.js"),a=require("./organizations-bb8f676d.js");require("vue");require("vue-router");require("vue-i18n");require("./globals-928eb13c.js");require("./Breadcrumbs.vue_vue_type_style_index_0_lang-f3d37f29.js");require("./index-7ecbf72a.js");require("./_plugin-vue_export-helper-f246444f.js");require("./Tab-6f0a4909.js");require("./inputs.validation-24ae76b9.js");require("./Feed-bfd7d1d9.js");require("./EmptyState-7658d7d6.js");require("./Chips-493042f7.js");require("./IconEdit-4cfe2115.js");require("./Button-ee08e6bf.js");require("./Feed-aee74095.js");require("./auth-2f9b2dfc.js");require("./Select.vue_vue_type_style_index_0_scoped_a78dbba1_lang-0ea8fbf8.js");require("./UploadImage-33f6a9f4.js");require("./Select-b9299fb6.js");require("./auth.validation-30bb0efd.js");exports.Contacts=e._sfc_main$9;exports.Department=e._sfc_main$2;exports.DepartmentEdit=e.DepartmentEdit;exports.DepartmentMemberModify=e.DepartmentMemberModify;exports.DepartmentSection=e.Department;exports.DepartmentSub=e.DepartmentSub;exports.DepartmentSubDepartmentModify=e.DepartmentSubDepartmentModify;exports.DetailsTab=e._sfc_main$13;exports.Documents=e.Documents;exports.EditArray=e._sfc_main$6;exports.EmptyState=e._sfc_main$8;exports.MembersAdd=e._sfc_main$11;exports.MembersList=e._sfc_main$15;exports.MembersTab=e._sfc_main$14;exports.Organization=e._sfc_main$1;exports.OrganizationEdit=e._sfc_main$4;exports.Organizations=e._sfc_main$5;exports.OrganizationsAccount=e._sfc_main$3;exports.OrganizationsSection=e._sfc_main$16;exports.Places=e.Places;exports.Rating=e._sfc_main$10;exports.StructureTab=e._sfc_main$12;exports.Unit=e._sfc_main$7;exports.User=e.User;exports.invitesStore=e.invites;exports.organizationsRoutes=e.organizations;exports.CardOrganization=i._sfc_main;exports.Socials=t._sfc_main;exports.Publics=n._sfc_main;exports.ButtonFollow=r.ButtonFollow;exports.membershipsStore=r.memberships;exports.organizationStore=a.organizations;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./organizations.client-292e8444.js"),r=require("./CardOrganization-7d679e75.js"),i=require("./Socials-b19d0cb1.js"),t=require("./Publics-50c0ff6c.js"),n=require("./organizations-a241b21d.js"),a=require("./IconEdit-e4d0cc6e.js");require("vue");require("vue-router");require("vue-i18n");require("./globals-928eb13c.js");require("./Breadcrumbs.vue_vue_type_style_index_0_lang-505c3ca5.js");require("./index-b41aac19.js");require("./_plugin-vue_export-helper-f246444f.js");require("./Tab-6f0a4909.js");require("./inputs.validation-24ae76b9.js");require("./Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js");require("./auth-acbe3ae1.js");require("./ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-0ea8fbf8.js");require("./Feed-66095e66.js");require("./EmptyState-7658d7d6.js");require("./Chips-8d0a1d2c.js");require("./Feed-e55bc6fa.js");require("./Select-3ca5ab39.js");require("./reports-270f69df.js");require("./Button-2ca405bd.js");require("./UploadImage-0f488170.js");require("./auth.validation-495e9d6d.js");require("./click-outside-0b0727d1.js");exports.Contacts=e._sfc_main$9;exports.Department=e._sfc_main$2;exports.DepartmentEdit=e.DepartmentEdit;exports.DepartmentMemberModify=e.DepartmentMemberModify;exports.DepartmentSection=e.Department;exports.DepartmentSub=e.DepartmentSub;exports.DepartmentSubDepartmentModify=e.DepartmentSubDepartmentModify;exports.DetailsTab=e._sfc_main$13;exports.Documents=e.Documents;exports.EditArray=e._sfc_main$6;exports.EmptyState=e._sfc_main$8;exports.MembersAdd=e._sfc_main$11;exports.MembersList=e._sfc_main$15;exports.MembersTab=e._sfc_main$14;exports.Organization=e._sfc_main$1;exports.OrganizationEdit=e._sfc_main$4;exports.Organizations=e._sfc_main$5;exports.OrganizationsAccount=e._sfc_main$3;exports.OrganizationsSection=e._sfc_main$16;exports.Places=e.Places;exports.Rating=e._sfc_main$10;exports.StructureTab=e._sfc_main$12;exports.Unit=e._sfc_main$7;exports.User=e.User;exports.invitesStore=e.invites;exports.organizationsRoutes=e.organizations;exports.ButtonFollow=r.ButtonFollow;exports.CardOrganization=r._sfc_main;exports.Socials=i._sfc_main$1;exports.Publics=t._sfc_main;exports.organizationStore=n.organizations;exports.membershipsStore=a.memberships;
@@ -1,60 +1,62 @@
1
- import { o as O, e as y, D as A, l as E, x as P, k as T, m as U, t as _, v as h, i as v, n as w, q as B, w as C, u as R, d as j, g as k, h as q, f as F, y as L, P as G, p as H, r as I, j as J, U as K, z as N, A as Q } from "./organizations.client-39196bef.mjs";
2
- import { _ as W } from "./CardOrganization-3f4a13d3.mjs";
3
- import { _ as Y } from "./Socials-8193477c.mjs";
4
- import { _ as $ } from "./Publics-538180a8.mjs";
5
- import { B as at, b as rt } from "./ButtonFollow-00d85977.mjs";
6
- import { o as it } from "./organizations-aed4245d.mjs";
1
+ import { o as A, e as E, D as P, l as T, x as U, k as h, m as v, t as w, v as B, i as C, n as R, q as _, w as j, u as k, d as q, g as F, h as L, f as G, y as H, P as I, p as J, r as K, j as N, U as Q, z as V, A as W } from "./organizations.client-6fc91683.mjs";
2
+ import { B as Y, _ as Z } from "./CardOrganization-18c1e3fa.mjs";
3
+ import { a as tt } from "./Socials-3fe01af1.mjs";
4
+ import { _ as rt } from "./Publics-f34131bf.mjs";
5
+ import { o as it } from "./organizations-ea9de495.mjs";
6
+ import { c as et } from "./IconEdit-c98d3d06.mjs";
7
7
  import "vue";
8
8
  import "vue-router";
9
9
  import "vue-i18n";
10
10
  import "./globals-96ba60e4.mjs";
11
- import "./Breadcrumbs.vue_vue_type_style_index_0_lang-19e23006.mjs";
12
- import "./index-0ab9d59c.mjs";
11
+ import "./Breadcrumbs.vue_vue_type_style_index_0_lang-b1873cb7.mjs";
12
+ import "./index-a661083c.mjs";
13
13
  import "./_plugin-vue_export-helper-dad06003.mjs";
14
14
  import "./Tab-a243605d.mjs";
15
15
  import "./inputs.validation-14e8e01f.mjs";
16
- import "./Feed-27f62b1c.mjs";
16
+ import "./Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs";
17
+ import "./auth-98fe3efb.mjs";
18
+ import "./ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-4ed993c7.mjs";
19
+ import "./Feed-ef6c6ca3.mjs";
17
20
  import "./EmptyState-34d85f10.mjs";
18
- import "./Chips-9cf6c0da.mjs";
19
- import "./IconEdit-eacf3856.mjs";
20
- import "./Button-d8e72ac0.mjs";
21
- import "./Feed-7c8c901a.mjs";
22
- import "./auth-b047fdc0.mjs";
23
- import "./Select.vue_vue_type_style_index_0_scoped_a78dbba1_lang-4ed993c7.mjs";
24
- import "./UploadImage-f7b0335f.mjs";
25
- import "./Select-90d4b7c8.mjs";
26
- import "./auth.validation-2cdd2231.mjs";
21
+ import "./Chips-2ada5eda.mjs";
22
+ import "./Feed-76fc4475.mjs";
23
+ import "./Select-11ddabf5.mjs";
24
+ import "./reports-79cd9459.mjs";
25
+ import "./Button-c59d387c.mjs";
26
+ import "./UploadImage-3c627d89.mjs";
27
+ import "./auth.validation-e265b496.mjs";
28
+ import "./click-outside-6101836c.mjs";
27
29
  export {
28
- at as ButtonFollow,
29
- W as CardOrganization,
30
- O as Contacts,
31
- y as Department,
32
- A as DepartmentEdit,
33
- E as DepartmentMemberModify,
34
- P as DepartmentSection,
35
- T as DepartmentSub,
36
- U as DepartmentSubDepartmentModify,
37
- _ as DetailsTab,
38
- h as Documents,
39
- v as EditArray,
40
- w as EmptyState,
41
- B as MembersAdd,
42
- C as MembersList,
43
- R as MembersTab,
44
- j as Organization,
45
- k as OrganizationEdit,
46
- q as Organizations,
47
- F as OrganizationsAccount,
48
- L as OrganizationsSection,
49
- G as Places,
50
- $ as Publics,
51
- H as Rating,
52
- Y as Socials,
53
- I as StructureTab,
54
- J as Unit,
55
- K as User,
56
- N as invitesStore,
57
- rt as membershipsStore,
30
+ Y as ButtonFollow,
31
+ Z as CardOrganization,
32
+ A as Contacts,
33
+ E as Department,
34
+ P as DepartmentEdit,
35
+ T as DepartmentMemberModify,
36
+ U as DepartmentSection,
37
+ h as DepartmentSub,
38
+ v as DepartmentSubDepartmentModify,
39
+ w as DetailsTab,
40
+ B as Documents,
41
+ C as EditArray,
42
+ R as EmptyState,
43
+ _ as MembersAdd,
44
+ j as MembersList,
45
+ k as MembersTab,
46
+ q as Organization,
47
+ F as OrganizationEdit,
48
+ L as Organizations,
49
+ G as OrganizationsAccount,
50
+ H as OrganizationsSection,
51
+ I as Places,
52
+ rt as Publics,
53
+ J as Rating,
54
+ tt as Socials,
55
+ K as StructureTab,
56
+ N as Unit,
57
+ Q as User,
58
+ V as invitesStore,
59
+ et as membershipsStore,
58
60
  it as organizationStore,
59
- Q as organizationsRoutes
61
+ W as organizationsRoutes
60
62
  };
@@ -6,6 +6,8 @@ require("bcryptjs");
6
6
  require("uuidv4");
7
7
  const require$$1 = require("mongoose");
8
8
  const require$$5 = require("@googlemaps/google-maps-services-js");
9
+ const addMembersQuantity$1 = require("./addMembersQuantity-f922d82b.js");
10
+ require("mongodb");
9
11
  const controllerFactory$5 = (db) => {
10
12
  const Department = db.department;
11
13
  const readOne = (req, res) => {
@@ -73,6 +75,8 @@ const jwt = require$$0;
73
75
  const ObjectId = require$$1.Types.ObjectId;
74
76
  const { Client } = require$$5;
75
77
  const client = new Client({});
78
+ const addUserStatusFields = addMembersQuantity$1.addUserStatusFields_1;
79
+ const addMembersQuantity = addMembersQuantity$1.addMembersQuantity_1;
76
80
  const controllerFactory$4 = (db) => {
77
81
  const Organization = db.organization;
78
82
  const Membership = db.membership;
@@ -200,24 +204,8 @@ const controllerFactory$4 = (db) => {
200
204
  as: "memberships"
201
205
  }
202
206
  },
203
- {
204
- $addFields: {
205
- numberOfMemberships: { $size: "$memberships" }
206
- }
207
- },
208
- {
209
- $addFields: {
210
- isMember: {
211
- $cond: {
212
- if: req.query.user,
213
- then: {
214
- $in: [new ObjectId(req.query.user), "$memberships.user"]
215
- },
216
- else: "$$REMOVE"
217
- }
218
- }
219
- }
220
- },
207
+ addMembersQuantity(),
208
+ addUserStatusFields(req.query.user),
221
209
  {
222
210
  $addFields: {
223
211
  numberOfProducts: { $size: "$products" }
@@ -234,9 +222,11 @@ const controllerFactory$4 = (db) => {
234
222
  rating: 1,
235
223
  socials: 1,
236
224
  numberOfProducts: 1,
237
- numberOfMemberships: 1,
225
+ numberOfSubscribers: 1,
238
226
  memberships: 1,
239
227
  isMember: 1,
228
+ isSubscriber: 1,
229
+ isBlocked: 1,
240
230
  departments: 1
241
231
  }
242
232
  },
@@ -377,6 +367,7 @@ const controllerFactory$3 = (db) => {
377
367
  }
378
368
  };
379
369
  const create = async (req, res) => {
370
+ console.log(req.body);
380
371
  const newMembership = new Membership({
381
372
  user: req.body.user,
382
373
  type: req.body.type,
@@ -402,15 +393,16 @@ const controllerFactory$3 = (db) => {
402
393
  }
403
394
  };
404
395
  const deleteMembership = async (req, res) => {
405
- const { type, target, user: user2 } = req.body;
396
+ const { type, target, user: user2, role } = req.body;
397
+ console.log(req.body);
406
398
  try {
407
- const membership = await Membership.findOne({ type, target, user: user2 });
399
+ const membership = await Membership.findOne({ type, target, user: user2, role });
408
400
  if (!membership) {
409
401
  return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
402
+ } else {
403
+ await Membership.deleteOne({ _id: membership._id });
404
+ res.status(200).send(membership);
410
405
  }
411
- console.log(membership);
412
- await membership.remove();
413
- res.status(200).send(membership);
414
406
  } catch (error) {
415
407
  console.log(error);
416
408
  res.status(500).send({ errorCode: "SERVER_ERROR" });
@@ -642,6 +634,10 @@ var membership_model = (mongoose) => {
642
634
  default: "organization",
643
635
  required: true
644
636
  },
637
+ role: {
638
+ type: String,
639
+ default: "subscriber"
640
+ },
645
641
  target: {
646
642
  // заменяем 'organization' на 'target', так как это может быть или User, или Organization
647
643
  type: mongoose.Schema.Types.ObjectId,
@@ -652,10 +648,6 @@ var membership_model = (mongoose) => {
652
648
  return "Organization";
653
649
  },
654
650
  required: true
655
- },
656
- role: {
657
- type: String,
658
- default: "subscriber"
659
651
  }
660
652
  });
661
653
  const Membership = mongoose.model("Membership", MembershipSchema);
@@ -5,6 +5,8 @@ import "bcryptjs";
5
5
  import "uuidv4";
6
6
  import require$$1 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-ea216f92.mjs";
9
+ import "mongodb";
8
10
  const controllerFactory$5 = (db) => {
9
11
  const Department = db.department;
10
12
  const readOne = (req, res) => {
@@ -72,6 +74,8 @@ const jwt = require$$0;
72
74
  const ObjectId = require$$1.Types.ObjectId;
73
75
  const { Client } = require$$5;
74
76
  const client = new Client({});
77
+ const addUserStatusFields = addUserStatusFields_1;
78
+ const addMembersQuantity = addMembersQuantity_1;
75
79
  const controllerFactory$4 = (db) => {
76
80
  const Organization = db.organization;
77
81
  const Membership = db.membership;
@@ -199,24 +203,8 @@ const controllerFactory$4 = (db) => {
199
203
  as: "memberships"
200
204
  }
201
205
  },
202
- {
203
- $addFields: {
204
- numberOfMemberships: { $size: "$memberships" }
205
- }
206
- },
207
- {
208
- $addFields: {
209
- isMember: {
210
- $cond: {
211
- if: req.query.user,
212
- then: {
213
- $in: [new ObjectId(req.query.user), "$memberships.user"]
214
- },
215
- else: "$$REMOVE"
216
- }
217
- }
218
- }
219
- },
206
+ addMembersQuantity(),
207
+ addUserStatusFields(req.query.user),
220
208
  {
221
209
  $addFields: {
222
210
  numberOfProducts: { $size: "$products" }
@@ -233,9 +221,11 @@ const controllerFactory$4 = (db) => {
233
221
  rating: 1,
234
222
  socials: 1,
235
223
  numberOfProducts: 1,
236
- numberOfMemberships: 1,
224
+ numberOfSubscribers: 1,
237
225
  memberships: 1,
238
226
  isMember: 1,
227
+ isSubscriber: 1,
228
+ isBlocked: 1,
239
229
  departments: 1
240
230
  }
241
231
  },
@@ -376,6 +366,7 @@ const controllerFactory$3 = (db) => {
376
366
  }
377
367
  };
378
368
  const create = async (req, res) => {
369
+ console.log(req.body);
379
370
  const newMembership = new Membership({
380
371
  user: req.body.user,
381
372
  type: req.body.type,
@@ -401,15 +392,16 @@ const controllerFactory$3 = (db) => {
401
392
  }
402
393
  };
403
394
  const deleteMembership = async (req, res) => {
404
- const { type, target, user: user2 } = req.body;
395
+ const { type, target, user: user2, role } = req.body;
396
+ console.log(req.body);
405
397
  try {
406
- const membership = await Membership.findOne({ type, target, user: user2 });
398
+ const membership = await Membership.findOne({ type, target, user: user2, role });
407
399
  if (!membership) {
408
400
  return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
401
+ } else {
402
+ await Membership.deleteOne({ _id: membership._id });
403
+ res.status(200).send(membership);
409
404
  }
410
- console.log(membership);
411
- await membership.remove();
412
- res.status(200).send(membership);
413
405
  } catch (error) {
414
406
  console.log(error);
415
407
  res.status(500).send({ errorCode: "SERVER_ERROR" });
@@ -641,6 +633,10 @@ var membership_model = (mongoose) => {
641
633
  default: "organization",
642
634
  required: true
643
635
  },
636
+ role: {
637
+ type: String,
638
+ default: "subscriber"
639
+ },
644
640
  target: {
645
641
  // заменяем 'organization' на 'target', так как это может быть или User, или Organization
646
642
  type: mongoose.Schema.Types.ObjectId,
@@ -651,10 +647,6 @@ var membership_model = (mongoose) => {
651
647
  return "Organization";
652
648
  },
653
649
  required: true
654
- },
655
- role: {
656
- type: String,
657
- default: "subscriber"
658
650
  }
659
651
  });
660
652
  const Membership = mongoose.model("Membership", MembershipSchema);