@ozdao/prometheus-framework 0.2.51 → 0.2.53
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main-0a2437f4.js +91 -0
- package/dist/main-482dc398.mjs +13626 -0
- package/dist/main-4fnApBsF.js +91 -0
- package/dist/main-b2JI9sFg.js +91 -0
- package/dist/main-c56d4c09.js +91 -0
- package/dist/main-cdd0be68.mjs +13628 -0
- package/dist/main-kjbLXQEa.mjs +13606 -0
- package/dist/main-x-9D8zvb.mjs +13604 -0
- package/dist/main.css +1 -1
- package/dist/organizations.server.js +2 -2
- package/dist/organizations.server.mjs +2 -2
- package/dist/products.server.js +81 -56
- package/dist/products.server.mjs +81 -56
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +18 -20
- 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.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +28 -26
- 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/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/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/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 +1 -1
- 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/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 -48
- 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 +131 -126
- 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 +1 -1
- 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 +117 -146
- 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/router/products.router.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/router/products.router.js +22 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +45 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.js +4 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +79 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +193 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.js +4 -0
- 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 +43 -43
- 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 +65 -55
- 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/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +35 -33
- package/dist/prometheus-framework/src/modules/products/products.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.js +2 -2
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.js +39 -27
- 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/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 +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-0066fd51.mjs +55 -0
- package/dist/web-6b9fa713.js +1 -0
- 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/dist/web-ngl7bNhF.js +1 -0
- package/dist/web-t91TrxXa.mjs +55 -0
- package/package.json +1 -1
- package/src/components/Button/Button.vue +4 -6
- package/src/components/Feed/Feed.vue +2 -1
- package/src/components/Field/Field.vue +3 -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/marketplace/components/sections/Filters.vue +7 -1
- package/src/modules/mobile/components/NavigationBar/NavigationBar.vue +27 -7
- 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 +18 -9
- 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 -71
- package/src/modules/organizations/components/sections/Feed.vue +1 -1
- package/src/modules/organizations/controllers/memberships.controller.js +2 -2
- package/src/modules/organizations/controllers/organizations.controller.js +0 -1
- package/src/modules/organizations/router/products.router.js +24 -4
- package/src/modules/products/components/blocks/CardCategory.vue +53 -0
- package/src/modules/products/components/pages/Categories.vue +90 -0
- package/src/modules/products/components/pages/CategoryEdit.vue +214 -0
- package/src/modules/products/components/pages/EditLeftover.vue +6 -4
- package/src/modules/products/components/pages/ProductEdit.vue +9 -1
- package/src/modules/products/components/pages/Products.vue +58 -38
- package/src/modules/products/components/sections/FilterProducts.vue +9 -6
- package/src/modules/products/controllers/categories.controller.js +30 -13
- package/src/modules/products/controllers/leftovers.controller.js +12 -5
- package/src/modules/products/controllers/products.controller.js +18 -0
- package/src/modules/products/models/category.model.js +42 -32
- package/src/modules/products/products.client.js +4 -2
- package/src/modules/products/store/categories.js +17 -3
- package/src/modules/products/store/products.js +4 -0
- package/src/modules/backoffice/components/admin/Categories.vue +0 -53
- package/src/modules/backoffice/components/admin/CategoryEdit.vue +0 -98
- package/src/modules/products/components/blocks/CategoryCard.vue +0 -42
- package/src/modules/products/router/products.router.js +0 -48
- /package/src/modules/{products → organizations}/components/pages/OrganizationCreate.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationDetails.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationDocuments.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationPeople.vue +0 -0
@@ -433,9 +433,9 @@ const controllerFactory$3 = (db) => {
|
|
433
433
|
const memberships = await Membership.aggregate([
|
434
434
|
{
|
435
435
|
$match: {
|
436
|
-
...req.query.user && { user: req.query.user },
|
436
|
+
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
437
437
|
...req.query.type && { type: req.query.type },
|
438
|
-
...req.query.target && { target: req.query.target },
|
438
|
+
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
439
439
|
...req.query.role && { role: req.query.role }
|
440
440
|
}
|
441
441
|
},
|
@@ -432,9 +432,9 @@ const controllerFactory$3 = (db) => {
|
|
432
432
|
const memberships = await Membership.aggregate([
|
433
433
|
{
|
434
434
|
$match: {
|
435
|
-
...req.query.user && { user: req.query.user },
|
435
|
+
...req.query.user && { user: new ObjectId$1(req.query.user) },
|
436
436
|
...req.query.type && { type: req.query.type },
|
437
|
-
...req.query.target && { target: req.query.target },
|
437
|
+
...req.query.target && { target: new ObjectId$1(req.query.target) },
|
438
438
|
...req.query.role && { role: req.query.role }
|
439
439
|
}
|
440
440
|
},
|
package/dist/products.server.js
CHANGED
@@ -81,6 +81,16 @@ var category_model = (mongoose) => {
|
|
81
81
|
required: true,
|
82
82
|
trim: true
|
83
83
|
},
|
84
|
+
status: {
|
85
|
+
type: String,
|
86
|
+
enum: ["draft", "internal", "published", "removed"],
|
87
|
+
default: "draft",
|
88
|
+
required: true
|
89
|
+
},
|
90
|
+
order: {
|
91
|
+
type: Number,
|
92
|
+
required: true
|
93
|
+
},
|
84
94
|
url: {
|
85
95
|
type: String,
|
86
96
|
required: true,
|
@@ -94,43 +104,39 @@ var category_model = (mongoose) => {
|
|
94
104
|
},
|
95
105
|
filters: {
|
96
106
|
type: Array
|
97
|
-
},
|
98
|
-
owner: {
|
99
|
-
type: {
|
100
|
-
type: String,
|
101
|
-
required: true
|
102
|
-
},
|
103
|
-
target: {
|
104
|
-
type: mongoose.Schema.Types.ObjectId,
|
105
|
-
ref: function(value) {
|
106
|
-
if (this.owner.type === "user")
|
107
|
-
return "User";
|
108
|
-
if (this.owner.type === "organization")
|
109
|
-
return "Organization";
|
110
|
-
},
|
111
|
-
required: true
|
112
|
-
}
|
113
|
-
},
|
114
|
-
creator: {
|
115
|
-
hidden: {
|
116
|
-
type: Boolean,
|
117
|
-
required: true
|
118
|
-
},
|
119
|
-
type: {
|
120
|
-
type: String,
|
121
|
-
required: true
|
122
|
-
},
|
123
|
-
target: {
|
124
|
-
type: mongoose.Schema.Types.ObjectId,
|
125
|
-
ref: function(value) {
|
126
|
-
if (this.owner.type === "user")
|
127
|
-
return "User";
|
128
|
-
if (this.owner.type === "organization")
|
129
|
-
return "Organization";
|
130
|
-
},
|
131
|
-
required: true
|
132
|
-
}
|
133
107
|
}
|
108
|
+
// owner: {
|
109
|
+
// type: {
|
110
|
+
// type: String,
|
111
|
+
// required: true
|
112
|
+
// },
|
113
|
+
// target: {
|
114
|
+
// type: mongoose.Schema.Types.ObjectId,
|
115
|
+
// ref: function (value) {
|
116
|
+
// if (this.owner.type === 'user') return 'User';
|
117
|
+
// if (this.owner.type === 'organization') return 'Organization';
|
118
|
+
// },
|
119
|
+
// required: true,
|
120
|
+
// },
|
121
|
+
// },
|
122
|
+
// creator: {
|
123
|
+
// hidden: {
|
124
|
+
// type: Boolean,
|
125
|
+
// required: true
|
126
|
+
// },
|
127
|
+
// type: {
|
128
|
+
// type: String,
|
129
|
+
// required: true
|
130
|
+
// },
|
131
|
+
// target: {
|
132
|
+
// type: mongoose.Schema.Types.ObjectId,
|
133
|
+
// ref: function (value) {
|
134
|
+
// if (this.owner.type === 'user') return 'User';
|
135
|
+
// if (this.owner.type === 'organization') return 'Organization';
|
136
|
+
// },
|
137
|
+
// required: true,
|
138
|
+
// },
|
139
|
+
// }
|
134
140
|
}, {
|
135
141
|
timestamps: {
|
136
142
|
currentTime: () => Date.now()
|
@@ -225,7 +231,7 @@ var leftover_model = (mongoose) => {
|
|
225
231
|
return Leftover;
|
226
232
|
};
|
227
233
|
const leftover_model$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(leftover_model);
|
228
|
-
const ObjectId
|
234
|
+
const ObjectId = require$$0.Types.ObjectId;
|
229
235
|
const OpenAI = require$$3;
|
230
236
|
console.log(process.env.OPENAI_API_KEY);
|
231
237
|
const openai = new OpenAI({
|
@@ -250,7 +256,7 @@ const controllerFactory$5 = (db) => {
|
|
250
256
|
let query = {};
|
251
257
|
let options = {};
|
252
258
|
if (req.query.organization) {
|
253
|
-
query.organization = new ObjectId
|
259
|
+
query.organization = new ObjectId(req.query.organization);
|
254
260
|
}
|
255
261
|
if (req.query._id) {
|
256
262
|
query._id = req.query._id;
|
@@ -266,6 +272,17 @@ const controllerFactory$5 = (db) => {
|
|
266
272
|
if (deliveryOptions.length) {
|
267
273
|
query.delivery = { $in: deliveryOptions };
|
268
274
|
}
|
275
|
+
const search = req.query.search;
|
276
|
+
if (search) {
|
277
|
+
const parts = search.split(".");
|
278
|
+
let regexPattern = "";
|
279
|
+
if (parts.length === 2) {
|
280
|
+
regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
|
281
|
+
} else {
|
282
|
+
regexPattern = search.substr(0, search.length - 1) + ".{1}";
|
283
|
+
}
|
284
|
+
query.name = { $regex: regexPattern, $options: "i" };
|
285
|
+
}
|
269
286
|
const prices = req.query.prices?.split(",") || [];
|
270
287
|
console.log(prices);
|
271
288
|
if (prices.length) {
|
@@ -535,7 +552,7 @@ const controllerFactory$5 = (db) => {
|
|
535
552
|
try {
|
536
553
|
const product = await Product.aggregate([
|
537
554
|
{
|
538
|
-
$match: { "_id": new ObjectId
|
555
|
+
$match: { "_id": new ObjectId(req.params._id) }
|
539
556
|
},
|
540
557
|
{
|
541
558
|
$lookup: {
|
@@ -712,7 +729,12 @@ const controllerFactory$3 = (db) => {
|
|
712
729
|
const getCategories = async (req, res) => {
|
713
730
|
console.log(Category);
|
714
731
|
try {
|
715
|
-
|
732
|
+
let query = {};
|
733
|
+
let options = {};
|
734
|
+
if (req.query.status) {
|
735
|
+
query.status = req.query.status;
|
736
|
+
}
|
737
|
+
const categories = await Category.find(query, null, options).sort({ "order": "asc" }).exec();
|
716
738
|
if (!categories) {
|
717
739
|
return res.status(404).send({ message: "Categories not found." });
|
718
740
|
}
|
@@ -723,22 +745,21 @@ const controllerFactory$3 = (db) => {
|
|
723
745
|
}
|
724
746
|
};
|
725
747
|
const updateCategories = async (req, res) => {
|
748
|
+
console.log(req.body);
|
726
749
|
try {
|
727
|
-
const
|
728
|
-
|
729
|
-
{ url: categoryUpdated.url },
|
730
|
-
{ $set: categoryUpdated },
|
731
|
-
|
732
|
-
).exec();
|
733
|
-
if (!category) {
|
734
|
-
throw new Error("Categories is not updated.");
|
750
|
+
const bulkOps = req.body.map((categoryUpdated) => ({
|
751
|
+
updateOne: {
|
752
|
+
filter: { url: categoryUpdated.url },
|
753
|
+
update: { $set: categoryUpdated },
|
754
|
+
upsert: false
|
735
755
|
}
|
736
|
-
});
|
737
|
-
await
|
738
|
-
console.log("
|
756
|
+
}));
|
757
|
+
const result = await Category.bulkWrite(bulkOps, { ordered: false });
|
758
|
+
console.log("Success", result);
|
739
759
|
res.status(200).send({ message: "Categories updated successfully." });
|
740
760
|
} catch (err) {
|
741
|
-
|
761
|
+
console.error("Error processing bulk update", err);
|
762
|
+
res.status(500).send({ message: err.message });
|
742
763
|
}
|
743
764
|
};
|
744
765
|
const getCategory = async (req, res) => {
|
@@ -754,6 +775,8 @@ const controllerFactory$3 = (db) => {
|
|
754
775
|
};
|
755
776
|
const addCategory = async (req, res) => {
|
756
777
|
try {
|
778
|
+
const highestOrderDoc = await Category.findOne().sort("-order");
|
779
|
+
req.body.order = highestOrderDoc ? highestOrderDoc.order + 1 : 1;
|
757
780
|
const category = await Category.create(req.body);
|
758
781
|
if (!category) {
|
759
782
|
return res.status(404).send({ message: "Category is not created." });
|
@@ -843,21 +866,23 @@ var categories_routes = function(app, db) {
|
|
843
866
|
);
|
844
867
|
};
|
845
868
|
const categories_routes$1 = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(categories_routes);
|
846
|
-
const ObjectId = require$$0.Types.ObjectId;
|
847
869
|
const controllerFactory$1 = (db) => {
|
848
870
|
const Leftover = db.leftover;
|
849
871
|
const getAll = async (req, res) => {
|
850
872
|
try {
|
851
873
|
let query = {};
|
852
874
|
let options = {};
|
853
|
-
if (req.query.organization)
|
854
|
-
query.organization = new ObjectId(req.query.organization);
|
855
|
-
|
875
|
+
if (req.query.organization) {
|
876
|
+
query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
|
877
|
+
}
|
878
|
+
console.log(query);
|
879
|
+
const leftoveres = await Leftover.find(query, null, options).sort({ createdAt: "desc" }).exec();
|
856
880
|
if (!leftoveres) {
|
857
881
|
return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
|
858
882
|
}
|
859
883
|
res.status(200).send(leftoveres);
|
860
884
|
} catch (err) {
|
885
|
+
console.error(err);
|
861
886
|
res.status(500).send({ message: "ERROR_GET_ALL_LEFTOVERES" });
|
862
887
|
}
|
863
888
|
};
|
package/dist/products.server.mjs
CHANGED
@@ -79,6 +79,16 @@ var category_model = (mongoose) => {
|
|
79
79
|
required: true,
|
80
80
|
trim: true
|
81
81
|
},
|
82
|
+
status: {
|
83
|
+
type: String,
|
84
|
+
enum: ["draft", "internal", "published", "removed"],
|
85
|
+
default: "draft",
|
86
|
+
required: true
|
87
|
+
},
|
88
|
+
order: {
|
89
|
+
type: Number,
|
90
|
+
required: true
|
91
|
+
},
|
82
92
|
url: {
|
83
93
|
type: String,
|
84
94
|
required: true,
|
@@ -92,43 +102,39 @@ var category_model = (mongoose) => {
|
|
92
102
|
},
|
93
103
|
filters: {
|
94
104
|
type: Array
|
95
|
-
},
|
96
|
-
owner: {
|
97
|
-
type: {
|
98
|
-
type: String,
|
99
|
-
required: true
|
100
|
-
},
|
101
|
-
target: {
|
102
|
-
type: mongoose.Schema.Types.ObjectId,
|
103
|
-
ref: function(value) {
|
104
|
-
if (this.owner.type === "user")
|
105
|
-
return "User";
|
106
|
-
if (this.owner.type === "organization")
|
107
|
-
return "Organization";
|
108
|
-
},
|
109
|
-
required: true
|
110
|
-
}
|
111
|
-
},
|
112
|
-
creator: {
|
113
|
-
hidden: {
|
114
|
-
type: Boolean,
|
115
|
-
required: true
|
116
|
-
},
|
117
|
-
type: {
|
118
|
-
type: String,
|
119
|
-
required: true
|
120
|
-
},
|
121
|
-
target: {
|
122
|
-
type: mongoose.Schema.Types.ObjectId,
|
123
|
-
ref: function(value) {
|
124
|
-
if (this.owner.type === "user")
|
125
|
-
return "User";
|
126
|
-
if (this.owner.type === "organization")
|
127
|
-
return "Organization";
|
128
|
-
},
|
129
|
-
required: true
|
130
|
-
}
|
131
105
|
}
|
106
|
+
// owner: {
|
107
|
+
// type: {
|
108
|
+
// type: String,
|
109
|
+
// required: true
|
110
|
+
// },
|
111
|
+
// target: {
|
112
|
+
// type: mongoose.Schema.Types.ObjectId,
|
113
|
+
// ref: function (value) {
|
114
|
+
// if (this.owner.type === 'user') return 'User';
|
115
|
+
// if (this.owner.type === 'organization') return 'Organization';
|
116
|
+
// },
|
117
|
+
// required: true,
|
118
|
+
// },
|
119
|
+
// },
|
120
|
+
// creator: {
|
121
|
+
// hidden: {
|
122
|
+
// type: Boolean,
|
123
|
+
// required: true
|
124
|
+
// },
|
125
|
+
// type: {
|
126
|
+
// type: String,
|
127
|
+
// required: true
|
128
|
+
// },
|
129
|
+
// target: {
|
130
|
+
// type: mongoose.Schema.Types.ObjectId,
|
131
|
+
// ref: function (value) {
|
132
|
+
// if (this.owner.type === 'user') return 'User';
|
133
|
+
// if (this.owner.type === 'organization') return 'Organization';
|
134
|
+
// },
|
135
|
+
// required: true,
|
136
|
+
// },
|
137
|
+
// }
|
132
138
|
}, {
|
133
139
|
timestamps: {
|
134
140
|
currentTime: () => Date.now()
|
@@ -223,7 +229,7 @@ var leftover_model = (mongoose) => {
|
|
223
229
|
return Leftover;
|
224
230
|
};
|
225
231
|
const leftover_model$1 = /* @__PURE__ */ getDefaultExportFromCjs(leftover_model);
|
226
|
-
const ObjectId
|
232
|
+
const ObjectId = require$$0.Types.ObjectId;
|
227
233
|
const OpenAI = require$$3;
|
228
234
|
console.log(process.env.OPENAI_API_KEY);
|
229
235
|
const openai = new OpenAI({
|
@@ -248,7 +254,7 @@ const controllerFactory$5 = (db) => {
|
|
248
254
|
let query = {};
|
249
255
|
let options = {};
|
250
256
|
if (req.query.organization) {
|
251
|
-
query.organization = new ObjectId
|
257
|
+
query.organization = new ObjectId(req.query.organization);
|
252
258
|
}
|
253
259
|
if (req.query._id) {
|
254
260
|
query._id = req.query._id;
|
@@ -264,6 +270,17 @@ const controllerFactory$5 = (db) => {
|
|
264
270
|
if (deliveryOptions.length) {
|
265
271
|
query.delivery = { $in: deliveryOptions };
|
266
272
|
}
|
273
|
+
const search = req.query.search;
|
274
|
+
if (search) {
|
275
|
+
const parts = search.split(".");
|
276
|
+
let regexPattern = "";
|
277
|
+
if (parts.length === 2) {
|
278
|
+
regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
|
279
|
+
} else {
|
280
|
+
regexPattern = search.substr(0, search.length - 1) + ".{1}";
|
281
|
+
}
|
282
|
+
query.name = { $regex: regexPattern, $options: "i" };
|
283
|
+
}
|
267
284
|
const prices = req.query.prices?.split(",") || [];
|
268
285
|
console.log(prices);
|
269
286
|
if (prices.length) {
|
@@ -533,7 +550,7 @@ const controllerFactory$5 = (db) => {
|
|
533
550
|
try {
|
534
551
|
const product = await Product.aggregate([
|
535
552
|
{
|
536
|
-
$match: { "_id": new ObjectId
|
553
|
+
$match: { "_id": new ObjectId(req.params._id) }
|
537
554
|
},
|
538
555
|
{
|
539
556
|
$lookup: {
|
@@ -710,7 +727,12 @@ const controllerFactory$3 = (db) => {
|
|
710
727
|
const getCategories = async (req, res) => {
|
711
728
|
console.log(Category);
|
712
729
|
try {
|
713
|
-
|
730
|
+
let query = {};
|
731
|
+
let options = {};
|
732
|
+
if (req.query.status) {
|
733
|
+
query.status = req.query.status;
|
734
|
+
}
|
735
|
+
const categories = await Category.find(query, null, options).sort({ "order": "asc" }).exec();
|
714
736
|
if (!categories) {
|
715
737
|
return res.status(404).send({ message: "Categories not found." });
|
716
738
|
}
|
@@ -721,22 +743,21 @@ const controllerFactory$3 = (db) => {
|
|
721
743
|
}
|
722
744
|
};
|
723
745
|
const updateCategories = async (req, res) => {
|
746
|
+
console.log(req.body);
|
724
747
|
try {
|
725
|
-
const
|
726
|
-
|
727
|
-
{ url: categoryUpdated.url },
|
728
|
-
{ $set: categoryUpdated },
|
729
|
-
|
730
|
-
).exec();
|
731
|
-
if (!category) {
|
732
|
-
throw new Error("Categories is not updated.");
|
748
|
+
const bulkOps = req.body.map((categoryUpdated) => ({
|
749
|
+
updateOne: {
|
750
|
+
filter: { url: categoryUpdated.url },
|
751
|
+
update: { $set: categoryUpdated },
|
752
|
+
upsert: false
|
733
753
|
}
|
734
|
-
});
|
735
|
-
await
|
736
|
-
console.log("
|
754
|
+
}));
|
755
|
+
const result = await Category.bulkWrite(bulkOps, { ordered: false });
|
756
|
+
console.log("Success", result);
|
737
757
|
res.status(200).send({ message: "Categories updated successfully." });
|
738
758
|
} catch (err) {
|
739
|
-
|
759
|
+
console.error("Error processing bulk update", err);
|
760
|
+
res.status(500).send({ message: err.message });
|
740
761
|
}
|
741
762
|
};
|
742
763
|
const getCategory = async (req, res) => {
|
@@ -752,6 +773,8 @@ const controllerFactory$3 = (db) => {
|
|
752
773
|
};
|
753
774
|
const addCategory = async (req, res) => {
|
754
775
|
try {
|
776
|
+
const highestOrderDoc = await Category.findOne().sort("-order");
|
777
|
+
req.body.order = highestOrderDoc ? highestOrderDoc.order + 1 : 1;
|
755
778
|
const category = await Category.create(req.body);
|
756
779
|
if (!category) {
|
757
780
|
return res.status(404).send({ message: "Category is not created." });
|
@@ -841,21 +864,23 @@ var categories_routes = function(app, db) {
|
|
841
864
|
);
|
842
865
|
};
|
843
866
|
const categories_routes$1 = /* @__PURE__ */ getDefaultExportFromCjs(categories_routes);
|
844
|
-
const ObjectId = require$$0.Types.ObjectId;
|
845
867
|
const controllerFactory$1 = (db) => {
|
846
868
|
const Leftover = db.leftover;
|
847
869
|
const getAll = async (req, res) => {
|
848
870
|
try {
|
849
871
|
let query = {};
|
850
872
|
let options = {};
|
851
|
-
if (req.query.organization)
|
852
|
-
query.organization = new ObjectId(req.query.organization);
|
853
|
-
|
873
|
+
if (req.query.organization) {
|
874
|
+
query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
|
875
|
+
}
|
876
|
+
console.log(query);
|
877
|
+
const leftoveres = await Leftover.find(query, null, options).sort({ createdAt: "desc" }).exec();
|
854
878
|
if (!leftoveres) {
|
855
879
|
return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
|
856
880
|
}
|
857
881
|
res.status(200).send(leftoveres);
|
858
882
|
} catch (err) {
|
883
|
+
console.error(err);
|
859
884
|
res.status(500).send({ message: "ERROR_GET_ALL_LEFTOVERES" });
|
860
885
|
}
|
861
886
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue.cjs");const u=["disabled"],d={key:
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./Button.vue.cjs");const u=["disabled"],d={key:1,class:"loading"},m=e.createElementVNode("svg",{class:"i-regular",width:"135",height:"140",viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:"#fff"},[e.createElementVNode("rect",{y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"60",width:"15",height:"140",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})]),e.createElementVNode("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},[e.createElementVNode("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),e.createTextVNode(),e.createElementVNode("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})])],-1),b=[m],h={key:2,class:"t-semi loading t-black"},f={key:3,class:"error"},g={key:0,class:"button-counter"},v={__name:"Button",props:{submit:{type:Function,default:async()=>{console.log("Button click.")}},text:{type:Object,default:t=>(console.log(t),t={...t.text,success:"✔",error:"✖"})},counter:{type:Object},callback:{type:Function,default:async()=>{console.log("Button callback.")}},callbackDelay:{type:Number,default:750},showSucces:{type:Boolean,default:!0},showLoader:{type:Boolean,default:!0},validation:{type:Boolean,default:!1}},setup(t){const n=t,a=e.ref(null),l=e.ref(null),o=e.ref(!1),r=e.ref(!1);async function c(){a.value.style["pointer-events"]="none",l.value=null,o.value=!0;const i=()=>{a.value&&(a.value.classList.replace("bg-second","bg-main"),a.value.style.pointerEvents="auto",o.value=!1,r.value=!1,l.value=null)};try{await n.submit(),a.value.classList.replace("bg-main","bg-second"),o.value=!1,n.showSucces?(r.value=!0,setTimeout(i,500)):i(),n.callback&&setTimeout(()=>n.callback(),n.callbackDelay)}catch{a.value.classList.replace("bg-main","bg-fourth-nano"),l.value=n.error,setTimeout(()=>{i(),a.value.classList.replace("bg-fourth-nano","bg-main")},1330)}}return(i,s)=>(e.openBlock(),e.createElementBlock("button",{onClick:e.withModifiers(c,["stop"]),disabled:t.validation,ref_key:"button",ref:a,class:"button"},[e.createVNode(e.Transition,{name:"moveFromTopAbsolute"},{default:e.withCtx(()=>[!o.value&&!l.value&&!r.value||!t.showLoader?e.renderSlot(i.$slots,"default",{key:0}):o.value&&!l.value&&t.showLoader?(e.openBlock(),e.createElementBlock("span",d,b)):r.value&&t.showSucces?(e.openBlock(),e.createElementBlock("span",h,e.toDisplayString(t.text.success),1)):l.value?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)]),_:3}),t.counter?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(t.counter),1)):e.createCommentVNode("",!0)],8,u))}};exports.default=v;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { ref as d, openBlock as
|
1
|
+
import { ref as d, openBlock as u, createElementBlock as o, withModifiers as v, createVNode as g, Transition as y, withCtx as p, renderSlot as w, toDisplayString as b, createCommentVNode as h, createElementVNode as e, createTextVNode as r } from "vue";
|
2
2
|
import "./Button.vue.js";
|
3
|
-
const k = ["disabled"], x = {
|
3
|
+
const k = ["disabled"], x = {
|
4
4
|
key: 1,
|
5
5
|
class: "loading"
|
6
|
-
},
|
6
|
+
}, N = /* @__PURE__ */ e("svg", {
|
7
7
|
class: "i-regular",
|
8
8
|
width: "135",
|
9
9
|
height: "140",
|
@@ -134,18 +134,18 @@ const k = ["disabled"], x = { key: 0 }, N = {
|
|
134
134
|
repeatCount: "indefinite"
|
135
135
|
})
|
136
136
|
])
|
137
|
-
], -1),
|
138
|
-
|
139
|
-
],
|
137
|
+
], -1), C = [
|
138
|
+
N
|
139
|
+
], M = {
|
140
140
|
key: 2,
|
141
141
|
class: "t-semi loading t-black"
|
142
|
-
},
|
142
|
+
}, B = {
|
143
143
|
key: 3,
|
144
144
|
class: "error"
|
145
145
|
}, L = {
|
146
146
|
key: 0,
|
147
147
|
class: "button-counter"
|
148
|
-
},
|
148
|
+
}, T = {
|
149
149
|
__name: "Button",
|
150
150
|
props: {
|
151
151
|
submit: {
|
@@ -189,21 +189,21 @@ const k = ["disabled"], x = { key: 0 }, N = {
|
|
189
189
|
}
|
190
190
|
},
|
191
191
|
setup(t) {
|
192
|
-
const n = t, a = d(null), i = d(null),
|
192
|
+
const n = t, a = d(null), i = d(null), l = d(!1), c = d(!1);
|
193
193
|
async function f() {
|
194
|
-
a.value.style["pointer-events"] = "none", i.value = null,
|
195
|
-
const
|
196
|
-
a.value && (a.value.classList.replace("bg-second", "bg-main"), a.value.style.pointerEvents = "auto",
|
194
|
+
a.value.style["pointer-events"] = "none", i.value = null, l.value = !0;
|
195
|
+
const s = () => {
|
196
|
+
a.value && (a.value.classList.replace("bg-second", "bg-main"), a.value.style.pointerEvents = "auto", l.value = !1, c.value = !1, i.value = null);
|
197
197
|
};
|
198
198
|
try {
|
199
|
-
await n.submit(), a.value.classList.replace("bg-main", "bg-second"),
|
199
|
+
await n.submit(), a.value.classList.replace("bg-main", "bg-second"), l.value = !1, n.showSucces ? (c.value = !0, setTimeout(s, 500)) : s(), n.callback && setTimeout(() => n.callback(), n.callbackDelay);
|
200
200
|
} catch {
|
201
201
|
a.value.classList.replace("bg-main", "bg-fourth-nano"), i.value = n.error, setTimeout(() => {
|
202
|
-
|
202
|
+
s(), a.value.classList.replace("bg-fourth-nano", "bg-main");
|
203
203
|
}, 1330);
|
204
204
|
}
|
205
205
|
}
|
206
|
-
return (
|
206
|
+
return (s, m) => (u(), o("button", {
|
207
207
|
onClick: v(f, ["stop"]),
|
208
208
|
disabled: t.validation,
|
209
209
|
ref_key: "button",
|
@@ -212,16 +212,14 @@ const k = ["disabled"], x = { key: 0 }, N = {
|
|
212
212
|
}, [
|
213
213
|
g(y, { name: "moveFromTopAbsolute" }, {
|
214
214
|
default: p(() => [
|
215
|
-
!
|
216
|
-
w(u.$slots, "default")
|
217
|
-
])) : o.value && !i.value && t.showLoader ? (l(), s("span", N, M)) : c.value && t.showSucces ? (l(), s("span", B, h(t.text.success), 1)) : i.value ? (l(), s("span", _, h(i.value), 1)) : b("", !0)
|
215
|
+
!l.value && !i.value && !c.value || !t.showLoader ? w(s.$slots, "default", { key: 0 }) : l.value && !i.value && t.showLoader ? (u(), o("span", x, C)) : c.value && t.showSucces ? (u(), o("span", M, b(t.text.success), 1)) : i.value ? (u(), o("span", B, b(i.value), 1)) : h("", !0)
|
218
216
|
]),
|
219
217
|
_: 3
|
220
218
|
}),
|
221
|
-
t.counter ? (
|
219
|
+
t.counter ? (u(), o("p", L, b(t.counter), 1)) : h("", !0)
|
222
220
|
], 8, k));
|
223
221
|
}
|
224
222
|
};
|
225
223
|
export {
|
226
|
-
|
224
|
+
T as default
|
227
225
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue.cjs");const f=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const v={__name:"Feed",props:{showLoadMore:{type:Boolean,default:!0},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(i){const a=i,
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../../modules/icons/skeletons/SkeletonEvent.vue.cjs");require("../Loader/Loader.vue.cjs");const f=require("../EmptyState/EmptyState.vue.cjs");require("vue-i18n");const v={__name:"Feed",props:{showLoadMore:{type:Boolean,default:!0},states:{type:Object,default:()=>({empty:{title:String,description:String}})},store:{type:Object,default:()=>({read:Function,state:Object})},options:{type:Object,default:()=>({category:null,limit:20,skip:0,owner:null,creator:null,user:null,status:null,period:null,contain:null})}},setup(i){const a=i,r=e.ref([]),l=e.ref(!1);let s=e.ref(!0),u=e.ref(a.options.skip?a.options.skip:0),o=e.ref(a.options.limit?a.options.limit:10);const d=async()=>{if(l.value){u.value+=o.value;const t=await a.store.read({skip:u.value,limit:o.value,...a.options});t.length===0||t.length<o.value?l.value=!1:l.value=!0,r.value=[...r.value,...t]}},c=async()=>{const t=await a.store.read({skip:u.value,limit:o.value,...a.options});t.length===0||t.length<o.value?l.value=!1:l.value=!0,console.log(t),r.value=t,s.value=!1};return e.watch(()=>a.options,(t,n)=>{(t.organization!==n.organization||t.categories!==n.categories||t.prices!==n.prices||t.delivery!==n.delivery||t.search!==n.search)&&c()},{deep:!0}),e.onMounted(async()=>{await c()}),(t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:0,tag:"ul",name:"scaleTransition",class:"o-hidden bg-grey radius-big"},{default:e.withCtx(()=>[e.unref(s)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o),m=>(e.openBlock(),e.createBlock(p.default,{key:m}))),128)):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"scaleTransition"},{default:e.withCtx(()=>[!e.unref(s)&&r.value.length<1?(e.openBlock(),e.createBlock(f.default,{key:0,title:i.states.empty.title,description:i.states.empty.description,class:"pd-medium mn-b-thin bg-grey radius-big"},null,8,["title","description"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{tag:"ul",name:"scaleTransition",class:e.normalizeClass(t.$attrs.class)},{default:e.withCtx(()=>[!e.unref(s)&&r.value.length>0?e.renderSlot(t.$slots,"default",{key:0,items:r.value,user:t.user}):e.createCommentVNode("",!0),i.showLoadMore&&l.value&&r.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:d,class:"col-w-100 w-100 bg-main button"}," Load more ")):e.createCommentVNode("",!0)]),_:3},8,["class"])],64))}};exports.default=v;
|