@ozdao/prometheus-framework 0.2.50 → 0.2.52
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main-482dc398.mjs +13626 -0
- package/dist/main-b2JI9sFg.js +91 -0
- package/dist/main-c56d4c09.js +91 -0
- package/dist/main-x-9D8zvb.mjs +13604 -0
- package/dist/main.css +1 -1
- package/dist/organizations.server.js +22 -16
- package/dist/organizations.server.mjs +22 -16
- package/dist/products.server.js +32 -16
- package/dist/products.server.mjs +32 -16
- package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue.js +223 -2
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +2 -225
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +19 -19
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +76 -2
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +2 -76
- 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/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +2 -2
- package/dist/prometheus-framework/src/components/Map/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue.js +35 -2
- package/dist/prometheus-framework/src/components/Map/Map.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue2.js +2 -35
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +44 -2
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +2 -44
- 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 +3 -3
- 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/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 +2 -2
- 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 +2 -2
- 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/BlockSearch.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +37 -0
- 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/icons/entities/IconShopcart.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/icons/entities/IconShopcart.vue.js +21 -14
- package/dist/prometheus-framework/src/modules/icons/navigation/IconSearch.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/navigation/IconSearch.vue.js +24 -0
- 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 +2 -11
- 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 +11 -2
- 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 +49 -101
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +25 -25
- 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 +68 -39
- 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 +38 -47
- 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 +69 -62
- 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 +134 -129
- 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 +2 -2
- 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 +128 -158
- 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/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +13 -13
- 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 +2 -2
- 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 +3 -3
- 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 +1 -1
- 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 +44 -44
- 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/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +64 -51
- 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 +22 -23
- 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 +23 -23
- 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/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.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/style.css +1 -1
- package/dist/web-6dcbb74b.mjs +55 -0
- package/dist/web-caJAdsxy.js +1 -0
- package/dist/web-ee302c1d.js +1 -0
- package/dist/web-i08OVMw9.mjs +55 -0
- package/package.json +1 -1
- package/src/components/Button/Button.vue +3 -3
- package/src/components/Feed/Feed.vue +2 -1
- package/src/components/LocationMarker/LocationMarker.vue +1 -0
- package/src/modules/applications/applications.client.js +0 -1
- package/src/modules/globals/components/blocks/BlockSearch.vue +42 -0
- package/src/modules/icons/entities/IconProfile.vue +10 -1
- package/src/modules/icons/entities/IconShopcart.vue +12 -2
- package/src/modules/marketplace/components/layouts/Marketplace.vue +7 -14
- 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 +152 -0
- package/src/modules/mobile/components/Walkthrough/Walkthrough.vue +195 -0
- package/src/modules/orders/components/partials/ShopCart.vue +4 -1
- package/src/modules/organizations/components/blocks/CardDepartment.vue +34 -66
- package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +50 -13
- package/src/modules/organizations/components/blocks/User.vue +19 -10
- package/src/modules/organizations/components/pages/Department.vue +19 -3
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +14 -10
- package/src/modules/organizations/components/pages/Organization.vue +38 -72
- package/src/modules/organizations/components/sections/Feed.vue +1 -1
- package/src/modules/organizations/controllers/memberships.controller.js +27 -24
- package/src/modules/organizations/controllers/organizations.controller.js +0 -1
- package/src/modules/products/components/pages/EditLeftover.vue +6 -4
- package/src/modules/products/components/pages/Products.vue +58 -38
- package/src/modules/products/components/sections/FilterProducts.vue +5 -5
- package/src/modules/products/controllers/leftovers.controller.js +12 -5
- package/src/modules/products/controllers/products.controller.js +30 -9
- package/src/modules/products/store/products.js +4 -0
- package/src/styles/layout.scss +1 -1
@@ -1,47 +1,57 @@
|
|
1
1
|
<template>
|
2
|
-
<div class="cols-2-1_3 bg-grey radius-big gap-thin
|
2
|
+
<div class="cols-2-1_3 bg-grey pd-thin radius-big gap-thin">
|
3
|
+
|
3
4
|
<FilterProducts
|
4
5
|
|
5
6
|
/>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}"
|
13
|
-
:store="{
|
14
|
-
read: (options) => products.actions.read(options),
|
15
|
-
state: products.state
|
16
|
-
}"
|
17
|
-
:options="{
|
18
|
-
limit: 15,
|
19
|
-
organization: route.params._id,
|
20
|
-
categories: route.query.categories,
|
21
|
-
prices: route.query.prices,
|
22
|
-
delivery: route.query.delivery,
|
23
|
-
// user: user
|
24
|
-
}"
|
25
|
-
v-slot="{
|
26
|
-
items
|
27
|
-
}"
|
28
|
-
class="cols-3 gap-thin"
|
29
|
-
>
|
30
|
-
<CardProduct
|
31
|
-
v-for="product in items"
|
32
|
-
:key="product._id"
|
33
|
-
:product="product"
|
34
|
-
class="h-max"
|
35
|
-
@click="$router.push({
|
36
|
-
name: 'Product Organization',
|
37
|
-
params: {
|
38
|
-
_id: route.params._id,
|
39
|
-
product: product._id
|
40
|
-
}
|
41
|
-
})"
|
7
|
+
|
8
|
+
<div>
|
9
|
+
<BlockSearch
|
10
|
+
@search="updateSearch"
|
11
|
+
placeholder="Enter product name"
|
12
|
+
class="bg-white mn-b-thin"
|
42
13
|
/>
|
43
|
-
</Feed>
|
44
14
|
|
15
|
+
<Feed
|
16
|
+
:states="{
|
17
|
+
empty: {
|
18
|
+
title: 'No Products Found',
|
19
|
+
description: 'Currently, there are no products available.'
|
20
|
+
}
|
21
|
+
}"
|
22
|
+
:store="{
|
23
|
+
read: (options) => products.actions.read(options),
|
24
|
+
state: products.state
|
25
|
+
}"
|
26
|
+
:options="{
|
27
|
+
limit: 15,
|
28
|
+
organization: route.params._id,
|
29
|
+
categories: route.query.categories,
|
30
|
+
prices: route.query.prices,
|
31
|
+
delivery: route.query.delivery,
|
32
|
+
search: route.query.search
|
33
|
+
// user: user
|
34
|
+
}"
|
35
|
+
v-slot="{
|
36
|
+
items
|
37
|
+
}"
|
38
|
+
class="cols-3 gap-thin"
|
39
|
+
>
|
40
|
+
<CardProduct
|
41
|
+
v-for="product in items"
|
42
|
+
:key="product._id"
|
43
|
+
:product="product"
|
44
|
+
class="h-max"
|
45
|
+
@click="$router.push({
|
46
|
+
name: 'Product Organization',
|
47
|
+
params: {
|
48
|
+
_id: route.params._id,
|
49
|
+
product: product._id
|
50
|
+
}
|
51
|
+
})"
|
52
|
+
/>
|
53
|
+
</Feed>
|
54
|
+
</div>
|
45
55
|
</div>
|
46
56
|
</template>
|
47
57
|
|
@@ -54,6 +64,8 @@
|
|
54
64
|
|
55
65
|
// Import components
|
56
66
|
import FilterProducts from '@pf/src/modules/products/components/sections/FilterProducts.vue'
|
67
|
+
import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
|
68
|
+
|
57
69
|
|
58
70
|
import Feed from '@pf/src/components/Feed/Feed.vue'
|
59
71
|
import CardProduct from '@pf/src/modules/products/components/blocks/CardProduct.vue'
|
@@ -61,6 +73,14 @@
|
|
61
73
|
// Accessing router and store
|
62
74
|
import * as products from '@pf/src/modules/products/store/products';
|
63
75
|
|
76
|
+
function updateSearch(search) {
|
77
|
+
let query = { ...route.query}
|
78
|
+
|
79
|
+
query.search = search
|
80
|
+
|
81
|
+
router.push({ query });
|
82
|
+
}
|
83
|
+
|
64
84
|
const route = useRoute()
|
65
85
|
const router = useRouter()
|
66
86
|
</script>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<template>
|
2
|
-
<div class="pd-medium bg-
|
2
|
+
<div class="pd-medium bg-white-transp-50 radius-big">
|
3
3
|
<!-- Categories Filter -->
|
4
4
|
<Spoiler
|
5
|
-
class="radius-small o-hidden
|
5
|
+
class="radius-small o-hidden mn-b-small"
|
6
6
|
:status="true"
|
7
7
|
>
|
8
8
|
<template #header>
|
@@ -22,11 +22,11 @@
|
|
22
22
|
</template>
|
23
23
|
</Spoiler>
|
24
24
|
|
25
|
-
<hr class="mn-b-small">
|
25
|
+
<hr class="mn-b-small t-transp">
|
26
26
|
|
27
27
|
<!-- Prices Filter -->
|
28
28
|
<Spoiler
|
29
|
-
class="radius-small o-hidden
|
29
|
+
class="radius-small o-hidden mn-b-small"
|
30
30
|
:status="false"
|
31
31
|
>
|
32
32
|
<template #header>
|
@@ -46,7 +46,7 @@
|
|
46
46
|
</template>
|
47
47
|
</Spoiler>
|
48
48
|
|
49
|
-
<hr class="mn-b-small">
|
49
|
+
<!-- <hr class="mn-b-small"> -->
|
50
50
|
|
51
51
|
<!-- Delivery Filter -->
|
52
52
|
<!-- <Spoiler
|
@@ -1,5 +1,3 @@
|
|
1
|
-
const ObjectId = require('mongoose').Types.ObjectId;
|
2
|
-
|
3
1
|
const controllerFactory = (db) => {
|
4
2
|
const Leftover = db.leftover;
|
5
3
|
|
@@ -8,16 +6,25 @@ const controllerFactory = (db) => {
|
|
8
6
|
let query = {};
|
9
7
|
let options = {};
|
10
8
|
|
11
|
-
|
9
|
+
// Проверка наличия req.query.organization
|
10
|
+
if (req.query.organization) {
|
11
|
+
// Создание ObjectId из строки
|
12
|
+
query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
|
13
|
+
}
|
14
|
+
|
15
|
+
console.log(query);
|
16
|
+
|
17
|
+
const leftoveres = await Leftover.find(query, null, options)
|
18
|
+
.sort({ createdAt: "desc" })
|
19
|
+
.exec();
|
12
20
|
|
13
|
-
const leftoveres = await Leftover.find(query, null, options).sort({ 'createdAt': 'desc' }).exec();
|
14
|
-
|
15
21
|
if (!leftoveres) {
|
16
22
|
return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
|
17
23
|
}
|
18
24
|
|
19
25
|
res.status(200).send(leftoveres);
|
20
26
|
} catch (err) {
|
27
|
+
console.error(err);
|
21
28
|
res.status(500).send({ message: "ERROR_GET_ALL_LEFTOVERES" });
|
22
29
|
}
|
23
30
|
};
|
@@ -5,7 +5,10 @@ const path = require('path');
|
|
5
5
|
|
6
6
|
const OpenAI = require("openai");
|
7
7
|
|
8
|
-
|
8
|
+
console.log(process.env.OPENAI_API_KEY)
|
9
|
+
const openai = new OpenAI({
|
10
|
+
apiKey: process.env.OPENAI_API_KEY
|
11
|
+
});
|
9
12
|
|
10
13
|
// Factory
|
11
14
|
const controllerFactory = (db) => {
|
@@ -59,6 +62,24 @@ const controllerFactory = (db) => {
|
|
59
62
|
query.delivery = { $in: deliveryOptions };
|
60
63
|
}
|
61
64
|
|
65
|
+
const search = req.query.search;
|
66
|
+
|
67
|
+
if (search) {
|
68
|
+
const parts = search.split('.');
|
69
|
+
|
70
|
+
let regexPattern = '';
|
71
|
+
|
72
|
+
if (parts.length === 2) {
|
73
|
+
// Создаем паттерн, который допускает замену одного символа в каждой части
|
74
|
+
regexPattern = parts.map(part => part.substr(0, part.length - 1) + '.{1}').join('\\.');
|
75
|
+
} else {
|
76
|
+
// Если нет точки, применяем аналогичный подход к всей строке
|
77
|
+
regexPattern = search.substr(0, search.length - 1) + '.{1}';
|
78
|
+
}
|
79
|
+
|
80
|
+
query.name = { $regex: regexPattern, $options: 'i' }
|
81
|
+
}
|
82
|
+
|
62
83
|
// Handle price ranges
|
63
84
|
const prices = req.query.prices?.split(',') || [];
|
64
85
|
|
@@ -327,13 +348,13 @@ const controllerFactory = (db) => {
|
|
327
348
|
return res.status(404).send({ message: "Products not found." });
|
328
349
|
}
|
329
350
|
|
330
|
-
const productsList = products.map(p =>
|
331
|
-
|
332
|
-
|
333
|
-
(${
|
334
|
-
(${
|
335
|
-
|
336
|
-
|
351
|
+
const productsList = products.map(p => {
|
352
|
+
const info = p.information || [];
|
353
|
+
const value0 = info[0] ? info[0].value : '';
|
354
|
+
const value1 = info[1] ? `(${info[1].value}%)` : '';
|
355
|
+
const value2 = info[2] ? `(${info[2].value})` : '';
|
356
|
+
return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
|
357
|
+
}).join(', ');
|
337
358
|
|
338
359
|
const prompt = `
|
339
360
|
1. When asked how the client wants to feel, they responded "${mood}".
|
@@ -352,7 +373,7 @@ const controllerFactory = (db) => {
|
|
352
373
|
while (true) {
|
353
374
|
try {
|
354
375
|
response = await openai.chat.completions.create({
|
355
|
-
model: "gpt-
|
376
|
+
model: "gpt-3.5-turbo",
|
356
377
|
messages: [{role: "user", content: prompt}],
|
357
378
|
});
|
358
379
|
|