@lyxa.ai/core 1.2.99 → 1.3.0
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/libraries/socket/core/socket-event-registry.js.map +1 -1
- package/dist/libraries/socket/core/socket-event-registry.map.d.ts +2 -0
- package/dist/libraries/socket/core/socket-event-registry.map.js +2 -0
- package/dist/libraries/socket/core/socket-event-registry.map.js.map +1 -1
- package/dist/libraries/socket/events/chatlist-message-send.socket.event.js.map +1 -1
- package/dist/libraries/socket/events/chatroom-message-send.socket.event.js.map +1 -1
- package/dist/libraries/socket/events/index.d.ts +1 -0
- package/dist/libraries/socket/events/index.js +1 -0
- package/dist/libraries/socket/events/index.js.map +1 -1
- package/dist/libraries/socket/events/order-actions.socket.event.d.ts +527 -0
- package/dist/libraries/socket/events/order-actions.socket.event.js +82 -0
- package/dist/libraries/socket/events/order-actions.socket.event.js.map +1 -0
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/enum.d.ts +2 -1
- package/dist/types/utilities/enum.js +1 -0
- package/dist/types/utilities/enum.js.map +1 -1
- package/dist/utilities/enum.d.ts +2 -1
- package/dist/utilities/enum.js +1 -0
- package/dist/utilities/enum.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DTO } from '../../../utilities/validation/';
|
|
3
|
+
import { PaymentMethod, RegularOrderStatus } from '../../../utilities/enum';
|
|
4
|
+
import { BaseSocketEvent } from '../BaseSocketEvent';
|
|
5
|
+
export declare enum OrderAction {
|
|
6
|
+
PLACED = "placed",
|
|
7
|
+
ADJUSTMENT = "adjustment",
|
|
8
|
+
REPLACEMENT = "replacement"
|
|
9
|
+
}
|
|
10
|
+
export declare const OrderActionsOutputSchema: z.ZodObject<{
|
|
11
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
12
|
+
orderId: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
13
|
+
user: z.ZodObject<{
|
|
14
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
15
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
16
|
+
ordersCount: z.ZodNumber;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name: string;
|
|
19
|
+
_id: import("mongoose").Types.ObjectId;
|
|
20
|
+
ordersCount: number;
|
|
21
|
+
}, {
|
|
22
|
+
name: string;
|
|
23
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
24
|
+
ordersCount: number;
|
|
25
|
+
}>;
|
|
26
|
+
lineItems: z.ZodArray<z.ZodObject<{
|
|
27
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
28
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
29
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
30
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
|
|
31
|
+
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
32
|
+
quantity: z.ZodNumber;
|
|
33
|
+
price: z.ZodEffects<z.ZodNumber, number, number>;
|
|
34
|
+
secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
name: string;
|
|
37
|
+
_id: import("mongoose").Types.ObjectId;
|
|
38
|
+
price: number;
|
|
39
|
+
quantity: number;
|
|
40
|
+
attributes?: string[] | undefined;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
instructions?: string | undefined;
|
|
43
|
+
secondaryPrice?: number | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
name: string;
|
|
46
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
47
|
+
price: number;
|
|
48
|
+
quantity: number;
|
|
49
|
+
attributes?: string[] | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
instructions?: string | undefined;
|
|
52
|
+
secondaryPrice?: number | undefined;
|
|
53
|
+
}>, "many">;
|
|
54
|
+
canceledLineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
56
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
57
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
58
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
|
|
59
|
+
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
60
|
+
quantity: z.ZodNumber;
|
|
61
|
+
price: z.ZodEffects<z.ZodNumber, number, number>;
|
|
62
|
+
secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
name: string;
|
|
65
|
+
_id: import("mongoose").Types.ObjectId;
|
|
66
|
+
price: number;
|
|
67
|
+
quantity: number;
|
|
68
|
+
attributes?: string[] | undefined;
|
|
69
|
+
description?: string | undefined;
|
|
70
|
+
instructions?: string | undefined;
|
|
71
|
+
secondaryPrice?: number | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
name: string;
|
|
74
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
75
|
+
price: number;
|
|
76
|
+
quantity: number;
|
|
77
|
+
attributes?: string[] | undefined;
|
|
78
|
+
description?: string | undefined;
|
|
79
|
+
instructions?: string | undefined;
|
|
80
|
+
secondaryPrice?: number | undefined;
|
|
81
|
+
}>, "many">>;
|
|
82
|
+
address: z.ZodObject<{
|
|
83
|
+
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
84
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
85
|
+
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
86
|
+
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
87
|
+
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
88
|
+
location: z.ZodObject<{
|
|
89
|
+
type: z.ZodDefault<z.ZodNativeEnum<typeof import("../../../utilities/enum").GeoLocationType>>;
|
|
90
|
+
coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
93
|
+
coordinates: [number, number];
|
|
94
|
+
}, {
|
|
95
|
+
coordinates: [number, number];
|
|
96
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
latitude: z.ZodNumber;
|
|
99
|
+
longitude: z.ZodNumber;
|
|
100
|
+
zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
location: {
|
|
103
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
104
|
+
coordinates: [number, number];
|
|
105
|
+
};
|
|
106
|
+
address: string;
|
|
107
|
+
country: string;
|
|
108
|
+
city: string;
|
|
109
|
+
latitude: number;
|
|
110
|
+
longitude: number;
|
|
111
|
+
state?: string | undefined;
|
|
112
|
+
description?: string | undefined;
|
|
113
|
+
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
location: {
|
|
116
|
+
coordinates: [number, number];
|
|
117
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
118
|
+
};
|
|
119
|
+
address: string;
|
|
120
|
+
country: string;
|
|
121
|
+
city: string;
|
|
122
|
+
latitude: number;
|
|
123
|
+
longitude: number;
|
|
124
|
+
state?: string | undefined;
|
|
125
|
+
description?: string | undefined;
|
|
126
|
+
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
paymentSummary: z.ZodObject<{
|
|
129
|
+
paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
|
|
130
|
+
subtotal: z.ZodEffects<z.ZodNumber, number, number>;
|
|
131
|
+
secondarySubtotal: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
132
|
+
totalAmount: z.ZodEffects<z.ZodNumber, number, number>;
|
|
133
|
+
secondaryTotalAmount: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
paymentMethod: PaymentMethod;
|
|
136
|
+
totalAmount: number;
|
|
137
|
+
subtotal: number;
|
|
138
|
+
secondaryTotalAmount?: number | undefined;
|
|
139
|
+
secondarySubtotal?: number | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
paymentMethod: PaymentMethod;
|
|
142
|
+
totalAmount: number;
|
|
143
|
+
subtotal: number;
|
|
144
|
+
secondaryTotalAmount?: number | undefined;
|
|
145
|
+
secondarySubtotal?: number | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
preparationTimeMinutes: z.ZodNumber;
|
|
148
|
+
placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
149
|
+
orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
|
|
150
|
+
orderAction: z.ZodNativeEnum<typeof OrderAction>;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
address: {
|
|
153
|
+
location: {
|
|
154
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
155
|
+
coordinates: [number, number];
|
|
156
|
+
};
|
|
157
|
+
address: string;
|
|
158
|
+
country: string;
|
|
159
|
+
city: string;
|
|
160
|
+
latitude: number;
|
|
161
|
+
longitude: number;
|
|
162
|
+
state?: string | undefined;
|
|
163
|
+
description?: string | undefined;
|
|
164
|
+
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
165
|
+
};
|
|
166
|
+
user: {
|
|
167
|
+
name: string;
|
|
168
|
+
_id: import("mongoose").Types.ObjectId;
|
|
169
|
+
ordersCount: number;
|
|
170
|
+
};
|
|
171
|
+
_id: import("mongoose").Types.ObjectId;
|
|
172
|
+
orderId: string;
|
|
173
|
+
placedAt: Date;
|
|
174
|
+
lineItems: {
|
|
175
|
+
name: string;
|
|
176
|
+
_id: import("mongoose").Types.ObjectId;
|
|
177
|
+
price: number;
|
|
178
|
+
quantity: number;
|
|
179
|
+
attributes?: string[] | undefined;
|
|
180
|
+
description?: string | undefined;
|
|
181
|
+
instructions?: string | undefined;
|
|
182
|
+
secondaryPrice?: number | undefined;
|
|
183
|
+
}[];
|
|
184
|
+
paymentSummary: {
|
|
185
|
+
paymentMethod: PaymentMethod;
|
|
186
|
+
totalAmount: number;
|
|
187
|
+
subtotal: number;
|
|
188
|
+
secondaryTotalAmount?: number | undefined;
|
|
189
|
+
secondarySubtotal?: number | undefined;
|
|
190
|
+
};
|
|
191
|
+
preparationTimeMinutes: number;
|
|
192
|
+
orderStatus: RegularOrderStatus;
|
|
193
|
+
orderAction: OrderAction;
|
|
194
|
+
canceledLineItems?: {
|
|
195
|
+
name: string;
|
|
196
|
+
_id: import("mongoose").Types.ObjectId;
|
|
197
|
+
price: number;
|
|
198
|
+
quantity: number;
|
|
199
|
+
attributes?: string[] | undefined;
|
|
200
|
+
description?: string | undefined;
|
|
201
|
+
instructions?: string | undefined;
|
|
202
|
+
secondaryPrice?: number | undefined;
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
}, {
|
|
205
|
+
address: {
|
|
206
|
+
location: {
|
|
207
|
+
coordinates: [number, number];
|
|
208
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
209
|
+
};
|
|
210
|
+
address: string;
|
|
211
|
+
country: string;
|
|
212
|
+
city: string;
|
|
213
|
+
latitude: number;
|
|
214
|
+
longitude: number;
|
|
215
|
+
state?: string | undefined;
|
|
216
|
+
description?: string | undefined;
|
|
217
|
+
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
218
|
+
};
|
|
219
|
+
user: {
|
|
220
|
+
name: string;
|
|
221
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
222
|
+
ordersCount: number;
|
|
223
|
+
};
|
|
224
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
225
|
+
orderId: string;
|
|
226
|
+
placedAt: Date;
|
|
227
|
+
lineItems: {
|
|
228
|
+
name: string;
|
|
229
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
230
|
+
price: number;
|
|
231
|
+
quantity: number;
|
|
232
|
+
attributes?: string[] | undefined;
|
|
233
|
+
description?: string | undefined;
|
|
234
|
+
instructions?: string | undefined;
|
|
235
|
+
secondaryPrice?: number | undefined;
|
|
236
|
+
}[];
|
|
237
|
+
paymentSummary: {
|
|
238
|
+
paymentMethod: PaymentMethod;
|
|
239
|
+
totalAmount: number;
|
|
240
|
+
subtotal: number;
|
|
241
|
+
secondaryTotalAmount?: number | undefined;
|
|
242
|
+
secondarySubtotal?: number | undefined;
|
|
243
|
+
};
|
|
244
|
+
preparationTimeMinutes: number;
|
|
245
|
+
orderStatus: RegularOrderStatus;
|
|
246
|
+
orderAction: OrderAction;
|
|
247
|
+
canceledLineItems?: {
|
|
248
|
+
name: string;
|
|
249
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
250
|
+
price: number;
|
|
251
|
+
quantity: number;
|
|
252
|
+
attributes?: string[] | undefined;
|
|
253
|
+
description?: string | undefined;
|
|
254
|
+
instructions?: string | undefined;
|
|
255
|
+
secondaryPrice?: number | undefined;
|
|
256
|
+
}[] | undefined;
|
|
257
|
+
}>;
|
|
258
|
+
export declare const OrderActionsInputSchema: z.ZodObject<{
|
|
259
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
262
|
+
}, {
|
|
263
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
264
|
+
}>;
|
|
265
|
+
export type OrderActionSocketInputDTO = DTO<typeof OrderActionsInputSchema>;
|
|
266
|
+
export type OrderActionSocketOutputDTO = DTO<typeof OrderActionsOutputSchema>;
|
|
267
|
+
export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof OrderActionsInputSchema, typeof OrderActionsOutputSchema> {
|
|
268
|
+
static readonly schemas: {
|
|
269
|
+
input: z.ZodObject<{
|
|
270
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
271
|
+
}, "strip", z.ZodTypeAny, {
|
|
272
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
273
|
+
}, {
|
|
274
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
275
|
+
}>;
|
|
276
|
+
output: z.ZodObject<{
|
|
277
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
278
|
+
orderId: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
279
|
+
user: z.ZodObject<{
|
|
280
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
281
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
282
|
+
ordersCount: z.ZodNumber;
|
|
283
|
+
}, "strip", z.ZodTypeAny, {
|
|
284
|
+
name: string;
|
|
285
|
+
_id: import("mongoose").Types.ObjectId;
|
|
286
|
+
ordersCount: number;
|
|
287
|
+
}, {
|
|
288
|
+
name: string;
|
|
289
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
290
|
+
ordersCount: number;
|
|
291
|
+
}>;
|
|
292
|
+
lineItems: z.ZodArray<z.ZodObject<{
|
|
293
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
294
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
295
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
296
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
|
|
297
|
+
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
298
|
+
quantity: z.ZodNumber;
|
|
299
|
+
price: z.ZodEffects<z.ZodNumber, number, number>;
|
|
300
|
+
secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
name: string;
|
|
303
|
+
_id: import("mongoose").Types.ObjectId;
|
|
304
|
+
price: number;
|
|
305
|
+
quantity: number;
|
|
306
|
+
attributes?: string[] | undefined;
|
|
307
|
+
description?: string | undefined;
|
|
308
|
+
instructions?: string | undefined;
|
|
309
|
+
secondaryPrice?: number | undefined;
|
|
310
|
+
}, {
|
|
311
|
+
name: string;
|
|
312
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
313
|
+
price: number;
|
|
314
|
+
quantity: number;
|
|
315
|
+
attributes?: string[] | undefined;
|
|
316
|
+
description?: string | undefined;
|
|
317
|
+
instructions?: string | undefined;
|
|
318
|
+
secondaryPrice?: number | undefined;
|
|
319
|
+
}>, "many">;
|
|
320
|
+
canceledLineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
321
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
322
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
323
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
324
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
|
|
325
|
+
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
326
|
+
quantity: z.ZodNumber;
|
|
327
|
+
price: z.ZodEffects<z.ZodNumber, number, number>;
|
|
328
|
+
secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
name: string;
|
|
331
|
+
_id: import("mongoose").Types.ObjectId;
|
|
332
|
+
price: number;
|
|
333
|
+
quantity: number;
|
|
334
|
+
attributes?: string[] | undefined;
|
|
335
|
+
description?: string | undefined;
|
|
336
|
+
instructions?: string | undefined;
|
|
337
|
+
secondaryPrice?: number | undefined;
|
|
338
|
+
}, {
|
|
339
|
+
name: string;
|
|
340
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
341
|
+
price: number;
|
|
342
|
+
quantity: number;
|
|
343
|
+
attributes?: string[] | undefined;
|
|
344
|
+
description?: string | undefined;
|
|
345
|
+
instructions?: string | undefined;
|
|
346
|
+
secondaryPrice?: number | undefined;
|
|
347
|
+
}>, "many">>;
|
|
348
|
+
address: z.ZodObject<{
|
|
349
|
+
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
350
|
+
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
351
|
+
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
352
|
+
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
353
|
+
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
354
|
+
location: z.ZodObject<{
|
|
355
|
+
type: z.ZodDefault<z.ZodNativeEnum<typeof import("../../../utilities/enum").GeoLocationType>>;
|
|
356
|
+
coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
359
|
+
coordinates: [number, number];
|
|
360
|
+
}, {
|
|
361
|
+
coordinates: [number, number];
|
|
362
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
363
|
+
}>;
|
|
364
|
+
latitude: z.ZodNumber;
|
|
365
|
+
longitude: z.ZodNumber;
|
|
366
|
+
zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
|
|
367
|
+
}, "strip", z.ZodTypeAny, {
|
|
368
|
+
location: {
|
|
369
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
370
|
+
coordinates: [number, number];
|
|
371
|
+
};
|
|
372
|
+
address: string;
|
|
373
|
+
country: string;
|
|
374
|
+
city: string;
|
|
375
|
+
latitude: number;
|
|
376
|
+
longitude: number;
|
|
377
|
+
state?: string | undefined;
|
|
378
|
+
description?: string | undefined;
|
|
379
|
+
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
380
|
+
}, {
|
|
381
|
+
location: {
|
|
382
|
+
coordinates: [number, number];
|
|
383
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
384
|
+
};
|
|
385
|
+
address: string;
|
|
386
|
+
country: string;
|
|
387
|
+
city: string;
|
|
388
|
+
latitude: number;
|
|
389
|
+
longitude: number;
|
|
390
|
+
state?: string | undefined;
|
|
391
|
+
description?: string | undefined;
|
|
392
|
+
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
393
|
+
}>;
|
|
394
|
+
paymentSummary: z.ZodObject<{
|
|
395
|
+
paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
|
|
396
|
+
subtotal: z.ZodEffects<z.ZodNumber, number, number>;
|
|
397
|
+
secondarySubtotal: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
398
|
+
totalAmount: z.ZodEffects<z.ZodNumber, number, number>;
|
|
399
|
+
secondaryTotalAmount: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
401
|
+
paymentMethod: PaymentMethod;
|
|
402
|
+
totalAmount: number;
|
|
403
|
+
subtotal: number;
|
|
404
|
+
secondaryTotalAmount?: number | undefined;
|
|
405
|
+
secondarySubtotal?: number | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
paymentMethod: PaymentMethod;
|
|
408
|
+
totalAmount: number;
|
|
409
|
+
subtotal: number;
|
|
410
|
+
secondaryTotalAmount?: number | undefined;
|
|
411
|
+
secondarySubtotal?: number | undefined;
|
|
412
|
+
}>;
|
|
413
|
+
preparationTimeMinutes: z.ZodNumber;
|
|
414
|
+
placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
415
|
+
orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
|
|
416
|
+
orderAction: z.ZodNativeEnum<typeof OrderAction>;
|
|
417
|
+
}, "strip", z.ZodTypeAny, {
|
|
418
|
+
address: {
|
|
419
|
+
location: {
|
|
420
|
+
type: import("../../../utilities/enum").GeoLocationType;
|
|
421
|
+
coordinates: [number, number];
|
|
422
|
+
};
|
|
423
|
+
address: string;
|
|
424
|
+
country: string;
|
|
425
|
+
city: string;
|
|
426
|
+
latitude: number;
|
|
427
|
+
longitude: number;
|
|
428
|
+
state?: string | undefined;
|
|
429
|
+
description?: string | undefined;
|
|
430
|
+
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
431
|
+
};
|
|
432
|
+
user: {
|
|
433
|
+
name: string;
|
|
434
|
+
_id: import("mongoose").Types.ObjectId;
|
|
435
|
+
ordersCount: number;
|
|
436
|
+
};
|
|
437
|
+
_id: import("mongoose").Types.ObjectId;
|
|
438
|
+
orderId: string;
|
|
439
|
+
placedAt: Date;
|
|
440
|
+
lineItems: {
|
|
441
|
+
name: string;
|
|
442
|
+
_id: import("mongoose").Types.ObjectId;
|
|
443
|
+
price: number;
|
|
444
|
+
quantity: number;
|
|
445
|
+
attributes?: string[] | undefined;
|
|
446
|
+
description?: string | undefined;
|
|
447
|
+
instructions?: string | undefined;
|
|
448
|
+
secondaryPrice?: number | undefined;
|
|
449
|
+
}[];
|
|
450
|
+
paymentSummary: {
|
|
451
|
+
paymentMethod: PaymentMethod;
|
|
452
|
+
totalAmount: number;
|
|
453
|
+
subtotal: number;
|
|
454
|
+
secondaryTotalAmount?: number | undefined;
|
|
455
|
+
secondarySubtotal?: number | undefined;
|
|
456
|
+
};
|
|
457
|
+
preparationTimeMinutes: number;
|
|
458
|
+
orderStatus: RegularOrderStatus;
|
|
459
|
+
orderAction: OrderAction;
|
|
460
|
+
canceledLineItems?: {
|
|
461
|
+
name: string;
|
|
462
|
+
_id: import("mongoose").Types.ObjectId;
|
|
463
|
+
price: number;
|
|
464
|
+
quantity: number;
|
|
465
|
+
attributes?: string[] | undefined;
|
|
466
|
+
description?: string | undefined;
|
|
467
|
+
instructions?: string | undefined;
|
|
468
|
+
secondaryPrice?: number | undefined;
|
|
469
|
+
}[] | undefined;
|
|
470
|
+
}, {
|
|
471
|
+
address: {
|
|
472
|
+
location: {
|
|
473
|
+
coordinates: [number, number];
|
|
474
|
+
type?: import("../../../utilities/enum").GeoLocationType | undefined;
|
|
475
|
+
};
|
|
476
|
+
address: string;
|
|
477
|
+
country: string;
|
|
478
|
+
city: string;
|
|
479
|
+
latitude: number;
|
|
480
|
+
longitude: number;
|
|
481
|
+
state?: string | undefined;
|
|
482
|
+
description?: string | undefined;
|
|
483
|
+
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
484
|
+
};
|
|
485
|
+
user: {
|
|
486
|
+
name: string;
|
|
487
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
488
|
+
ordersCount: number;
|
|
489
|
+
};
|
|
490
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
491
|
+
orderId: string;
|
|
492
|
+
placedAt: Date;
|
|
493
|
+
lineItems: {
|
|
494
|
+
name: string;
|
|
495
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
496
|
+
price: number;
|
|
497
|
+
quantity: number;
|
|
498
|
+
attributes?: string[] | undefined;
|
|
499
|
+
description?: string | undefined;
|
|
500
|
+
instructions?: string | undefined;
|
|
501
|
+
secondaryPrice?: number | undefined;
|
|
502
|
+
}[];
|
|
503
|
+
paymentSummary: {
|
|
504
|
+
paymentMethod: PaymentMethod;
|
|
505
|
+
totalAmount: number;
|
|
506
|
+
subtotal: number;
|
|
507
|
+
secondaryTotalAmount?: number | undefined;
|
|
508
|
+
secondarySubtotal?: number | undefined;
|
|
509
|
+
};
|
|
510
|
+
preparationTimeMinutes: number;
|
|
511
|
+
orderStatus: RegularOrderStatus;
|
|
512
|
+
orderAction: OrderAction;
|
|
513
|
+
canceledLineItems?: {
|
|
514
|
+
name: string;
|
|
515
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
516
|
+
price: number;
|
|
517
|
+
quantity: number;
|
|
518
|
+
attributes?: string[] | undefined;
|
|
519
|
+
description?: string | undefined;
|
|
520
|
+
instructions?: string | undefined;
|
|
521
|
+
secondaryPrice?: number | undefined;
|
|
522
|
+
}[] | undefined;
|
|
523
|
+
}>;
|
|
524
|
+
};
|
|
525
|
+
constructor(payload: OrderActionSocketOutputDTO);
|
|
526
|
+
protected getIdentifier(): string;
|
|
527
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderActionsSocketEvent = exports.OrderActionsInputSchema = exports.OrderActionsOutputSchema = exports.OrderAction = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validation_1 = require("../../../utilities/validation/");
|
|
6
|
+
const shared_1 = require("../../../utilities/shared");
|
|
7
|
+
const enum_1 = require("../../../utilities/enum");
|
|
8
|
+
const BaseSocketEvent_1 = require("../BaseSocketEvent");
|
|
9
|
+
var OrderAction;
|
|
10
|
+
(function (OrderAction) {
|
|
11
|
+
OrderAction["PLACED"] = "placed";
|
|
12
|
+
OrderAction["ADJUSTMENT"] = "adjustment";
|
|
13
|
+
OrderAction["REPLACEMENT"] = "replacement";
|
|
14
|
+
})(OrderAction || (exports.OrderAction = OrderAction = {}));
|
|
15
|
+
const OrderUserSchema = zod_1.z.object({
|
|
16
|
+
_id: validation_1.ZodValidation.objectId('User ID'),
|
|
17
|
+
name: validation_1.ZodValidation.string('User Name'),
|
|
18
|
+
ordersCount: validation_1.ZodValidation.number('ordersCount', {
|
|
19
|
+
isNonnegative: true,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
const ItemSchema = zod_1.z.object({
|
|
23
|
+
_id: validation_1.ZodValidation.objectId('Order Item ID'),
|
|
24
|
+
name: validation_1.ZodValidation.string('Name'),
|
|
25
|
+
description: validation_1.ZodValidation.string('Description').optional(),
|
|
26
|
+
attributes: validation_1.ZodValidation.array(validation_1.ZodValidation.string()).optional(),
|
|
27
|
+
instructions: validation_1.ZodValidation.string('instructions').optional(),
|
|
28
|
+
quantity: validation_1.ZodValidation.number('quantity', { isPositive: true }),
|
|
29
|
+
price: validation_1.ZodValidation.number('price', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
|
|
30
|
+
secondaryPrice: validation_1.ZodValidation.number('Secondary Item Price', {
|
|
31
|
+
isNonnegative: true,
|
|
32
|
+
})
|
|
33
|
+
.transform(v => (0, shared_1.roundSecondaryCurrency)(v))
|
|
34
|
+
.optional(),
|
|
35
|
+
});
|
|
36
|
+
const OrderPaymentSummarySchema = zod_1.z.object({
|
|
37
|
+
paymentMethod: validation_1.ZodValidation.enumType(enum_1.PaymentMethod, 'paymentMethod'),
|
|
38
|
+
subtotal: validation_1.ZodValidation.number('Subtotal', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
|
|
39
|
+
secondarySubtotal: validation_1.ZodValidation.number('Secondary Subtotal', {
|
|
40
|
+
isNonnegative: true,
|
|
41
|
+
})
|
|
42
|
+
.transform(v => (0, shared_1.roundSecondaryCurrency)(v))
|
|
43
|
+
.optional(),
|
|
44
|
+
totalAmount: validation_1.ZodValidation.number('Total Amount', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
|
|
45
|
+
secondaryTotalAmount: validation_1.ZodValidation.number('Secondary Total Amount', {
|
|
46
|
+
isNonnegative: true,
|
|
47
|
+
})
|
|
48
|
+
.transform(v => (0, shared_1.roundSecondaryCurrency)(v))
|
|
49
|
+
.optional(),
|
|
50
|
+
});
|
|
51
|
+
exports.OrderActionsOutputSchema = zod_1.z.object({
|
|
52
|
+
_id: validation_1.ZodValidation.objectId('Order ID'),
|
|
53
|
+
orderId: validation_1.ZodValidation.string('Readable Order ID'),
|
|
54
|
+
user: OrderUserSchema,
|
|
55
|
+
lineItems: validation_1.ZodValidation.array(ItemSchema, 'items'),
|
|
56
|
+
canceledLineItems: validation_1.ZodValidation.array(ItemSchema, 'canceledItems').optional(),
|
|
57
|
+
address: validation_1.AddressSchema,
|
|
58
|
+
paymentSummary: OrderPaymentSummarySchema,
|
|
59
|
+
preparationTimeMinutes: validation_1.ZodValidation.number('Preparation Time (minutes)', {
|
|
60
|
+
isNonnegative: true,
|
|
61
|
+
}),
|
|
62
|
+
placedAt: validation_1.ZodValidation.coerce.date('placedAt'),
|
|
63
|
+
orderStatus: validation_1.ZodValidation.enumType(enum_1.RegularOrderStatus, 'status'),
|
|
64
|
+
orderAction: validation_1.ZodValidation.enumType(OrderAction, 'orderAction'),
|
|
65
|
+
});
|
|
66
|
+
exports.OrderActionsInputSchema = zod_1.z.object({
|
|
67
|
+
shopId: validation_1.ZodValidation.objectId('shopId'),
|
|
68
|
+
});
|
|
69
|
+
class OrderActionsSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
|
|
70
|
+
static schemas = {
|
|
71
|
+
input: exports.OrderActionsInputSchema,
|
|
72
|
+
output: exports.OrderActionsOutputSchema,
|
|
73
|
+
};
|
|
74
|
+
constructor(payload) {
|
|
75
|
+
super(enum_1.SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload);
|
|
76
|
+
}
|
|
77
|
+
getIdentifier() {
|
|
78
|
+
return 'default';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.OrderActionsSocketEvent = OrderActionsSocketEvent;
|
|
82
|
+
//# sourceMappingURL=order-actions.socket.event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-actions.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/order-actions.socket.event.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+DAAmF;AACnF,sDAAsF;AACtF,kDAA6F;AAC7F,wDAAqD;AAErD,IAAY,WAIX;AAJD,WAAY,WAAW;IACtB,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,0CAA2B,CAAA;AAC5B,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;IACtC,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,WAAW,CAAC;IACvC,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,aAAa,EAAE;QAChD,aAAa,EAAE,IAAI;KACnB,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC5C,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IAC3D,UAAU,EAAE,0BAAa,CAAC,KAAK,CAAC,0BAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClE,YAAY,EAAE,0BAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAC7D,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAChE,KAAK,EAAE,0BAAa,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,0BAAiB,EAAC,CAAC,CAAC,CAAC;IAClG,cAAc,EAAE,0BAAa,CAAC,MAAM,CAAC,sBAAsB,EAAE;QAC5D,aAAa,EAAE,IAAI;KACnB,CAAC;SACA,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,+BAAsB,EAAC,CAAC,CAAC,CAAC;SACzC,QAAQ,EAAE;CACZ,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,aAAa,EAAE,0BAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,eAAe,CAAC;IACrE,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,0BAAiB,EAAC,CAAC,CAAC,CAAC;IACxG,iBAAiB,EAAE,0BAAa,CAAC,MAAM,CAAC,oBAAoB,EAAE;QAC7D,aAAa,EAAE,IAAI;KACnB,CAAC;SACA,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,+BAAsB,EAAC,CAAC,CAAC,CAAC;SACzC,QAAQ,EAAE;IAEZ,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CACxF,IAAA,0BAAiB,EAAC,CAAC,CAAC,CACpB;IACD,oBAAoB,EAAE,0BAAa,CAAC,MAAM,CAAC,wBAAwB,EAAE;QACpE,aAAa,EAAE,IAAI;KACnB,CAAC;SACA,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,+BAAsB,EAAC,CAAC,CAAC,CAAC;SACzC,QAAQ,EAAE;CACZ,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;IACvC,OAAO,EAAE,0BAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,0BAAa,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;IACnD,iBAAiB,EAAE,0BAAa,CAAC,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,QAAQ,EAAE;IAC9E,OAAO,EAAE,0BAAa;IACtB,cAAc,EAAE,yBAAyB;IACzC,sBAAsB,EAAE,0BAAa,CAAC,MAAM,CAAC,4BAA4B,EAAE;QAC1E,aAAa,EAAE,IAAI;KACnB,CAAC;IACF,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,0BAAa,CAAC,QAAQ,CAAC,yBAAkB,EAAE,QAAQ,CAAC;IACjE,WAAW,EAAE,0BAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;CAC/D,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,0BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;CACxC,CAAC,CAAC;AAKH,MAAa,uBAAwB,SAAQ,iCAG5C;IACA,MAAM,CAAU,OAAO,GAAG;QACzB,KAAK,EAAE,+BAAuB;QAC9B,MAAM,EAAE,gCAAwB;KAChC,CAAC;IAEF,YAAY,OAAmC;QAC9C,KAAK,CAAC,sBAAe,CAAC,aAAa,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AAfF,0DAgBC","sourcesContent":["import { z } from 'zod';\nimport { AddressSchema, DTO, ZodValidation } from '../../../utilities/validation/';\nimport { roundBaseCurrency, roundSecondaryCurrency } from '../../../utilities/shared';\nimport { PaymentMethod, RegularOrderStatus, SocketEventType } from '../../../utilities/enum';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\n\nexport enum OrderAction {\n\tPLACED = 'placed',\n\tADJUSTMENT = 'adjustment',\n\tREPLACEMENT = 'replacement',\n}\n\nconst OrderUserSchema = z.object({\n\t_id: ZodValidation.objectId('User ID'),\n\tname: ZodValidation.string('User Name'),\n\tordersCount: ZodValidation.number('ordersCount', {\n\t\tisNonnegative: true,\n\t}),\n});\n\nconst ItemSchema = z.object({\n\t_id: ZodValidation.objectId('Order Item ID'),\n\tname: ZodValidation.string('Name'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tattributes: ZodValidation.array(ZodValidation.string()).optional(),\n\tinstructions: ZodValidation.string('instructions').optional(),\n\tquantity: ZodValidation.number('quantity', { isPositive: true }),\n\tprice: ZodValidation.number('price', { isNonnegative: true }).transform(v => roundBaseCurrency(v)),\n\tsecondaryPrice: ZodValidation.number('Secondary Item Price', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n});\n\nconst OrderPaymentSummarySchema = z.object({\n\tpaymentMethod: ZodValidation.enumType(PaymentMethod, 'paymentMethod'),\n\tsubtotal: ZodValidation.number('Subtotal', { isNonnegative: true }).transform(v => roundBaseCurrency(v)),\n\tsecondarySubtotal: ZodValidation.number('Secondary Subtotal', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n\n\ttotalAmount: ZodValidation.number('Total Amount', { isNonnegative: true }).transform(v =>\n\t\troundBaseCurrency(v)\n\t),\n\tsecondaryTotalAmount: ZodValidation.number('Secondary Total Amount', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n});\n\nexport const OrderActionsOutputSchema = z.object({\n\t_id: ZodValidation.objectId('Order ID'),\n\torderId: ZodValidation.string('Readable Order ID'),\n\tuser: OrderUserSchema,\n\tlineItems: ZodValidation.array(ItemSchema, 'items'),\n\tcanceledLineItems: ZodValidation.array(ItemSchema, 'canceledItems').optional(),\n\taddress: AddressSchema,\n\tpaymentSummary: OrderPaymentSummarySchema,\n\tpreparationTimeMinutes: ZodValidation.number('Preparation Time (minutes)', {\n\t\tisNonnegative: true,\n\t}),\n\tplacedAt: ZodValidation.coerce.date('placedAt'),\n\torderStatus: ZodValidation.enumType(RegularOrderStatus, 'status'),\n\torderAction: ZodValidation.enumType(OrderAction, 'orderAction'),\n});\n\nexport const OrderActionsInputSchema = z.object({\n\tshopId: ZodValidation.objectId('shopId'),\n});\n\nexport type OrderActionSocketInputDTO = DTO<typeof OrderActionsInputSchema>;\nexport type OrderActionSocketOutputDTO = DTO<typeof OrderActionsOutputSchema>;\n\nexport class OrderActionsSocketEvent extends BaseSocketEvent<\n\ttypeof OrderActionsInputSchema,\n\ttypeof OrderActionsOutputSchema\n> {\n\tstatic readonly schemas = {\n\t\tinput: OrderActionsInputSchema,\n\t\toutput: OrderActionsOutputSchema,\n\t};\n\n\tconstructor(payload: OrderActionSocketOutputDTO) {\n\t\tsuper(SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -809,7 +809,8 @@ export declare enum SocketEventType {
|
|
|
809
809
|
TICKET_ACTIONS = "TICKET_ACCEPT",
|
|
810
810
|
NOTIFICATION = "NOTIFICATION",
|
|
811
811
|
RIDER_CONNECT = "RIDER_CONNECT",
|
|
812
|
-
RIDER_LOCATION_UPDATE = "RIDER_LOCATION_UPDATE"
|
|
812
|
+
RIDER_LOCATION_UPDATE = "RIDER_LOCATION_UPDATE",
|
|
813
|
+
ORDER_ACTIONS = "ORDER_ACTIONS"
|
|
813
814
|
}
|
|
814
815
|
export declare enum PushNotificationEventType {
|
|
815
816
|
CHATROOM_MESSAGE_SEND = "CHATROOM_MESSAGE_SEND"
|
|
@@ -934,6 +934,7 @@ var SocketEventType;
|
|
|
934
934
|
SocketEventType["NOTIFICATION"] = "NOTIFICATION";
|
|
935
935
|
SocketEventType["RIDER_CONNECT"] = "RIDER_CONNECT";
|
|
936
936
|
SocketEventType["RIDER_LOCATION_UPDATE"] = "RIDER_LOCATION_UPDATE";
|
|
937
|
+
SocketEventType["ORDER_ACTIONS"] = "ORDER_ACTIONS";
|
|
937
938
|
})(SocketEventType || (exports.SocketEventType = SocketEventType = {}));
|
|
938
939
|
var PushNotificationEventType;
|
|
939
940
|
(function (PushNotificationEventType) {
|