@ozdao/prometheus-framework 0.2.48 → 0.2.51
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +27 -25
- package/dist/auth.server.mjs +27 -25
- package/dist/community.server.js +1 -1
- package/dist/community.server.mjs +1 -1
- package/dist/events.server.js +1 -1
- package/dist/events.server.mjs +1 -1
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +1 -1
- package/dist/gallery.server.mjs +1 -1
- package/dist/index-3981e903.mjs +217 -0
- package/dist/index-4eecfdb9.js +216 -0
- package/dist/main-203b36b6.mjs +13628 -0
- package/dist/main-_b1_i8mt.mjs +13606 -0
- package/dist/main-a7ae4ce5.js +91 -0
- package/dist/main-uiQFxEks.js +91 -0
- package/dist/main.css +1 -1
- package/dist/middlewares.server.js +1 -1
- package/dist/middlewares.server.mjs +1 -1
- package/dist/node_modules/vue-select/dist/vue-select.es.cjs +1 -3
- package/dist/node_modules/vue-select/dist/vue-select.es.js +49 -645
- package/dist/organizations.server.js +35 -43
- package/dist/organizations.server.mjs +35 -43
- package/dist/products.server.js +107 -24
- package/dist/products.server.mjs +107 -24
- package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue.js +2 -225
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +225 -2
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue.js +61 -2
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Checkbox/Checkbox.vue2.js +2 -61
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +2 -76
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +76 -2
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/components/SelectMulti/SelectMulti.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/SelectMulti/SelectMulti.vue.js +6 -6
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +2 -44
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +44 -2
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +44 -32
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/auth.js +45 -44
- package/dist/prometheus-framework/src/modules/auth/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/invites.js +5 -5
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/store/globals.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/store/globals.js +22 -21
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +11 -2
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +2 -11
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormOrderDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +17 -17
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +49 -42
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.js +48 -15
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +38 -37
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +249 -61
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +78 -45
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +160 -86
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +52 -54
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +20 -26
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -46
- package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.js +34 -30
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +30 -28
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +18 -18
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Product.vue.js +33 -28
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +123 -113
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductsBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +1 -1
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/reports.server.js +1 -1
- package/dist/reports.server.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/web-7p76PGnO.mjs +55 -0
- package/dist/web-c63f0ecc.js +1 -0
- package/dist/web-d8173758.mjs +55 -0
- package/dist/web-dn8vgptQ.js +1 -0
- package/package.json +1 -1
- package/src/components/SelectMulti/SelectMulti.vue +1 -1
- package/src/modules/auth/components/pages/Invite.vue +17 -6
- package/src/modules/auth/controllers/auth.controller.js +24 -16
- package/src/modules/auth/controllers/invites.controller.js +17 -8
- package/src/modules/auth/store/auth.js +8 -1
- package/src/modules/auth/store/invites.js +1 -0
- package/src/modules/globals/store/globals.js +5 -1
- package/src/modules/landing/components/blocks/MapBlock.vue +37 -0
- package/src/modules/landing/components/pages/404.vue +3 -0
- package/src/modules/landing/components/pages/Governance.vue +155 -0
- package/src/modules/landing/components/pages/Home.vue +52 -0
- package/src/modules/landing/components/pages/Hotel.vue +54 -0
- package/src/modules/landing/components/pages/Page.vue +184 -0
- package/src/modules/landing/components/sections/AboutSection.vue +69 -0
- package/src/modules/landing/components/sections/Examples.vue +90 -0
- package/src/modules/landing/components/sections/FeatureSection.vue +80 -0
- package/src/modules/landing/components/sections/GiftSection.vue +63 -0
- package/src/modules/landing/components/sections/HeroSection.vue +74 -0
- package/src/modules/landing/components/sections/HowItWorksSection.vue +88 -0
- package/src/modules/landing/components/sections/HowToBuyWDR.vue +131 -0
- package/src/modules/landing/components/sections/InstagramSection.vue +181 -0
- package/src/modules/landing/components/sections/MapSection.vue +91 -0
- package/src/modules/landing/components/sections/SectionsSection.vue +69 -0
- package/src/modules/landing/components/sections/SliderFeatures.vue +131 -0
- package/src/modules/landing/components/sections/WhatIsWDRSection.vue +116 -0
- package/src/modules/landing/router/landing.js +34 -0
- package/src/modules/middlewares/server/verifySignUp.js +4 -0
- package/src/modules/mobile/components/BottomNavigation/BottomNavigation.vue +86 -0
- package/src/modules/mobile/components/BottomSheet/BottomSheet.vue +86 -0
- package/src/modules/mobile/components/NavigationBar/NavigationBar.vue +132 -0
- package/src/modules/mobile/components/Walkthrough/Walkthrough.vue +195 -0
- package/src/modules/organizations/components/blocks/CardDepartment.vue +3 -3
- package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +52 -44
- package/src/modules/organizations/components/blocks/User.vue +42 -10
- package/src/modules/organizations/components/pages/Department.vue +7 -6
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +110 -134
- package/src/modules/organizations/components/pages/Members.vue +85 -26
- package/src/modules/organizations/components/pages/Organization.vue +59 -4
- package/src/modules/organizations/components/sections/MembersAdd.vue +27 -34
- package/src/modules/organizations/components/sections/Organizations.vue +0 -1
- package/src/modules/organizations/controllers/memberships.controller.js +33 -26
- package/src/modules/organizations/controllers/organizations.controller.js +1 -1
- package/src/modules/organizations/models/department.model.js +0 -19
- package/src/modules/organizations/models/membership.model.js +4 -0
- package/src/modules/organizations/organizations.client.js +1 -6
- package/src/modules/organizations/store/departments.js +48 -44
- package/src/modules/organizations/store/memberships.js +11 -3
- package/src/modules/products/components/blocks/CardPosition.vue +2 -2
- package/src/modules/products/components/pages/Product.vue +6 -1
- package/src/modules/products/components/pages/ProductEdit.vue +48 -28
- package/src/modules/products/controllers/products.controller.js +99 -33
- package/src/modules/products/models/product.model.js +16 -1
- package/src/modules/products/store/products.js +1 -1
- package/src/modules/users/components/pages/ProfileOrganizations.vue +41 -7
- package/src/styles/layout.scss +1 -1
- package/src/modules/organizations/components/sections/FeedDepartments.vue +0 -64
- package/src/modules/organizations/components/sections/MembersList.vue +0 -85
- package/src/modules/organizations/store/invites.js +0 -93
@@ -72,7 +72,7 @@ const controllerFactory$5 = (db) => {
|
|
72
72
|
};
|
73
73
|
var departments_controller = controllerFactory$5;
|
74
74
|
const jwt = require$$0$1;
|
75
|
-
const ObjectId$
|
75
|
+
const ObjectId$2 = require$$0.Types.ObjectId;
|
76
76
|
const { Client } = require$$5;
|
77
77
|
const client = new Client({});
|
78
78
|
const addUserStatusFields = addMembersQuantity$1.addUserStatusFields_1;
|
@@ -116,15 +116,15 @@ const controllerFactory$4 = (db) => {
|
|
116
116
|
}));
|
117
117
|
}
|
118
118
|
const matchConditions = [
|
119
|
-
...req.query._id ? [{ _id: new ObjectId$
|
120
|
-
...req.query.owner ? [{ owner: new ObjectId$
|
121
|
-
...req.query.member ? [{ "memberships.user": new ObjectId$
|
122
|
-
...req.query.subscriber ? [{ "memberships.user": new ObjectId$
|
123
|
-
...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$
|
119
|
+
...req.query._id ? [{ _id: new ObjectId$2(req.query._id) }] : [],
|
120
|
+
...req.query.owner ? [{ owner: new ObjectId$2(req.query.owner) }] : [],
|
121
|
+
...req.query.member ? [{ "memberships.user": new ObjectId$2(req.query.member), "memberships.role": "member" }] : [],
|
122
|
+
...req.query.subscriber ? [{ "memberships.user": new ObjectId$2(req.query.subscriber), "memberships.role": "subscriber" }] : [],
|
123
|
+
...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$2(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$2(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
|
124
124
|
...req.query.types ? [{ types: { $in: req.query.types } }] : [],
|
125
125
|
// Если req.query.types - строка
|
126
126
|
// to remove
|
127
|
-
...req.query.onlyuser ? [{ "memberships.user": new ObjectId$
|
127
|
+
...req.query.onlyuser ? [{ "memberships.user": new ObjectId$2(req.query.onlyuser) }] : [],
|
128
128
|
...categories.length > 0 ? [{ "products.category": { $in: categories } }] : [],
|
129
129
|
...delivery.length > 0 ? [{ "spots.delivery": { $all: delivery } }] : [],
|
130
130
|
...priceConditions.length > 0 ? [{ $or: priceConditions }] : [],
|
@@ -425,26 +425,33 @@ const controllerFactory$4 = (db) => {
|
|
425
425
|
};
|
426
426
|
};
|
427
427
|
var organizations_controller = controllerFactory$4;
|
428
|
+
const ObjectId$1 = require$$0.Types.ObjectId;
|
428
429
|
const controllerFactory$3 = (db) => {
|
429
430
|
const Membership = db.membership;
|
430
431
|
const read = async (req, res) => {
|
431
|
-
let query = {};
|
432
|
-
let options = {};
|
433
|
-
if (req.query.user) {
|
434
|
-
query.user = req.query.user;
|
435
|
-
}
|
436
|
-
if (req.query.type) {
|
437
|
-
query.type = req.query.type;
|
438
|
-
}
|
439
|
-
if (req.query.target) {
|
440
|
-
query.target = req.query.target;
|
441
|
-
}
|
442
|
-
if (req.query.role) {
|
443
|
-
query.role = req.query.role;
|
444
|
-
}
|
445
432
|
try {
|
446
|
-
const memberships = await Membership.
|
447
|
-
|
433
|
+
const memberships = await Membership.aggregate([
|
434
|
+
{
|
435
|
+
$match: {
|
436
|
+
...req.query.user && { user: req.query.user },
|
437
|
+
...req.query.type && { type: req.query.type },
|
438
|
+
...req.query.target && { target: req.query.target },
|
439
|
+
...req.query.role && { role: req.query.role }
|
440
|
+
}
|
441
|
+
},
|
442
|
+
{
|
443
|
+
$lookup: {
|
444
|
+
from: "users",
|
445
|
+
localField: "user",
|
446
|
+
foreignField: "_id",
|
447
|
+
as: "user"
|
448
|
+
}
|
449
|
+
},
|
450
|
+
{
|
451
|
+
$unwind: "$user"
|
452
|
+
}
|
453
|
+
]);
|
454
|
+
if (!memberships || memberships.length === 0) {
|
448
455
|
return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
|
449
456
|
}
|
450
457
|
res.send(memberships);
|
@@ -480,10 +487,9 @@ const controllerFactory$3 = (db) => {
|
|
480
487
|
}
|
481
488
|
};
|
482
489
|
const deleteMembership = async (req, res) => {
|
483
|
-
const { type, target, user: user2, role } = req.body;
|
484
490
|
console.log(req.body);
|
485
491
|
try {
|
486
|
-
const membership = await Membership.
|
492
|
+
const membership = await Membership.findOneAndDelete({ _id: new ObjectId$1(req.body._id) });
|
487
493
|
if (!membership) {
|
488
494
|
return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
|
489
495
|
} else {
|
@@ -592,23 +598,6 @@ var department_model = (mongoose) => {
|
|
592
598
|
description: { type: String },
|
593
599
|
categories: [String]
|
594
600
|
},
|
595
|
-
// Working hours
|
596
|
-
address: String,
|
597
|
-
// Position on map
|
598
|
-
location: {
|
599
|
-
lat: Number,
|
600
|
-
lng: Number,
|
601
|
-
type: {
|
602
|
-
type: String,
|
603
|
-
enum: ["Point"],
|
604
|
-
// 'location.type' must be 'Point'
|
605
|
-
required: true
|
606
|
-
},
|
607
|
-
coordinates: {
|
608
|
-
type: [Number],
|
609
|
-
required: true
|
610
|
-
}
|
611
|
-
},
|
612
601
|
worktime: [{
|
613
602
|
day: String,
|
614
603
|
time: {
|
@@ -639,7 +628,6 @@ var department_model = (mongoose) => {
|
|
639
628
|
]
|
640
629
|
});
|
641
630
|
departmentSchema.index({ organization: 1 });
|
642
|
-
departmentSchema.index({ location: "2dsphere" });
|
643
631
|
const Department = mongoose.model("Department", departmentSchema);
|
644
632
|
return Department;
|
645
633
|
};
|
@@ -727,6 +715,10 @@ var membership_model = (mongoose) => {
|
|
727
715
|
type: String,
|
728
716
|
default: "subscriber"
|
729
717
|
},
|
718
|
+
label: {
|
719
|
+
type: String,
|
720
|
+
default: "subscriber"
|
721
|
+
},
|
730
722
|
target: {
|
731
723
|
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
732
724
|
type: mongoose.Schema.Types.ObjectId,
|
@@ -71,7 +71,7 @@ const controllerFactory$5 = (db) => {
|
|
71
71
|
};
|
72
72
|
var departments_controller = controllerFactory$5;
|
73
73
|
const jwt = require$$0$1;
|
74
|
-
const ObjectId$
|
74
|
+
const ObjectId$2 = require$$0.Types.ObjectId;
|
75
75
|
const { Client } = require$$5;
|
76
76
|
const client = new Client({});
|
77
77
|
const addUserStatusFields = addUserStatusFields_1;
|
@@ -115,15 +115,15 @@ const controllerFactory$4 = (db) => {
|
|
115
115
|
}));
|
116
116
|
}
|
117
117
|
const matchConditions = [
|
118
|
-
...req.query._id ? [{ _id: new ObjectId$
|
119
|
-
...req.query.owner ? [{ owner: new ObjectId$
|
120
|
-
...req.query.member ? [{ "memberships.user": new ObjectId$
|
121
|
-
...req.query.subscriber ? [{ "memberships.user": new ObjectId$
|
122
|
-
...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$
|
118
|
+
...req.query._id ? [{ _id: new ObjectId$2(req.query._id) }] : [],
|
119
|
+
...req.query.owner ? [{ owner: new ObjectId$2(req.query.owner) }] : [],
|
120
|
+
...req.query.member ? [{ "memberships.user": new ObjectId$2(req.query.member), "memberships.role": "member" }] : [],
|
121
|
+
...req.query.subscriber ? [{ "memberships.user": new ObjectId$2(req.query.subscriber), "memberships.role": "subscriber" }] : [],
|
122
|
+
...req.query.postable ? [{ $or: [{ $and: [{ types: { $elemMatch: { $eq: "public" } } }, { "memberships.user": new ObjectId$2(req.query.postable) }] }, { $and: [{ types: { $elemMatch: { $in: ["exclusive", "hidden"] } } }, { "memberships.user": new ObjectId$2(req.query.postable) }, { "memberships.role": { $ne: "subscriber" } }] }] }] : [],
|
123
123
|
...req.query.types ? [{ types: { $in: req.query.types } }] : [],
|
124
124
|
// Если req.query.types - строка
|
125
125
|
// to remove
|
126
|
-
...req.query.onlyuser ? [{ "memberships.user": new ObjectId$
|
126
|
+
...req.query.onlyuser ? [{ "memberships.user": new ObjectId$2(req.query.onlyuser) }] : [],
|
127
127
|
...categories.length > 0 ? [{ "products.category": { $in: categories } }] : [],
|
128
128
|
...delivery.length > 0 ? [{ "spots.delivery": { $all: delivery } }] : [],
|
129
129
|
...priceConditions.length > 0 ? [{ $or: priceConditions }] : [],
|
@@ -424,26 +424,33 @@ const controllerFactory$4 = (db) => {
|
|
424
424
|
};
|
425
425
|
};
|
426
426
|
var organizations_controller = controllerFactory$4;
|
427
|
+
const ObjectId$1 = require$$0.Types.ObjectId;
|
427
428
|
const controllerFactory$3 = (db) => {
|
428
429
|
const Membership = db.membership;
|
429
430
|
const read = async (req, res) => {
|
430
|
-
let query = {};
|
431
|
-
let options = {};
|
432
|
-
if (req.query.user) {
|
433
|
-
query.user = req.query.user;
|
434
|
-
}
|
435
|
-
if (req.query.type) {
|
436
|
-
query.type = req.query.type;
|
437
|
-
}
|
438
|
-
if (req.query.target) {
|
439
|
-
query.target = req.query.target;
|
440
|
-
}
|
441
|
-
if (req.query.role) {
|
442
|
-
query.role = req.query.role;
|
443
|
-
}
|
444
431
|
try {
|
445
|
-
const memberships = await Membership.
|
446
|
-
|
432
|
+
const memberships = await Membership.aggregate([
|
433
|
+
{
|
434
|
+
$match: {
|
435
|
+
...req.query.user && { user: req.query.user },
|
436
|
+
...req.query.type && { type: req.query.type },
|
437
|
+
...req.query.target && { target: req.query.target },
|
438
|
+
...req.query.role && { role: req.query.role }
|
439
|
+
}
|
440
|
+
},
|
441
|
+
{
|
442
|
+
$lookup: {
|
443
|
+
from: "users",
|
444
|
+
localField: "user",
|
445
|
+
foreignField: "_id",
|
446
|
+
as: "user"
|
447
|
+
}
|
448
|
+
},
|
449
|
+
{
|
450
|
+
$unwind: "$user"
|
451
|
+
}
|
452
|
+
]);
|
453
|
+
if (!memberships || memberships.length === 0) {
|
447
454
|
return res.status(404).send({ errorCode: "MEMBERSHIPS_NOT_FOUND" });
|
448
455
|
}
|
449
456
|
res.send(memberships);
|
@@ -479,10 +486,9 @@ const controllerFactory$3 = (db) => {
|
|
479
486
|
}
|
480
487
|
};
|
481
488
|
const deleteMembership = async (req, res) => {
|
482
|
-
const { type, target, user: user2, role } = req.body;
|
483
489
|
console.log(req.body);
|
484
490
|
try {
|
485
|
-
const membership = await Membership.
|
491
|
+
const membership = await Membership.findOneAndDelete({ _id: new ObjectId$1(req.body._id) });
|
486
492
|
if (!membership) {
|
487
493
|
return res.status(404).send({ errorCode: "MEMBERSHIP_NOT_FOUND" });
|
488
494
|
} else {
|
@@ -591,23 +597,6 @@ var department_model = (mongoose) => {
|
|
591
597
|
description: { type: String },
|
592
598
|
categories: [String]
|
593
599
|
},
|
594
|
-
// Working hours
|
595
|
-
address: String,
|
596
|
-
// Position on map
|
597
|
-
location: {
|
598
|
-
lat: Number,
|
599
|
-
lng: Number,
|
600
|
-
type: {
|
601
|
-
type: String,
|
602
|
-
enum: ["Point"],
|
603
|
-
// 'location.type' must be 'Point'
|
604
|
-
required: true
|
605
|
-
},
|
606
|
-
coordinates: {
|
607
|
-
type: [Number],
|
608
|
-
required: true
|
609
|
-
}
|
610
|
-
},
|
611
600
|
worktime: [{
|
612
601
|
day: String,
|
613
602
|
time: {
|
@@ -638,7 +627,6 @@ var department_model = (mongoose) => {
|
|
638
627
|
]
|
639
628
|
});
|
640
629
|
departmentSchema.index({ organization: 1 });
|
641
|
-
departmentSchema.index({ location: "2dsphere" });
|
642
630
|
const Department = mongoose.model("Department", departmentSchema);
|
643
631
|
return Department;
|
644
632
|
};
|
@@ -726,6 +714,10 @@ var membership_model = (mongoose) => {
|
|
726
714
|
type: String,
|
727
715
|
default: "subscriber"
|
728
716
|
},
|
717
|
+
label: {
|
718
|
+
type: String,
|
719
|
+
default: "subscriber"
|
720
|
+
},
|
729
721
|
target: {
|
730
722
|
// заменяем 'organization' на 'target', так как это может быть или User, или Organization
|
731
723
|
type: mongoose.Schema.Types.ObjectId,
|
package/dist/products.server.js
CHANGED
@@ -5,7 +5,7 @@ require("uuid");
|
|
5
5
|
const require$$0 = require("mongoose");
|
6
6
|
require("path");
|
7
7
|
const require$$3 = require("openai");
|
8
|
-
const index = require("./index-
|
8
|
+
const index = require("./index-4eecfdb9.js");
|
9
9
|
require("jsonwebtoken");
|
10
10
|
require("mongodb");
|
11
11
|
var product_model = (mongoose) => {
|
@@ -27,7 +27,22 @@ var product_model = (mongoose) => {
|
|
27
27
|
images: { type: Array },
|
28
28
|
popularity: { type: Number },
|
29
29
|
localization: { type: Array },
|
30
|
-
ingredients: {
|
30
|
+
ingredients: [{
|
31
|
+
_id: {
|
32
|
+
type: mongoose.Schema.Types.ObjectId,
|
33
|
+
ref: "Product"
|
34
|
+
},
|
35
|
+
price: {
|
36
|
+
type: Number,
|
37
|
+
required: true,
|
38
|
+
min: [0, "Price cannot be less than 0"]
|
39
|
+
},
|
40
|
+
quantity: {
|
41
|
+
type: Number,
|
42
|
+
required: true,
|
43
|
+
min: [1, "Quantity cannot be less than 1"]
|
44
|
+
}
|
45
|
+
}],
|
31
46
|
information: [{
|
32
47
|
name: { type: String },
|
33
48
|
value: { type: String }
|
@@ -212,7 +227,10 @@ var leftover_model = (mongoose) => {
|
|
212
227
|
const leftover_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(leftover_model);
|
213
228
|
const ObjectId$1 = require$$0.Types.ObjectId;
|
214
229
|
const OpenAI = require$$3;
|
215
|
-
|
230
|
+
console.log(process.env.OPENAI_API_KEY);
|
231
|
+
const openai = new OpenAI({
|
232
|
+
apiKey: process.env.OPENAI_API_KEY
|
233
|
+
});
|
216
234
|
const controllerFactory$5 = (db) => {
|
217
235
|
const Product = db.product;
|
218
236
|
db.modification;
|
@@ -293,7 +311,7 @@ const controllerFactory$5 = (db) => {
|
|
293
311
|
const Update = async (req, res) => {
|
294
312
|
try {
|
295
313
|
const { _id } = req.params;
|
296
|
-
console.log(
|
314
|
+
console.log(req.body.ingredients);
|
297
315
|
const updatedProduct = await Product.findOneAndUpdate(
|
298
316
|
{ _id },
|
299
317
|
{
|
@@ -307,7 +325,8 @@ const controllerFactory$5 = (db) => {
|
|
307
325
|
information: req.body.information,
|
308
326
|
localization: req.body.localization,
|
309
327
|
quantity: req.body.quantity,
|
310
|
-
quantityDiscount: req.body.quantityDiscount
|
328
|
+
quantityDiscount: req.body.quantityDiscount,
|
329
|
+
ingredients: req.body.ingredients
|
311
330
|
},
|
312
331
|
{ new: true }
|
313
332
|
);
|
@@ -338,19 +357,19 @@ const controllerFactory$5 = (db) => {
|
|
338
357
|
"withIngredients": [
|
339
358
|
{
|
340
359
|
$match: {
|
341
|
-
|
360
|
+
ingredients: { $exists: true, $not: { $size: 0 } }
|
342
361
|
// Продукты с ингредиентами
|
343
362
|
}
|
344
363
|
},
|
345
364
|
{
|
346
365
|
$lookup: {
|
347
366
|
from: "products",
|
348
|
-
localField: "
|
367
|
+
localField: "ingredients",
|
349
368
|
foreignField: "_id",
|
350
369
|
as: "ingredientDetails"
|
351
370
|
}
|
352
371
|
},
|
353
|
-
{ $unwind: "$ingredientDetails" },
|
372
|
+
// { $unwind: "$ingredientDetails" },
|
354
373
|
{
|
355
374
|
$lookup: {
|
356
375
|
from: "leftovers",
|
@@ -385,9 +404,9 @@ const controllerFactory$5 = (db) => {
|
|
385
404
|
{
|
386
405
|
$match: {
|
387
406
|
$or: [
|
388
|
-
{
|
407
|
+
{ ingredients: { $exists: false } },
|
389
408
|
// Продукты без ингредиентов
|
390
|
-
{
|
409
|
+
{ ingredients: { $size: 0 } }
|
391
410
|
]
|
392
411
|
}
|
393
412
|
},
|
@@ -449,13 +468,13 @@ const controllerFactory$5 = (db) => {
|
|
449
468
|
console.log("no products");
|
450
469
|
return res.status(404).send({ message: "Products not found." });
|
451
470
|
}
|
452
|
-
const productsList = products.map((p) =>
|
453
|
-
|
454
|
-
|
455
|
-
(${
|
456
|
-
(${
|
457
|
-
|
458
|
-
|
471
|
+
const productsList = products.map((p) => {
|
472
|
+
const info = p.information || [];
|
473
|
+
const value0 = info[0] ? info[0].value : "";
|
474
|
+
const value1 = info[1] ? `(${info[1].value}%)` : "";
|
475
|
+
const value2 = info[2] ? `(${info[2].value})` : "";
|
476
|
+
return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
|
477
|
+
}).join(", ");
|
459
478
|
const prompt = `
|
460
479
|
1. When asked how the client wants to feel, they responded "${mood}".
|
461
480
|
2. Here is a list of products in our store: ${productsList}.
|
@@ -469,7 +488,7 @@ const controllerFactory$5 = (db) => {
|
|
469
488
|
while (true) {
|
470
489
|
try {
|
471
490
|
response = await openai.chat.completions.create({
|
472
|
-
model: "gpt-
|
491
|
+
model: "gpt-3.5-turbo",
|
473
492
|
messages: [{ role: "user", content: prompt }]
|
474
493
|
});
|
475
494
|
console.log(response);
|
@@ -521,13 +540,21 @@ const controllerFactory$5 = (db) => {
|
|
521
540
|
{
|
522
541
|
$lookup: {
|
523
542
|
from: "leftovers",
|
524
|
-
let: { productId: "$_id",
|
543
|
+
let: { productId: "$_id", ingredientsIds: "$ingredients._id" },
|
525
544
|
pipeline: [
|
526
545
|
{
|
527
546
|
$unwind: "$positions"
|
528
547
|
},
|
529
548
|
{
|
530
|
-
|
549
|
+
$match: {
|
550
|
+
$expr: {
|
551
|
+
$or: [
|
552
|
+
{ $eq: ["$positions._id", "$$productId"] },
|
553
|
+
{ $in: ["$positions._id", { $ifNull: ["$$ingredientsIds", []] }] }
|
554
|
+
// Исправлено
|
555
|
+
]
|
556
|
+
}
|
557
|
+
}
|
531
558
|
},
|
532
559
|
{
|
533
560
|
"$addFields": {
|
@@ -548,18 +575,75 @@ const controllerFactory$5 = (db) => {
|
|
548
575
|
}
|
549
576
|
}
|
550
577
|
],
|
551
|
-
as: "
|
578
|
+
as: "leftovers"
|
579
|
+
}
|
580
|
+
},
|
581
|
+
{
|
582
|
+
$addFields: {
|
583
|
+
ingredientsQuantities: {
|
584
|
+
$cond: {
|
585
|
+
if: { $isArray: "$ingredients" },
|
586
|
+
then: {
|
587
|
+
$map: {
|
588
|
+
input: "$ingredients",
|
589
|
+
as: "ingredient",
|
590
|
+
in: {
|
591
|
+
$let: {
|
592
|
+
vars: {
|
593
|
+
ingredientId: "$$ingredient._id",
|
594
|
+
ingredientQuantity: { $ifNull: ["$$ingredient.quantity", 0] }
|
595
|
+
},
|
596
|
+
in: {
|
597
|
+
$divide: [
|
598
|
+
{
|
599
|
+
$sum: {
|
600
|
+
$map: {
|
601
|
+
input: "$leftovers",
|
602
|
+
as: "leftover",
|
603
|
+
in: {
|
604
|
+
$cond: {
|
605
|
+
if: { $eq: ["$$leftover._id", "$$ingredientId"] },
|
606
|
+
then: "$$leftover.quantity",
|
607
|
+
else: 0
|
608
|
+
}
|
609
|
+
}
|
610
|
+
}
|
611
|
+
}
|
612
|
+
},
|
613
|
+
{
|
614
|
+
$cond: {
|
615
|
+
if: { $eq: ["$$ingredientQuantity", 0] },
|
616
|
+
then: 1,
|
617
|
+
else: "$$ingredientQuantity"
|
618
|
+
}
|
619
|
+
}
|
620
|
+
]
|
621
|
+
}
|
622
|
+
}
|
623
|
+
}
|
624
|
+
}
|
625
|
+
},
|
626
|
+
else: []
|
627
|
+
}
|
628
|
+
}
|
552
629
|
}
|
553
630
|
},
|
554
631
|
{
|
555
632
|
$set: {
|
556
633
|
quantity: {
|
557
|
-
$
|
634
|
+
$cond: {
|
635
|
+
if: { $gt: [{ $size: { $ifNull: ["$ingredients", []] } }, 0] },
|
636
|
+
// Снова проверяем, не пустой ли массив ингредиентов
|
637
|
+
then: { $floor: { $min: "$ingredientsQuantities" } },
|
638
|
+
else: { $sum: "$leftovers.quantity" }
|
639
|
+
// Просто суммируем quantity из leftovers, если ингредиентов нет
|
640
|
+
}
|
558
641
|
}
|
559
642
|
}
|
560
643
|
},
|
561
|
-
{ $unset: "
|
644
|
+
{ $unset: ["leftovers", "ingredientsQuantities"] }
|
562
645
|
]);
|
646
|
+
console.log(product);
|
563
647
|
if (!product || product.length < 1) {
|
564
648
|
return res.status(404).send({ message: "Product not found." });
|
565
649
|
}
|
@@ -568,7 +652,6 @@ const controllerFactory$5 = (db) => {
|
|
568
652
|
{ $inc: { popularity: 1 } },
|
569
653
|
{ new: true }
|
570
654
|
);
|
571
|
-
console.log("Popularity updated:", updatedProduct);
|
572
655
|
res.status(200).send(product);
|
573
656
|
} catch (err) {
|
574
657
|
console.error("Error:", err);
|