@ozdao/martyrs 0.2.458 → 0.2.460
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Media-Df1hO2ZT.mjs → Media-BKlUty0j.mjs} +1 -1
- package/dist/{Media-B9V7fmz-.js → Media-ChTgw58S.js} +1 -1
- package/dist/chats.server.js +11 -18
- package/dist/chats.server.mjs +11 -18
- package/dist/globals.server.js +104 -1
- package/dist/globals.server.mjs +104 -1
- package/dist/{main-DviXUDiB.js → main-DIXWgUWx.js} +2 -2
- package/dist/{main-DbrX42CV.mjs → main-Q8Dr1-HT.mjs} +2 -2
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs +93 -0
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js +94 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs +0 -93
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js +1 -94
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.cjs → SelectMulti.vue.cjs} +2 -2
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.js.map → SelectMulti.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/SelectMulti/{SelectMulti.vue2.js → SelectMulti.vue.js} +2 -2
- package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js.map +1 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +1 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js +1 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs +2 -2
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +2 -2
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +2 -2
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +45 -37
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +46 -38
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +8 -7
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js +8 -7
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.cjs +4 -3
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.js +5 -4
- package/dist/martyrs/src/modules/icons/entities/IconTime.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs +2 -61
- package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/notifications.client.js +2 -61
- package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -0
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +2 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/sections/AskToLogin.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +12 -16
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +15 -19
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +3 -3
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +3 -3
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +2 -2
- package/dist/notifications.server.mjs +2 -2
- package/dist/orders.server.js +124 -109
- package/dist/orders.server.mjs +124 -109
- package/dist/style.css +12 -99
- package/package.json +1 -1
- package/src/components/Feed/Feed.vue +1 -1
- package/src/modules/chats/components/sections/ChatWindow.vue +1 -0
- package/src/modules/chats/routes/chats.routes.js +10 -20
- package/src/modules/chats/store/chat.store.js +1 -1
- package/src/modules/community/components/layouts/Community.vue +2 -5
- package/src/modules/community/components/sections/Comment.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.websocket.js +116 -0
- package/src/modules/globals/globals.server.js +3 -0
- package/src/modules/globals/views/components/blocks/CardHeader.vue +1 -1
- package/src/modules/globals/views/components/partials/Navigation.vue +67 -149
- package/src/modules/globals/views/components/partials/Sidebar.vue +7 -37
- package/src/modules/globals/views/plugins/AlertDialog.vue +1 -1
- package/src/modules/icons/entities/IconTime.vue +1 -1
- package/src/modules/notifications/notifications.client.js +2 -79
- package/src/modules/notifications/services/notification.service.js +1 -1
- package/src/modules/orders/components/pages/OrderCreate.vue +6 -1
- package/src/modules/orders/components/partials/ShopCart.vue +1 -1
- package/src/modules/orders/components/sections/AskToLogin.vue +2 -1
- package/src/modules/orders/controllers/orders.controller.js +49 -35
- package/src/modules/organizations/components/blocks/CardOrganization.vue +10 -9
- package/src/modules/products/components/pages/Product.vue +3 -3
- package/src/styles/base/all.scss +19 -5
- package/src/styles/base/shadow_transitions_hover_refactor.scss +0 -30
- package/src/styles/base/transitions.scss +109 -0
- package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.cjs.map +0 -1
- package/src/components/AskToLogin/AskToLogin.vue +0 -22
package/dist/orders.server.mjs
CHANGED
|
@@ -14,15 +14,15 @@ function requireOrder_model() {
|
|
|
14
14
|
if (hasRequiredOrder_model) return order_model;
|
|
15
15
|
hasRequiredOrder_model = 1;
|
|
16
16
|
const applyOwnershipSchema = requireOwnership_schema();
|
|
17
|
-
order_model = (
|
|
18
|
-
const OrderSchema = new
|
|
17
|
+
order_model = (db) => {
|
|
18
|
+
const OrderSchema = new db.mongoose.Schema({
|
|
19
19
|
customer: {
|
|
20
20
|
type: {
|
|
21
21
|
type: String,
|
|
22
22
|
required: true
|
|
23
23
|
},
|
|
24
24
|
target: {
|
|
25
|
-
type:
|
|
25
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
26
26
|
refPath: "customer.type",
|
|
27
27
|
required: true
|
|
28
28
|
}
|
|
@@ -47,7 +47,7 @@ function requireOrder_model() {
|
|
|
47
47
|
trim: true
|
|
48
48
|
},
|
|
49
49
|
user: {
|
|
50
|
-
type:
|
|
50
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
51
51
|
ref: "User"
|
|
52
52
|
},
|
|
53
53
|
timestamp: {
|
|
@@ -85,7 +85,7 @@ function requireOrder_model() {
|
|
|
85
85
|
trim: true
|
|
86
86
|
},
|
|
87
87
|
spot: {
|
|
88
|
-
type:
|
|
88
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
89
89
|
ref: "User"
|
|
90
90
|
},
|
|
91
91
|
status: {
|
|
@@ -98,8 +98,8 @@ function requireOrder_model() {
|
|
|
98
98
|
currentTime: () => Date.now()
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
-
applyOwnershipSchema(OrderSchema,
|
|
102
|
-
const Order =
|
|
101
|
+
applyOwnershipSchema(OrderSchema, db);
|
|
102
|
+
const Order = db.mongoose.model("Order", OrderSchema);
|
|
103
103
|
return Order;
|
|
104
104
|
};
|
|
105
105
|
return order_model;
|
|
@@ -112,8 +112,8 @@ function requireCustomer_model() {
|
|
|
112
112
|
const applyOwnershipSchema = requireOwnership_schema();
|
|
113
113
|
const applyProfileSchema = requireProfile_schema();
|
|
114
114
|
const applyCredentialsSchema = requireCredentials_schema();
|
|
115
|
-
customer_model = (
|
|
116
|
-
const CustomerSchema = new
|
|
115
|
+
customer_model = (db) => {
|
|
116
|
+
const CustomerSchema = new db.mongoose.Schema({
|
|
117
117
|
identity: {
|
|
118
118
|
type: {
|
|
119
119
|
type: String,
|
|
@@ -121,7 +121,7 @@ function requireCustomer_model() {
|
|
|
121
121
|
required: true
|
|
122
122
|
},
|
|
123
123
|
target: {
|
|
124
|
-
type:
|
|
124
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
125
125
|
refPath: "target.type"
|
|
126
126
|
}
|
|
127
127
|
},
|
|
@@ -135,9 +135,9 @@ function requireCustomer_model() {
|
|
|
135
135
|
currentTime: () => Date.now()
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
|
-
applyCredentialsSchema(CustomerSchema,
|
|
139
|
-
applyProfileSchema(CustomerSchema,
|
|
140
|
-
applyOwnershipSchema(CustomerSchema,
|
|
138
|
+
applyCredentialsSchema(CustomerSchema, db);
|
|
139
|
+
applyProfileSchema(CustomerSchema, db);
|
|
140
|
+
applyOwnershipSchema(CustomerSchema, db);
|
|
141
141
|
CustomerSchema.index({
|
|
142
142
|
owner: 1,
|
|
143
143
|
email: 1
|
|
@@ -165,7 +165,7 @@ function requireCustomer_model() {
|
|
|
165
165
|
identity: { $exists: true, $ne: "" }
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
-
const Customer =
|
|
168
|
+
const Customer = db.mongoose.model("Customer", CustomerSchema);
|
|
169
169
|
return Customer;
|
|
170
170
|
};
|
|
171
171
|
return customer_model;
|
|
@@ -175,13 +175,13 @@ var hasRequiredTestimonial_model;
|
|
|
175
175
|
function requireTestimonial_model() {
|
|
176
176
|
if (hasRequiredTestimonial_model) return testimonial_model;
|
|
177
177
|
hasRequiredTestimonial_model = 1;
|
|
178
|
-
testimonial_model = (
|
|
179
|
-
const testimonialSchema = new
|
|
178
|
+
testimonial_model = (db) => {
|
|
179
|
+
const testimonialSchema = new db.mongoose.Schema({
|
|
180
180
|
source: {
|
|
181
181
|
type: String
|
|
182
182
|
},
|
|
183
183
|
author: {
|
|
184
|
-
type:
|
|
184
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
185
185
|
ref: "User",
|
|
186
186
|
required: true
|
|
187
187
|
},
|
|
@@ -194,7 +194,7 @@ function requireTestimonial_model() {
|
|
|
194
194
|
required: true
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
|
-
const Testimonial =
|
|
197
|
+
const Testimonial = db.mongoose.model("Testimonial", testimonialSchema);
|
|
198
198
|
return Testimonial;
|
|
199
199
|
};
|
|
200
200
|
return testimonial_model;
|
|
@@ -204,8 +204,8 @@ var hasRequiredApplication_model;
|
|
|
204
204
|
function requireApplication_model() {
|
|
205
205
|
if (hasRequiredApplication_model) return application_model;
|
|
206
206
|
hasRequiredApplication_model = 1;
|
|
207
|
-
application_model = (
|
|
208
|
-
const ApplicationSchema = new
|
|
207
|
+
application_model = (db) => {
|
|
208
|
+
const ApplicationSchema = new db.mongoose.Schema({
|
|
209
209
|
status: {
|
|
210
210
|
type: String,
|
|
211
211
|
default: "created"
|
|
@@ -228,7 +228,7 @@ function requireApplication_model() {
|
|
|
228
228
|
}, {
|
|
229
229
|
timestamps: { currentTime: () => Date.now() }
|
|
230
230
|
});
|
|
231
|
-
const Application =
|
|
231
|
+
const Application = db.mongoose.model("Application", ApplicationSchema);
|
|
232
232
|
return Application;
|
|
233
233
|
};
|
|
234
234
|
return application_model;
|
|
@@ -274,18 +274,14 @@ ${formatPositions(order.positions)}
|
|
|
274
274
|
let creatorType = customerInfo.creator?.type || orderCreator.type;
|
|
275
275
|
let creatorTarget = customerInfo.creator?.target || orderCreator.target;
|
|
276
276
|
if (!creatorTarget) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else if (creatorType === "Visitor") {
|
|
280
|
-
const fingerprint = generateFingerprint(req);
|
|
281
|
-
creatorTarget = fingerprint;
|
|
282
|
-
} else {
|
|
283
|
-
creatorType = orderOwner.type;
|
|
284
|
-
creatorTarget = orderOwner.target;
|
|
285
|
-
}
|
|
277
|
+
creatorType = orderOwner.type;
|
|
278
|
+
creatorTarget = orderOwner.target;
|
|
286
279
|
}
|
|
287
280
|
const newCustomerData = {
|
|
288
281
|
...customerInfo,
|
|
282
|
+
// Ensure we're not passing any null _id that might override MongoDB's auto-generation
|
|
283
|
+
_id: void 0,
|
|
284
|
+
// Let MongoDB generate this
|
|
289
285
|
owner: orderOwner,
|
|
290
286
|
creator: {
|
|
291
287
|
type: creatorType,
|
|
@@ -296,7 +292,16 @@ ${formatPositions(order.positions)}
|
|
|
296
292
|
target: customerInfo.identity?.target || creatorTarget
|
|
297
293
|
}
|
|
298
294
|
};
|
|
299
|
-
|
|
295
|
+
try {
|
|
296
|
+
customer = await Customer.create(newCustomerData);
|
|
297
|
+
if (!customer || !customer._id) {
|
|
298
|
+
console.error("Customer creation failed to generate _id:", customer);
|
|
299
|
+
throw new Error("Customer creation did not generate a valid _id");
|
|
300
|
+
}
|
|
301
|
+
} catch (err) {
|
|
302
|
+
console.error("Error creating customer:", err);
|
|
303
|
+
throw err;
|
|
304
|
+
}
|
|
300
305
|
}
|
|
301
306
|
return customer;
|
|
302
307
|
}
|
|
@@ -308,32 +313,42 @@ ${formatPositions(order.positions)}
|
|
|
308
313
|
console.error(err);
|
|
309
314
|
}
|
|
310
315
|
}
|
|
311
|
-
const controllerFactory = (
|
|
312
|
-
const Order =
|
|
313
|
-
const Customer =
|
|
314
|
-
|
|
315
|
-
const create = async (
|
|
316
|
-
const orderData =
|
|
317
|
-
|
|
316
|
+
const controllerFactory = (db) => {
|
|
317
|
+
const Order = db.order;
|
|
318
|
+
const Customer = db.customer;
|
|
319
|
+
db.leftover;
|
|
320
|
+
const create = async (req, res) => {
|
|
321
|
+
const orderData = req.body;
|
|
322
|
+
req.userId || req.body.creator?.target;
|
|
318
323
|
orderData.status = "created";
|
|
319
324
|
orderData.status_history = orderData.status_history || [];
|
|
320
325
|
orderData.status_history.push({
|
|
321
326
|
status: orderData.status,
|
|
322
|
-
// user: new db.mongoose.Types.ObjectId(userId),
|
|
323
327
|
timestamp: /* @__PURE__ */ new Date(),
|
|
324
328
|
comment: ""
|
|
325
329
|
});
|
|
326
|
-
|
|
330
|
+
console.log("order.data is,", orderData);
|
|
331
|
+
const session = await db.mongoose.startSession();
|
|
327
332
|
session.startTransaction();
|
|
328
333
|
try {
|
|
329
334
|
if (!orderData.customer.target) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (!
|
|
333
|
-
|
|
335
|
+
const customer = await findOrCreateCustomer(Customer, orderData.customer, orderData.owner, orderData.creator);
|
|
336
|
+
console.log("customer is", customer);
|
|
337
|
+
if (!customer || !customer._id) {
|
|
338
|
+
throw new Error("Failed to create or find a valid customer");
|
|
339
|
+
}
|
|
340
|
+
orderData.customer = {
|
|
341
|
+
type: "Customer",
|
|
342
|
+
target: customer._id
|
|
343
|
+
};
|
|
344
|
+
if (!orderData.creator || !orderData.creator.target) {
|
|
345
|
+
orderData.creator = {
|
|
346
|
+
type: "Customer",
|
|
347
|
+
target: customer._id
|
|
348
|
+
};
|
|
334
349
|
}
|
|
335
350
|
}
|
|
336
|
-
console.log(orderData);
|
|
351
|
+
console.log("Order data after customer processing:", orderData);
|
|
337
352
|
const order = await Order.create([orderData], { session });
|
|
338
353
|
const createdOrder = order[0];
|
|
339
354
|
if (orderData.positions && orderData.positions.length > 0) {
|
|
@@ -395,14 +410,14 @@ ${formatPositions(order.positions)}
|
|
|
395
410
|
session.endSession();
|
|
396
411
|
}
|
|
397
412
|
};
|
|
398
|
-
const read = async (
|
|
399
|
-
console.log(
|
|
413
|
+
const read = async (req, res) => {
|
|
414
|
+
console.log(req.query);
|
|
400
415
|
let stages = [
|
|
401
416
|
...queryProcessorGlobals.getBasicOptions(
|
|
402
|
-
|
|
417
|
+
req.query
|
|
403
418
|
),
|
|
404
419
|
...queryProcessorGlobals.getSearchOptions(
|
|
405
|
-
|
|
420
|
+
req.query.search,
|
|
406
421
|
{
|
|
407
422
|
fields: ["positions.name"]
|
|
408
423
|
}
|
|
@@ -440,12 +455,12 @@ ${formatPositions(order.positions)}
|
|
|
440
455
|
queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
|
|
441
456
|
// Pagination
|
|
442
457
|
...queryProcessorGlobals.getSortingOptions(
|
|
443
|
-
|
|
444
|
-
|
|
458
|
+
req.query.sortParam,
|
|
459
|
+
req.query.sortOrder
|
|
445
460
|
),
|
|
446
461
|
...queryProcessorGlobals.getPaginationOptions(
|
|
447
|
-
|
|
448
|
-
|
|
462
|
+
req.query.skip,
|
|
463
|
+
req.query.limit
|
|
449
464
|
)
|
|
450
465
|
];
|
|
451
466
|
try {
|
|
@@ -459,27 +474,27 @@ ${formatPositions(order.positions)}
|
|
|
459
474
|
res.status(500).send({ errorCode: "GET_ORDERS_FAILED", message: "Error occurred while fetching orders.", error: err });
|
|
460
475
|
}
|
|
461
476
|
};
|
|
462
|
-
const update = async (
|
|
477
|
+
const update = async (req, res) => {
|
|
463
478
|
try {
|
|
464
|
-
const order = await Order.findOne({ _id:
|
|
479
|
+
const order = await Order.findOne({ _id: req.body._id });
|
|
465
480
|
if (!order) {
|
|
466
481
|
return res.status(404).send({ errorCode: "ORDER_NOT_FOUND", message: "Order not found." });
|
|
467
482
|
}
|
|
468
|
-
const statusChanged =
|
|
483
|
+
const statusChanged = req.body.status && req.body.status !== order.status;
|
|
469
484
|
const oldStatus = order.status;
|
|
470
485
|
if (statusChanged) {
|
|
471
|
-
order.status =
|
|
486
|
+
order.status = req.body.status;
|
|
472
487
|
order.status_history.push({
|
|
473
|
-
status:
|
|
488
|
+
status: req.body.status,
|
|
474
489
|
timestamp: /* @__PURE__ */ new Date(),
|
|
475
490
|
comment: ""
|
|
476
491
|
});
|
|
477
492
|
}
|
|
478
|
-
if (
|
|
479
|
-
order.payment.type =
|
|
493
|
+
if (req.body.payment?.type && req.body.payment.type !== order.payment?.type) {
|
|
494
|
+
order.payment.type = req.body.payment.type;
|
|
480
495
|
}
|
|
481
|
-
if (
|
|
482
|
-
order.payment.status =
|
|
496
|
+
if (req.body.payment?.status && req.body.payment.status !== order.payment?.status) {
|
|
497
|
+
order.payment.status = req.body.payment.status;
|
|
483
498
|
}
|
|
484
499
|
await order.save();
|
|
485
500
|
if (statusChanged) {
|
|
@@ -522,10 +537,10 @@ ${formatPositions(order.positions)}
|
|
|
522
537
|
});
|
|
523
538
|
}
|
|
524
539
|
};
|
|
525
|
-
const changePaymentStatus = async (
|
|
540
|
+
const changePaymentStatus = async (req, res) => {
|
|
526
541
|
try {
|
|
527
542
|
const order = await Order.findOneAndUpdate(
|
|
528
|
-
{ _id:
|
|
543
|
+
{ _id: req.params._id },
|
|
529
544
|
{ status: "closed", payment: { type: "Cash", status: "paid" } },
|
|
530
545
|
{ new: true }
|
|
531
546
|
).exec();
|
|
@@ -537,9 +552,9 @@ ${formatPositions(order.positions)}
|
|
|
537
552
|
res.status(500).send({ errorCode: "CHANGE_PAYMENT_STATUS_FAILED", message: "Error occurred while changing the payment status.", error: err });
|
|
538
553
|
}
|
|
539
554
|
};
|
|
540
|
-
const deleteOrder = async (
|
|
555
|
+
const deleteOrder = async (req, res) => {
|
|
541
556
|
try {
|
|
542
|
-
const order = await Order.findOneAndDelete({ _id:
|
|
557
|
+
const order = await Order.findOneAndDelete({ _id: req.params._id }).exec();
|
|
543
558
|
if (!order) {
|
|
544
559
|
return res.status(404).send({ errorCode: "ORDER_DELETE_FAILED", message: "Failed to delete the order." });
|
|
545
560
|
}
|
|
@@ -566,9 +581,9 @@ function requireOrders_routes() {
|
|
|
566
581
|
hasRequiredOrders_routes = 1;
|
|
567
582
|
const controllerFactory = requireOrders_controller();
|
|
568
583
|
const middlewareFactoryAuth = requireMiddlewares();
|
|
569
|
-
orders_routes = function(app,
|
|
570
|
-
const controller = controllerFactory(
|
|
571
|
-
middlewareFactoryAuth(
|
|
584
|
+
orders_routes = function(app, db, origins, publicPath) {
|
|
585
|
+
const controller = controllerFactory(db);
|
|
586
|
+
middlewareFactoryAuth(db);
|
|
572
587
|
app.post(
|
|
573
588
|
"/api/orders/create",
|
|
574
589
|
// [
|
|
@@ -604,9 +619,9 @@ function requireApplications_controller() {
|
|
|
604
619
|
hasRequiredApplications_controller = 1;
|
|
605
620
|
const axios = require$$0;
|
|
606
621
|
const { sendChatMessageTelegram } = requireMailing();
|
|
607
|
-
const middlewareFactory = (
|
|
608
|
-
const Application =
|
|
609
|
-
const read = async (
|
|
622
|
+
const middlewareFactory = (db) => {
|
|
623
|
+
const Application = db.application;
|
|
624
|
+
const read = async (req, res) => {
|
|
610
625
|
try {
|
|
611
626
|
const applications = await Application.find({});
|
|
612
627
|
if (!applications) {
|
|
@@ -617,14 +632,14 @@ function requireApplications_controller() {
|
|
|
617
632
|
res.status(500).send({ message: err });
|
|
618
633
|
}
|
|
619
634
|
};
|
|
620
|
-
const create = async (
|
|
635
|
+
const create = async (req, res) => {
|
|
621
636
|
try {
|
|
622
|
-
const application = await Application.create(
|
|
637
|
+
const application = await Application.create(req.body);
|
|
623
638
|
if (!application) {
|
|
624
639
|
return res.status(404).send({ message: "Something wrong when creating application." });
|
|
625
640
|
}
|
|
626
641
|
try {
|
|
627
|
-
const messageSent = await sendChatMessageTelegram(process.env.TELEGRAM_BOT_USERS.split(","), `New application from ${
|
|
642
|
+
const messageSent = await sendChatMessageTelegram(process.env.TELEGRAM_BOT_USERS.split(","), `New application from ${req.body}`);
|
|
628
643
|
} catch (err) {
|
|
629
644
|
console.log(err);
|
|
630
645
|
}
|
|
@@ -633,9 +648,9 @@ function requireApplications_controller() {
|
|
|
633
648
|
res.status(500).send({ message: err });
|
|
634
649
|
}
|
|
635
650
|
};
|
|
636
|
-
const update = async (
|
|
651
|
+
const update = async (req, res) => {
|
|
637
652
|
try {
|
|
638
|
-
const application = await Application.findOneAndUpdate({ _id:
|
|
653
|
+
const application = await Application.findOneAndUpdate({ _id: req.params._id }, req.body, { new: true });
|
|
639
654
|
if (!application) {
|
|
640
655
|
return res.status(404).send({ message: "Application not found." });
|
|
641
656
|
}
|
|
@@ -644,9 +659,9 @@ function requireApplications_controller() {
|
|
|
644
659
|
res.status(500).send({ message: err });
|
|
645
660
|
}
|
|
646
661
|
};
|
|
647
|
-
const deleteMethod = async (
|
|
662
|
+
const deleteMethod = async (req, res) => {
|
|
648
663
|
try {
|
|
649
|
-
const application = await Application.findOneAndDelete({ _id:
|
|
664
|
+
const application = await Application.findOneAndDelete({ _id: req.params._id });
|
|
650
665
|
if (!application) {
|
|
651
666
|
return res.status(404).send({ message: "Something wrong when deleting application." });
|
|
652
667
|
}
|
|
@@ -655,9 +670,9 @@ function requireApplications_controller() {
|
|
|
655
670
|
res.status(500).send({ message: err });
|
|
656
671
|
}
|
|
657
672
|
};
|
|
658
|
-
const get = async (
|
|
673
|
+
const get = async (req, res) => {
|
|
659
674
|
try {
|
|
660
|
-
const application = await Application.findOne({ url:
|
|
675
|
+
const application = await Application.findOne({ url: req.params.url });
|
|
661
676
|
if (!application) {
|
|
662
677
|
return res.status(404).send({ message: "Application not found." });
|
|
663
678
|
}
|
|
@@ -666,8 +681,8 @@ function requireApplications_controller() {
|
|
|
666
681
|
res.status(500).send({ message: err });
|
|
667
682
|
}
|
|
668
683
|
};
|
|
669
|
-
const handleTelegramWebhook = async (
|
|
670
|
-
const update2 =
|
|
684
|
+
const handleTelegramWebhook = async (req, res) => {
|
|
685
|
+
const update2 = req.body;
|
|
671
686
|
if (update2.callback_query) {
|
|
672
687
|
const callbackQuery = update2.callback_query;
|
|
673
688
|
const callbackData = callbackQuery.data;
|
|
@@ -728,9 +743,9 @@ function requireApplications_routes() {
|
|
|
728
743
|
hasRequiredApplications_routes = 1;
|
|
729
744
|
const controllerFactory = requireApplications_controller();
|
|
730
745
|
const middlewareFactoryAuth = requireMiddlewares();
|
|
731
|
-
applications_routes = function(app,
|
|
732
|
-
const controller = controllerFactory(
|
|
733
|
-
const { authJwt } = middlewareFactoryAuth(
|
|
746
|
+
applications_routes = function(app, db, origins) {
|
|
747
|
+
const controller = controllerFactory(db);
|
|
748
|
+
const { authJwt } = middlewareFactoryAuth(db);
|
|
734
749
|
app.post(
|
|
735
750
|
"/applications",
|
|
736
751
|
controller.create
|
|
@@ -767,10 +782,10 @@ function requireGlobals_crud() {
|
|
|
767
782
|
const Cache = requireGlobals_cache();
|
|
768
783
|
const Logger = requireGlobals_logger();
|
|
769
784
|
class CRUD {
|
|
770
|
-
constructor(basePath, app,
|
|
785
|
+
constructor(basePath, app, db, model) {
|
|
771
786
|
this.model = model;
|
|
772
787
|
this.cache = new Cache();
|
|
773
|
-
this.logger = new Logger(
|
|
788
|
+
this.logger = new Logger(db);
|
|
774
789
|
this.app = app;
|
|
775
790
|
this.basePath = basePath;
|
|
776
791
|
this.registerRoutes();
|
|
@@ -781,9 +796,9 @@ function requireGlobals_crud() {
|
|
|
781
796
|
this.app.put(`${this.basePath}/update`, this.update.bind(this));
|
|
782
797
|
this.app.delete(`${this.basePath}/delete`, this.delete.bind(this));
|
|
783
798
|
}
|
|
784
|
-
async create(
|
|
799
|
+
async create(req, res) {
|
|
785
800
|
try {
|
|
786
|
-
const createdData = await this.model.create(
|
|
801
|
+
const createdData = await this.model.create(req.body);
|
|
787
802
|
await this.cache.flush();
|
|
788
803
|
res.status(201).json(createdData);
|
|
789
804
|
} catch (error) {
|
|
@@ -792,12 +807,12 @@ function requireGlobals_crud() {
|
|
|
792
807
|
res.status(500).json({ error: error.message });
|
|
793
808
|
}
|
|
794
809
|
}
|
|
795
|
-
async read(
|
|
810
|
+
async read(req, res) {
|
|
796
811
|
try {
|
|
797
812
|
let stages = [];
|
|
798
813
|
stages = [
|
|
799
814
|
...globalsQuery.getBasicOptions(
|
|
800
|
-
|
|
815
|
+
req.query
|
|
801
816
|
),
|
|
802
817
|
// For creator
|
|
803
818
|
globalsQuery.getCreatorUserLookupStage(),
|
|
@@ -808,12 +823,12 @@ function requireGlobals_crud() {
|
|
|
808
823
|
globalsQuery.getAddFieldsCreatorOwnerStage(),
|
|
809
824
|
// Pagination
|
|
810
825
|
...globalsQuery.getSortingOptions(
|
|
811
|
-
|
|
812
|
-
|
|
826
|
+
req.query.sortParam,
|
|
827
|
+
req.query.sortOrder
|
|
813
828
|
),
|
|
814
829
|
...globalsQuery.getPaginationOptions(
|
|
815
|
-
|
|
816
|
-
|
|
830
|
+
req.query.skip,
|
|
831
|
+
req.query.limit
|
|
817
832
|
),
|
|
818
833
|
globalsQuery.removeTempPropeties()
|
|
819
834
|
];
|
|
@@ -829,11 +844,11 @@ function requireGlobals_crud() {
|
|
|
829
844
|
res.status(500).json({ error: error.message });
|
|
830
845
|
}
|
|
831
846
|
}
|
|
832
|
-
async update(
|
|
847
|
+
async update(req, res) {
|
|
833
848
|
try {
|
|
834
849
|
const updatedData = await this.model.findOneAndUpdate(
|
|
835
|
-
{ _id:
|
|
836
|
-
|
|
850
|
+
{ _id: req.body._id },
|
|
851
|
+
req.body,
|
|
837
852
|
{ new: true, runValidators: true }
|
|
838
853
|
);
|
|
839
854
|
if (!updatedData) {
|
|
@@ -846,9 +861,9 @@ function requireGlobals_crud() {
|
|
|
846
861
|
res.status(404).json({ error: error.message });
|
|
847
862
|
}
|
|
848
863
|
}
|
|
849
|
-
async delete(
|
|
864
|
+
async delete(req, res) {
|
|
850
865
|
try {
|
|
851
|
-
const deletedData = await this.model.findOneAndDelete({ _id:
|
|
866
|
+
const deletedData = await this.model.findOneAndDelete({ _id: req.body._id });
|
|
852
867
|
if (!deletedData) {
|
|
853
868
|
throw new Error("Документ не найден.");
|
|
854
869
|
}
|
|
@@ -876,15 +891,15 @@ function requireOrders_server() {
|
|
|
876
891
|
const RoutesApplications = requireApplications_routes();
|
|
877
892
|
const FactoryOrder = requireOrders_controller();
|
|
878
893
|
const CRUD = requireGlobals_crud();
|
|
879
|
-
function initializeOrders(app,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
894
|
+
function initializeOrders(app, db, origins, publicPath) {
|
|
895
|
+
db.order = ModelOrder(db);
|
|
896
|
+
db.customer = ModelCustomer(db);
|
|
897
|
+
db.testimonial = ModelTestimonial(db);
|
|
898
|
+
db.application = ModelApplication(db);
|
|
884
899
|
if (app) {
|
|
885
|
-
RoutesOrder(app,
|
|
886
|
-
RoutesApplications(app,
|
|
887
|
-
new CRUD("/api/customers", app,
|
|
900
|
+
RoutesOrder(app, db, origins, publicPath);
|
|
901
|
+
RoutesApplications(app, db, origins, publicPath);
|
|
902
|
+
new CRUD("/api/customers", app, db, db.customer);
|
|
888
903
|
}
|
|
889
904
|
}
|
|
890
905
|
orders_server$1 = {
|
package/dist/style.css
CHANGED
|
@@ -1421,141 +1421,54 @@ div.vue-tags-input.disabled * {
|
|
|
1421
1421
|
transform: translateX(0%);
|
|
1422
1422
|
opacity: 1;
|
|
1423
1423
|
}
|
|
1424
|
-
.
|
|
1425
|
-
.sidebar-subitem-link:hover .sidebar-subitem-icon[data-v-f858259f] {
|
|
1426
|
-
transform: scale(1.1);
|
|
1427
|
-
}
|
|
1428
|
-
.sidebar-item-btn:hover .sidebar-item-icon[data-v-f858259f] {
|
|
1429
|
-
transform: scale(1.1);
|
|
1430
|
-
}
|
|
1431
|
-
.sidebar-subitem-link:hover .sidebar-subitem-icon[data-v-f858259f] {
|
|
1432
|
-
transform: scale(1.1);
|
|
1433
|
-
}
|
|
1434
|
-
.expanded-item[data-v-f858259f] {
|
|
1435
|
-
display: flex;
|
|
1436
|
-
align-items: center;
|
|
1437
|
-
width: 100%;
|
|
1438
|
-
border-radius: var(--small);
|
|
1439
|
-
}
|
|
1440
|
-
.sidebar-item-btn[data-v-f858259f] {
|
|
1441
|
-
align-items: center;
|
|
1442
|
-
border-radius: var(--small);
|
|
1443
|
-
transition: all 0.2s;
|
|
1444
|
-
position: relative;
|
|
1445
|
-
border: none;
|
|
1446
|
-
cursor: pointer;
|
|
1447
|
-
}
|
|
1448
|
-
.sidebar-item-title[data-v-f858259f] {
|
|
1449
|
-
font-weight: 500;
|
|
1450
|
-
transition: opacity 0.2s, width 0.2s;
|
|
1451
|
-
white-space: nowrap;
|
|
1452
|
-
}
|
|
1453
|
-
.sidebar-item-icon[data-v-f858259f] {
|
|
1454
|
-
font-size: 1.25rem;
|
|
1455
|
-
transition: transform 0.2s;
|
|
1456
|
-
}
|
|
1457
|
-
.sidebar-highlight-indicator[data-v-f858259f] {
|
|
1458
|
-
position: absolute;
|
|
1459
|
-
left: 0;
|
|
1460
|
-
width: 4px;
|
|
1461
|
-
height: 100%;
|
|
1462
|
-
border-radius: 0 var(--micro) var(--micro) 0;
|
|
1463
|
-
background: linear-gradient(to bottom, var(--second-regular), var(--second-small));
|
|
1464
|
-
transition: opacity 0.2s;
|
|
1465
|
-
}
|
|
1466
|
-
.sidebar-dropdown-icon[data-v-f858259f] {
|
|
1467
|
-
color: var(--grey-medium);
|
|
1468
|
-
transition: transform 0.2s;
|
|
1469
|
-
}
|
|
1470
|
-
.rotate-180[data-v-f858259f] {
|
|
1424
|
+
.rotate-180[data-v-c5803d2f] {
|
|
1471
1425
|
transform: rotate(180deg);
|
|
1472
1426
|
}
|
|
1473
|
-
.
|
|
1474
|
-
margin-top: var(--micro);
|
|
1475
|
-
margin-left: var(--semi);
|
|
1476
|
-
display: flex;
|
|
1477
|
-
flex-direction: column;
|
|
1478
|
-
gap: var(--micro);
|
|
1479
|
-
}
|
|
1480
|
-
.sidebar-subitem-link[data-v-f858259f] {
|
|
1481
|
-
display: flex;
|
|
1482
|
-
align-items: center;
|
|
1483
|
-
text-decoration: none;
|
|
1484
|
-
transition: all 0.2s;
|
|
1485
|
-
}
|
|
1486
|
-
.sidebar-subitem-title[data-v-f858259f] {
|
|
1487
|
-
font-size: 0.875rem;
|
|
1488
|
-
}
|
|
1489
|
-
.hidden[data-v-f858259f] {
|
|
1427
|
+
.hidden[data-v-c5803d2f] {
|
|
1490
1428
|
/* opacity: 0;*/
|
|
1491
1429
|
width: 0;
|
|
1492
1430
|
display: none;
|
|
1493
1431
|
}
|
|
1494
|
-
.visible[data-v-
|
|
1432
|
+
.visible[data-v-c5803d2f] {
|
|
1495
1433
|
/* opacity: 1;*/
|
|
1496
1434
|
display: block;
|
|
1497
1435
|
}
|
|
1498
1436
|
|
|
1499
1437
|
/* Dropdown animations */
|
|
1500
|
-
.dropdown-enter[data-v-
|
|
1438
|
+
.dropdown-enter[data-v-c5803d2f], .dropdown-leave[data-v-c5803d2f] {
|
|
1501
1439
|
transition: all 0.3s ease-in-out;
|
|
1502
1440
|
}
|
|
1503
|
-
.dropdown-enter-from[data-v-
|
|
1441
|
+
.dropdown-enter-from[data-v-c5803d2f], .dropdown-leave-to[data-v-c5803d2f] {
|
|
1504
1442
|
opacity: 0;
|
|
1505
1443
|
transform: translateY(-0.5rem);
|
|
1506
1444
|
}
|
|
1507
|
-
.dropdown-enter-to[data-v-
|
|
1445
|
+
.dropdown-enter-to[data-v-c5803d2f], .dropdown-leave-from[data-v-c5803d2f] {
|
|
1508
1446
|
opacity: 1;
|
|
1509
1447
|
transform: translateY(0);
|
|
1510
1448
|
}
|
|
1511
1449
|
|
|
1512
|
-
.
|
|
1513
|
-
align-items: center;
|
|
1514
|
-
width: 100%;
|
|
1515
|
-
border-radius: var(--small);
|
|
1516
|
-
transition: all 0.2s;
|
|
1517
|
-
position: relative;
|
|
1518
|
-
border: none;
|
|
1519
|
-
background: transparent;
|
|
1520
|
-
cursor: pointer;
|
|
1521
|
-
}
|
|
1522
|
-
.dark-mode-toggle[data-v-550a0811]:hover {
|
|
1523
|
-
background: var(--light-regular);
|
|
1524
|
-
}
|
|
1525
|
-
.dark-mode-label[data-v-550a0811] {
|
|
1526
|
-
font-weight: 500;
|
|
1527
|
-
transition: opacity 0.2s, width 0.2s;
|
|
1528
|
-
white-space: nowrap;
|
|
1529
|
-
}
|
|
1530
|
-
.dark-mode-icon[data-v-550a0811] {
|
|
1531
|
-
font-size: 1.25rem;
|
|
1532
|
-
transition: transform 0.2s;
|
|
1533
|
-
}
|
|
1534
|
-
.dark-mode-toggle:hover .dark-mode-icon[data-v-550a0811] {
|
|
1535
|
-
transform: scale(1.1);
|
|
1536
|
-
}
|
|
1537
|
-
.hidden[data-v-550a0811] {
|
|
1450
|
+
.hidden[data-v-415494a6] {
|
|
1538
1451
|
opacity: 0;
|
|
1539
1452
|
width: 0;
|
|
1540
1453
|
display: none;
|
|
1541
1454
|
}
|
|
1542
|
-
.visible[data-v-
|
|
1455
|
+
.visible[data-v-415494a6] {
|
|
1543
1456
|
opacity: 1;
|
|
1544
1457
|
display: block;
|
|
1545
1458
|
}
|
|
1546
1459
|
|
|
1547
1460
|
/* Scrollbar styles */
|
|
1548
|
-
[data-v-
|
|
1461
|
+
[data-v-415494a6]::-webkit-scrollbar {
|
|
1549
1462
|
width: 6px;
|
|
1550
1463
|
}
|
|
1551
|
-
[data-v-
|
|
1464
|
+
[data-v-415494a6]::-webkit-scrollbar-track {
|
|
1552
1465
|
background: transparent;
|
|
1553
1466
|
}
|
|
1554
|
-
[data-v-
|
|
1467
|
+
[data-v-415494a6]::-webkit-scrollbar-thumb {
|
|
1555
1468
|
background-color: var(--grey-micro);
|
|
1556
1469
|
border-radius: 3px;
|
|
1557
1470
|
}
|
|
1558
|
-
[data-v-
|
|
1471
|
+
[data-v-415494a6]::-webkit-scrollbar-thumb:hover {
|
|
1559
1472
|
background-color: var(--grey-small);
|
|
1560
1473
|
}
|
|
1561
1474
|
|