@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.
- package/dist/BackofficeGallery-02c9721b.mjs +304 -0
- package/dist/BackofficeGallery-1d117a40.js +1 -0
- package/dist/BackofficeReports-cb4b180d.mjs +44 -0
- package/dist/BackofficeReports-d021871f.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-505c3ca5.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-b1873cb7.mjs +1945 -0
- package/dist/Button-2ca405bd.js +1 -0
- package/dist/Button-c59d387c.mjs +283 -0
- package/dist/Button.vue_vue_type_style_index_0_lang-0ea8fbf8.js +1 -0
- package/dist/Button.vue_vue_type_style_index_0_lang-4ed993c7.mjs +1 -0
- package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-0ea8fbf8.js +1 -0
- package/dist/ButtonFollow.vue_vue_type_style_index_0_scoped_0634d4a1_lang-4ed993c7.mjs +1 -0
- package/dist/CardOrganization-18c1e3fa.mjs +297 -0
- package/dist/CardOrganization-7d679e75.js +1 -0
- package/dist/Chips-2ada5eda.mjs +200 -0
- package/dist/Chips-8d0a1d2c.js +1 -0
- package/dist/Dashboard-239fb7a6.mjs +52 -0
- package/dist/Dashboard-94267906.js +1 -0
- package/dist/EULA-8265b0cf.mjs +4218 -0
- package/dist/EULA-cbb27503.js +1 -0
- package/dist/Feed-66095e66.js +1 -0
- package/dist/Feed-76fc4475.mjs +383 -0
- package/dist/Feed-e55bc6fa.js +1 -0
- package/dist/Feed-ef6c6ca3.mjs +371 -0
- package/dist/IconEdit-c98d3d06.mjs +339 -0
- package/dist/IconEdit-e4d0cc6e.js +1 -0
- package/dist/Image-052a3cc2.mjs +480 -0
- package/dist/Image-c90ee624.js +9 -0
- package/dist/MenuItem-0b249b94.mjs +93 -0
- package/dist/MenuItem-8b70d2cf.js +1 -0
- package/dist/Product-4b58701f.js +7 -0
- package/dist/Product-a6251018.mjs +844 -0
- package/dist/ProductEdit-3ff2af92.js +1 -0
- package/dist/ProductEdit-f901314c.mjs +306 -0
- package/dist/ProfileBlogposts-57931834.mjs +70 -0
- package/dist/ProfileBlogposts-af88ce98.js +1 -0
- package/dist/ProfileEvents-588eadf9.js +1 -0
- package/dist/ProfileEvents-ed7f9603.mjs +62 -0
- package/dist/ProfileOrganizations-7911deec.mjs +219 -0
- package/dist/ProfileOrganizations-ae258581.js +1 -0
- package/dist/Publics-50c0ff6c.js +1 -0
- package/dist/Publics-f34131bf.mjs +45 -0
- package/dist/Select-11ddabf5.mjs +79 -0
- package/dist/Select-3ca5ab39.js +1 -0
- package/dist/Socials-3fe01af1.mjs +275 -0
- package/dist/Socials-b19d0cb1.js +1 -0
- package/dist/addMembersQuantity-ea216f92.mjs +85 -0
- package/dist/addMembersQuantity-f922d82b.js +84 -0
- package/dist/auth-98fe3efb.mjs +612 -0
- package/dist/auth-acbe3ae1.js +7 -0
- package/dist/auth.client.cjs +7 -8
- package/dist/auth.client.js +449 -441
- package/dist/auth.validation-495e9d6d.js +1 -0
- package/dist/auth.validation-e265b496.mjs +23 -0
- package/dist/backoffice.client.cjs +1 -1
- package/dist/backoffice.client.js +55 -28
- package/dist/click-outside-0b0727d1.js +2 -0
- package/dist/click-outside-6101836c.mjs +19 -0
- package/dist/community.client.cjs +1 -1
- package/dist/community.client.js +121 -121
- package/dist/community.server.js +35 -5
- package/dist/community.server.mjs +35 -5
- package/dist/components/Button/Button.vue.d.ts +3 -0
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/CardHeader/CardHeader.vue.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/Field/Field.vue.d.ts +1 -1
- package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
- package/dist/components/Popup/Popup.vue.d.ts +2 -1
- package/dist/components/Popup/Popup.vue.d.ts.map +1 -1
- package/dist/components/Select/Select.vue.d.ts +1 -1
- package/dist/components/Select/Select.vue.d.ts.map +1 -1
- package/dist/components/Upload/Upload.vue.d.ts +1 -1
- package/dist/events.client.cjs +2 -2
- package/dist/events.client.js +219 -217
- package/dist/events.server.js +2 -9
- package/dist/events.server.mjs +2 -9
- package/dist/legal.client.cjs +1 -1
- package/dist/legal.client.js +2565 -2545
- package/dist/main.css +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/modules/backoffice/components/pages/Dashboard.vue.d.ts +6 -0
- package/dist/modules/icons/navigation/IconCross.vue.d.ts +4 -0
- package/dist/modules/legal/components/pages/legal/EULA.vue.d.ts +2 -0
- package/dist/modules/organizations/components/elements/ButtonFollow.vue.d.ts +1 -1
- package/dist/modules/organizations/components/elements/ButtonToggleMembership.vue.d.ts +12 -0
- package/dist/modules/organizations/components/sections/DetailsTab.vue.d.ts +2 -58
- package/dist/modules/organizations/components/sections/Feed.vue.d.ts +1 -1
- package/dist/modules/reports/components/pages/BackofficeReports.vue.d.ts +2 -0
- package/dist/modules/reports/components/sections/FormReport.vue.d.ts +75 -0
- package/dist/modules/reports/store/reports.d.ts +41 -0
- package/dist/organizations-a241b21d.js +1 -0
- package/dist/organizations-ea9de495.mjs +122 -0
- package/dist/organizations.client-292e8444.js +3 -0
- package/dist/organizations.client-6fc91683.mjs +3072 -0
- package/dist/organizations.client.cjs +1 -1
- package/dist/organizations.client.js +51 -49
- package/dist/organizations.server.js +20 -28
- package/dist/organizations.server.mjs +20 -28
- package/dist/prometheus-framework.cjs.js +19 -19
- package/dist/prometheus-framework.es.js +1635 -1608
- package/dist/reports-270f69df.js +1 -0
- package/dist/reports-79cd9459.mjs +91 -0
- package/dist/reports.client.cjs +1 -0
- package/dist/reports.client.js +8 -0
- package/dist/reports.server.js +159 -0
- package/dist/reports.server.mjs +160 -0
- package/dist/states.validation-02ba0aee.js +1 -0
- package/dist/states.validation-e5f4fa3a.mjs +13 -0
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +286 -242
- package/dist/users.server.js +6 -18
- package/dist/users.server.mjs +6 -18
- package/package.json +9 -1
- package/src/components/Button/Button.vue +66 -60
- package/src/components/CardHeader/CardHeader.vue +51 -50
- package/src/components/Dropdown/Dropdown.vue +28 -12
- package/src/components/FieldPhone/click-outside.js +0 -48
- package/src/components/Popup/Popup.vue +74 -23
- package/src/components/Select/Select.vue +10 -6
- package/src/main.ts +1 -1
- package/src/modules/auth/components/pages/EnterPassword.vue +13 -1
- package/src/modules/auth/components/pages/SignIn.vue +7 -1
- package/src/modules/auth/router/auth.js +1 -1
- package/src/modules/auth/store/auth.js +1 -1
- package/src/modules/backoffice/components/layouts/Backoffice.vue +3 -3
- package/src/modules/backoffice/components/pages/Dashboard.vue +62 -0
- package/src/modules/backoffice/router/backoffice.js +26 -0
- package/src/modules/community/components/blocks/CardBlogpost.vue +3 -0
- package/src/modules/community/components/layouts/Community.vue +4 -4
- package/src/modules/community/components/pages/CreateBlogPost.vue +27 -28
- package/src/modules/community/components/sections/Comments.vue +4 -2
- package/src/modules/community/components/sections/Feed.vue +1 -1
- package/src/modules/community/controllers/blog.controller.js +22 -3
- package/src/modules/community/controllers/comments.controller.js +23 -5
- package/src/modules/events/components/blocks/CardEvent.vue +4 -0
- package/src/modules/events/components/pages/EditEvent.vue +27 -28
- package/src/modules/events/components/sections/Feed.vue +1 -1
- package/src/modules/events/controllers/events.controller.js +3 -10
- package/src/modules/gallery/components/sections/BackofficeGallery.vue +7 -23
- package/src/modules/icons/navigation/IconCross.vue +22 -0
- package/src/modules/legal/components/pages/Legal.vue +3 -0
- package/src/modules/legal/components/pages/legal/EULA.vue +2148 -0
- package/src/modules/legal/router/legal.js +11 -4
- package/src/modules/middlewares/client/auth.validation.js +14 -0
- package/src/modules/mobile/components/Menu/Menu.vue +1 -1
- package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
- package/src/modules/organizations/components/elements/ButtonFollow.vue +9 -7
- package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +101 -0
- package/src/modules/organizations/components/pages/Organization.vue +1 -34
- package/src/modules/organizations/components/sections/DetailsTab.vue +86 -8
- package/src/modules/organizations/controllers/memberships.controller.js +10 -7
- package/src/modules/organizations/controllers/organizations.controller.js +9 -20
- package/src/modules/organizations/controllers/utils/addMembersQuantity.js +21 -0
- package/src/modules/organizations/controllers/utils/addUserStatusFields.js +65 -0
- package/src/modules/organizations/controllers/utils/excludeBlockedMembers.js +18 -0
- package/src/modules/organizations/models/membership.model.js +5 -5
- package/src/modules/organizations/store/memberships.js +6 -6
- package/src/modules/organizations/store/organizations.js +0 -1
- package/src/modules/products/products.server.js +5 -0
- package/src/modules/reports/components/pages/BackofficeReports.vue +67 -0
- package/src/modules/reports/components/sections/FormReport.vue +114 -0
- package/src/modules/reports/controllers/reports.controller.js +67 -0
- package/src/modules/reports/models/report.model.js +58 -0
- package/src/modules/reports/reports.client.js +17 -0
- package/src/modules/reports/reports.server.js +13 -0
- package/src/modules/reports/routes/reports.routes.js +43 -0
- package/src/modules/reports/store/reports.js +118 -0
- package/src/modules/users/components/pages/Profile.vue +57 -10
- package/src/modules/users/controllers/users.controller.js +6 -19
- package/src/styles/base/all.scss +2 -0
- package/src/styles/layout.scss +39 -63
- package/src/styles/theme.scss +0 -1
- 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-
|
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
|
2
|
-
import { _ as
|
3
|
-
import {
|
4
|
-
import { _ as
|
5
|
-
import {
|
6
|
-
import {
|
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-
|
12
|
-
import "./index-
|
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 "./
|
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-
|
19
|
-
import "./
|
20
|
-
import "./
|
21
|
-
import "./
|
22
|
-
import "./
|
23
|
-
import "./
|
24
|
-
import "./
|
25
|
-
import "./
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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);
|