@lyxa.ai/core 1.0.122-test → 1.0.123
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/event/EventEnums.d.ts +3 -0
- package/dist/libraries/event/EventEnums.js +8 -0
- package/dist/libraries/event/EventEnums.js.map +1 -0
- package/dist/libraries/event/events/admin-logs-event.d.ts +25 -0
- package/dist/libraries/event/events/admin-logs-event.js +23 -0
- package/dist/libraries/event/events/admin-logs-event.js.map +1 -0
- package/dist/libraries/mongo/models/activity-log.model.d.ts +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js.map +1 -1
- package/dist/libraries/mongo/models/agent-performance.model.js +0 -1
- package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -1
- package/dist/libraries/mongo/models/attribute.model.js +2 -2
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js +2 -2
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/replacement-order.model.d.ts +3 -3
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js +6 -6
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/filter-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/filter-container.model.js +5 -0
- package/dist/libraries/mongo/models/filter-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/list-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/list-container.model.js +5 -0
- package/dist/libraries/mongo/models/list-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.d.ts +1 -2
- package/dist/libraries/mongo/models/product.model.js +10 -19
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +1 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js +5 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.js +0 -1
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.js +3 -1
- package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
- package/dist/utilities/common/logs-common-methods.d.ts +15 -0
- package/dist/utilities/common/logs-common-methods.js +33 -0
- package/dist/utilities/common/logs-common-methods.js.map +1 -0
- package/dist/utilities/enum.d.ts +57 -0
- package/dist/utilities/enum.js +60 -2
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +6 -218
- package/dist/utilities/validation/common-validation.js +4 -3
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/package.json +1 -1
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +0 -16
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +0 -61
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +0 -1
- package/dist/libraries/mongo/models/order-finance.model.d.ts +0 -22
- package/dist/libraries/mongo/models/order-finance.model.js +0 -83
- package/dist/libraries/mongo/models/order-finance.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.d.ts +0 -7
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +0 -26
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +0 -25
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +0 -95
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +0 -1
|
@@ -7,77 +7,7 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
7
7
|
sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<-1>]>>>;
|
|
8
8
|
query: z.ZodOptional<z.ZodType<Record<string, any>, z.ZodTypeDef, Record<string, any>>>;
|
|
9
9
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
10
|
-
populate: z.ZodOptional<z.ZodUnion<[z.
|
|
11
|
-
path: z.ZodString;
|
|
12
|
-
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
13
|
-
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
14
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
15
|
-
sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<-1>]>>>;
|
|
16
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
skip: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
20
|
-
skip?: number | undefined;
|
|
21
|
-
limit?: number | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
24
|
-
skip?: number | undefined;
|
|
25
|
-
limit?: number | undefined;
|
|
26
|
-
}>>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
path: string;
|
|
29
|
-
match?: Record<string, any> | undefined;
|
|
30
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
31
|
-
options?: {
|
|
32
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
33
|
-
skip?: number | undefined;
|
|
34
|
-
limit?: number | undefined;
|
|
35
|
-
} | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
path: string;
|
|
38
|
-
match?: Record<string, any> | undefined;
|
|
39
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
40
|
-
options?: {
|
|
41
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
42
|
-
skip?: number | undefined;
|
|
43
|
-
limit?: number | undefined;
|
|
44
|
-
} | undefined;
|
|
45
|
-
}>, z.ZodArray<z.ZodObject<{
|
|
46
|
-
path: z.ZodString;
|
|
47
|
-
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
48
|
-
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
49
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
50
|
-
sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<-1>]>>>;
|
|
51
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
52
|
-
skip: z.ZodOptional<z.ZodNumber>;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
55
|
-
skip?: number | undefined;
|
|
56
|
-
limit?: number | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
59
|
-
skip?: number | undefined;
|
|
60
|
-
limit?: number | undefined;
|
|
61
|
-
}>>;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
path: string;
|
|
64
|
-
match?: Record<string, any> | undefined;
|
|
65
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
66
|
-
options?: {
|
|
67
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
68
|
-
skip?: number | undefined;
|
|
69
|
-
limit?: number | undefined;
|
|
70
|
-
} | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
path: string;
|
|
73
|
-
match?: Record<string, any> | undefined;
|
|
74
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
75
|
-
options?: {
|
|
76
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
77
|
-
skip?: number | undefined;
|
|
78
|
-
limit?: number | undefined;
|
|
79
|
-
} | undefined;
|
|
80
|
-
}>, "many">]>>;
|
|
10
|
+
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
81
11
|
search: z.ZodOptional<z.ZodObject<{
|
|
82
12
|
searchKey: z.ZodString;
|
|
83
13
|
searchFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -98,25 +28,7 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
98
28
|
sort?: Record<string, 1 | -1> | undefined;
|
|
99
29
|
select?: Record<string, 0 | 1> | undefined;
|
|
100
30
|
query?: Record<string, any> | undefined;
|
|
101
|
-
populate?:
|
|
102
|
-
path: string;
|
|
103
|
-
match?: Record<string, any> | undefined;
|
|
104
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
105
|
-
options?: {
|
|
106
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
107
|
-
skip?: number | undefined;
|
|
108
|
-
limit?: number | undefined;
|
|
109
|
-
} | undefined;
|
|
110
|
-
} | {
|
|
111
|
-
path: string;
|
|
112
|
-
match?: Record<string, any> | undefined;
|
|
113
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
114
|
-
options?: {
|
|
115
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
116
|
-
skip?: number | undefined;
|
|
117
|
-
limit?: number | undefined;
|
|
118
|
-
} | undefined;
|
|
119
|
-
}[] | undefined;
|
|
31
|
+
populate?: any;
|
|
120
32
|
}, {
|
|
121
33
|
search?: {
|
|
122
34
|
searchKey: string;
|
|
@@ -127,25 +39,7 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
127
39
|
select?: Record<string, 0 | 1> | undefined;
|
|
128
40
|
size?: number | undefined;
|
|
129
41
|
query?: Record<string, any> | undefined;
|
|
130
|
-
populate?:
|
|
131
|
-
path: string;
|
|
132
|
-
match?: Record<string, any> | undefined;
|
|
133
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
134
|
-
options?: {
|
|
135
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
136
|
-
skip?: number | undefined;
|
|
137
|
-
limit?: number | undefined;
|
|
138
|
-
} | undefined;
|
|
139
|
-
} | {
|
|
140
|
-
path: string;
|
|
141
|
-
match?: Record<string, any> | undefined;
|
|
142
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
143
|
-
options?: {
|
|
144
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
145
|
-
skip?: number | undefined;
|
|
146
|
-
limit?: number | undefined;
|
|
147
|
-
} | undefined;
|
|
148
|
-
}[] | undefined;
|
|
42
|
+
populate?: any;
|
|
149
43
|
}>>;
|
|
150
44
|
export type FilterDTO = z.infer<typeof FilterSchema>;
|
|
151
45
|
export declare const StringSchema: z.ZodString;
|
|
@@ -760,121 +654,15 @@ export declare const IdSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString
|
|
|
760
654
|
export declare const GetByIdInputSchema: z.ZodObject<{
|
|
761
655
|
_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>]>;
|
|
762
656
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
763
|
-
populate: z.ZodOptional<z.ZodUnion<[z.
|
|
764
|
-
path: z.ZodString;
|
|
765
|
-
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
766
|
-
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
767
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
768
|
-
sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<-1>]>>>;
|
|
769
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
770
|
-
skip: z.ZodOptional<z.ZodNumber>;
|
|
771
|
-
}, "strip", z.ZodTypeAny, {
|
|
772
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
773
|
-
skip?: number | undefined;
|
|
774
|
-
limit?: number | undefined;
|
|
775
|
-
}, {
|
|
776
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
777
|
-
skip?: number | undefined;
|
|
778
|
-
limit?: number | undefined;
|
|
779
|
-
}>>;
|
|
780
|
-
}, "strip", z.ZodTypeAny, {
|
|
781
|
-
path: string;
|
|
782
|
-
match?: Record<string, any> | undefined;
|
|
783
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
784
|
-
options?: {
|
|
785
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
786
|
-
skip?: number | undefined;
|
|
787
|
-
limit?: number | undefined;
|
|
788
|
-
} | undefined;
|
|
789
|
-
}, {
|
|
790
|
-
path: string;
|
|
791
|
-
match?: Record<string, any> | undefined;
|
|
792
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
793
|
-
options?: {
|
|
794
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
795
|
-
skip?: number | undefined;
|
|
796
|
-
limit?: number | undefined;
|
|
797
|
-
} | undefined;
|
|
798
|
-
}>, z.ZodArray<z.ZodObject<{
|
|
799
|
-
path: z.ZodString;
|
|
800
|
-
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
801
|
-
match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
802
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
803
|
-
sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<-1>]>>>;
|
|
804
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
805
|
-
skip: z.ZodOptional<z.ZodNumber>;
|
|
806
|
-
}, "strip", z.ZodTypeAny, {
|
|
807
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
808
|
-
skip?: number | undefined;
|
|
809
|
-
limit?: number | undefined;
|
|
810
|
-
}, {
|
|
811
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
812
|
-
skip?: number | undefined;
|
|
813
|
-
limit?: number | undefined;
|
|
814
|
-
}>>;
|
|
815
|
-
}, "strip", z.ZodTypeAny, {
|
|
816
|
-
path: string;
|
|
817
|
-
match?: Record<string, any> | undefined;
|
|
818
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
819
|
-
options?: {
|
|
820
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
821
|
-
skip?: number | undefined;
|
|
822
|
-
limit?: number | undefined;
|
|
823
|
-
} | undefined;
|
|
824
|
-
}, {
|
|
825
|
-
path: string;
|
|
826
|
-
match?: Record<string, any> | undefined;
|
|
827
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
828
|
-
options?: {
|
|
829
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
830
|
-
skip?: number | undefined;
|
|
831
|
-
limit?: number | undefined;
|
|
832
|
-
} | undefined;
|
|
833
|
-
}>, "many">]>>;
|
|
657
|
+
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
834
658
|
}, "strip", z.ZodTypeAny, {
|
|
835
659
|
_id: import("mongoose").Types.ObjectId;
|
|
836
660
|
select?: Record<string, 0 | 1> | undefined;
|
|
837
|
-
populate?:
|
|
838
|
-
path: string;
|
|
839
|
-
match?: Record<string, any> | undefined;
|
|
840
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
841
|
-
options?: {
|
|
842
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
843
|
-
skip?: number | undefined;
|
|
844
|
-
limit?: number | undefined;
|
|
845
|
-
} | undefined;
|
|
846
|
-
} | {
|
|
847
|
-
path: string;
|
|
848
|
-
match?: Record<string, any> | undefined;
|
|
849
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
850
|
-
options?: {
|
|
851
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
852
|
-
skip?: number | undefined;
|
|
853
|
-
limit?: number | undefined;
|
|
854
|
-
} | undefined;
|
|
855
|
-
}[] | undefined;
|
|
661
|
+
populate?: any;
|
|
856
662
|
}, {
|
|
857
663
|
_id: string | import("mongoose").Types.ObjectId;
|
|
858
664
|
select?: Record<string, 0 | 1> | undefined;
|
|
859
|
-
populate?:
|
|
860
|
-
path: string;
|
|
861
|
-
match?: Record<string, any> | undefined;
|
|
862
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
863
|
-
options?: {
|
|
864
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
865
|
-
skip?: number | undefined;
|
|
866
|
-
limit?: number | undefined;
|
|
867
|
-
} | undefined;
|
|
868
|
-
} | {
|
|
869
|
-
path: string;
|
|
870
|
-
match?: Record<string, any> | undefined;
|
|
871
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
872
|
-
options?: {
|
|
873
|
-
sort?: Record<string, 1 | -1> | undefined;
|
|
874
|
-
skip?: number | undefined;
|
|
875
|
-
limit?: number | undefined;
|
|
876
|
-
} | undefined;
|
|
877
|
-
}[] | undefined;
|
|
665
|
+
populate?: any;
|
|
878
666
|
}>;
|
|
879
667
|
export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
|
|
880
668
|
declare const ShareableLinkSchema: z.ZodObject<{
|
|
@@ -22,7 +22,7 @@ const MongoOperatorsSchema = zod_1.z.object({
|
|
|
22
22
|
$nor: zod_1.z.array(MongoQuerySchema).optional(),
|
|
23
23
|
});
|
|
24
24
|
const sortSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(-1)]));
|
|
25
|
-
const populateSchema = zod_1.z.object({
|
|
25
|
+
const populateSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
26
26
|
path: zod_1.z.string(),
|
|
27
27
|
select: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)])).optional(),
|
|
28
28
|
match: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
@@ -33,7 +33,8 @@ const populateSchema = zod_1.z.object({
|
|
|
33
33
|
skip: zod_1.z.number().optional(),
|
|
34
34
|
})
|
|
35
35
|
.optional(),
|
|
36
|
-
|
|
36
|
+
populate: zod_1.z.union([populateSchema, zod_1.z.array(populateSchema)]).optional(),
|
|
37
|
+
}));
|
|
37
38
|
exports.FilterSchema = zod_1.z
|
|
38
39
|
.object({
|
|
39
40
|
size: zod_1.z
|
|
@@ -144,7 +145,7 @@ exports.GetByIdInputSchema = zod_1.z.object({
|
|
|
144
145
|
populate: zod_1.z.union([populateSchema, zod_1.z.array(populateSchema)]).optional(),
|
|
145
146
|
});
|
|
146
147
|
const ShareableLinkSchema = zod_1.z.object({
|
|
147
|
-
link: global_validation_1.ZodValidation.url()
|
|
148
|
+
link: global_validation_1.ZodValidation.url(),
|
|
148
149
|
});
|
|
149
150
|
exports.ShareableLinkResponseSchema = (0, exports.createResponseSchema)(ShareableLinkSchema);
|
|
150
151
|
//# sourceMappingURL=common-validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAmC;AACnC,2DAAyD;AACzD,kCAAkF;AAKlF,MAAM,gBAAgB,GAAmC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACpE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC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,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClC,WAAW,EAAE,iCAAa,CAAC,MAAM,CAAC,aAAa,CAAC;CAChD,CAAC,CAAC;AAMU,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClC,UAAU,EAAE,iCAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC9D,CAAC,CAAC;AAMU,QAAA,QAAQ,GAAG,iCAAa,CAAC,QAAQ,EAAE,CAAC;AAKpC,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClC,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9E,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACvE,CAAC,CAAC;AAIH,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,iCAAa,CAAC,GAAG,EAAE;CACzB,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,4BAAoB,EAAC,mBAAmB,CAAC,CAAC","sourcesContent":["import { z, ZodSchema } from 'zod';\nimport { DTO, ZodValidation } from './global-validation';\nimport { GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from '../enum';\n\n/**\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\n */\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\n);\n\n/**\n * Define allowed MongoDB query operators\n */\nconst MongoOperatorsSchema = z.object({\n\t$eq: z.any().optional(),\n\t$ne: z.any().optional(),\n\t$gt: z.any().optional(),\n\t$gte: z.any().optional(),\n\t$lt: z.any().optional(),\n\t$lte: z.any().optional(),\n\t$in: z.array(z.any()).optional(),\n\t$nin: z.array(z.any()).optional(),\n\t$exists: z.boolean().optional(),\n\t$regex: z.string().optional(),\n\t$and: z.array(MongoQuerySchema).optional(),\n\t$or: z.array(MongoQuerySchema).optional(),\n\t$not: MongoQuerySchema.optional(),\n\t$nor: z.array(MongoQuerySchema).optional(),\n});\n\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\n\nconst populateSchema = z.object({\n\tpath: z.string(), // required\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tmatch: z.record(z.string(), z.any()).optional(),\n\toptions: z\n\t\t.object({\n\t\t\tsort: sortSchema.optional(),\n\t\t\tlimit: z.number().optional(),\n\t\t\tskip: z.number().optional(),\n\t\t})\n\t\t.optional(),\n});\n\n/**\n * Define the filter schema using MongoQuerySchema\n */\nexport const FilterSchema = z\n\t.object({\n\t\tsize: z\n\t\t\t.number()\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\n\t\t\t.optional()\n\t\t\t.default(10),\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\n\t\tsort: sortSchema.optional(),\n\t\tquery: MongoQuerySchema.optional(),\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t\tsearch: z.object({ searchKey: z.string(), searchFields: z.array(z.string()).optional() }).optional(),\n\t})\n\t.optional();\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FilterDTO = z.infer<typeof FilterSchema>;\n\n/**\n * Define String schema\n */\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\n\n/**\n * Common address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: AddressSchema\n * });\n * ```\n */\nexport const AddressSchema = z.object({\n\taddress: ZodValidation.string('Address'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tcity: ZodValidation.string('City'),\n\tstate: ZodValidation.string('State'),\n\tcountry: ZodValidation.string('Country'),\n\tlocation: z.object({\n\t\ttype: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\n\t\tcoordinates: z.tuple([\n\t\t\tZodValidation.number('Longitude', { min: -180, max: 180 }),\n\t\t\tZodValidation.number('Latitude', { min: -90, max: 90 }),\n\t\t]),\n\t}),\n\tlatitude: ZodValidation.number('Latitude', { min: -90, max: 90 }),\n\tlongitude: ZodValidation.number('Longitude', { min: -180, max: 180 }),\n\tzone: ZodValidation.objectId('Zone').optional(),\n});\nexport type AddressDTO = DTO<typeof AddressSchema>;\n\n/**\n * Common user address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: UserAddressSchema\n * });\n * ```\n */\nexport const UserAddressSchema = AddressSchema.extend({\n\taddressLabel: ZodValidation.string('Address Label'),\n\tapartment: ZodValidation.string('Apartment'),\n\tbuildingName: ZodValidation.string('Building Name'),\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\n\tinstructions: ZodValidation.string('Instructions').optional(),\n});\nexport type UserAddressDTO = DTO<typeof UserAddressSchema>;\n\n/**\n * Common courier address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const courierAddressSchema = z.object({\n * name: z.string(),\n * address: courierAddressSchema\n * });\n * ```\n */\nexport const CourierAddressSchema = UserAddressSchema.extend({\n\tname: ZodValidation.string('Name'),\n\tphoneNumber: ZodValidation.string('Phone Number'),\n});\nexport type CourierAddressDTO = DTO<typeof CourierAddressSchema>;\n\n/**\n * Common duration validation schema that can be reused across models.\n * Provides validation for duration fields.\n *\n * @example\n * ```typescript\n * const subscriptionSchema = z.object({\n * fee: z.number(),\n * duration: DurationSchema\n * });\n * ```\n */\nexport const DurationSchema = z.object({\n\tstart: ZodValidation.date('Start'),\n\tend: ZodValidation.date('End').optional(),\n});\n\n/**\n * Common Work Hour validation schema that can be reused across models.\n * Provides validation for workHourSetting fields.\n *\n * @example\n * ```typescript\n * const settingSchema = z.object({\n * vat: z.number(),\n * workHourSetting: WorkHourSettingSchema\n * });\n * ```\n */\nconst StartEndTimeSchema = z.object({\n\tstart: ZodValidation.string('Start'),\n\tend: ZodValidation.string('End'),\n});\n\nexport const NormalHourSchema = z.object({\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\n\topeningHours: ZodValidation.array(StartEndTimeSchema).default([]),\n});\n\nexport const HolidayHourSchema = z.object({\n\tdate: ZodValidation.date('Date'),\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\n\tclosingHour: StartEndTimeSchema,\n});\n\nexport const WorkHourSettingSchema = z.object({\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\n});\n\n/**\n * Schema for validating user login credentials.\n * This schema ensures that the provided email and password meet the required validation rules.\n *\n * @example\n * ```typescript\n * const credentials = {\n * email: 'user@example.com',\n * password: 'securePassword123',\n * };\n * ```\n */\nexport const LoginSchema = z.object({\n\temail: ZodValidation.email('Email', {\n\t\trequiredMessage: 'Please enter a valid email address.',\n\t\tinvalidMessage: 'Please enter a valid email address.',\n\t}),\n\tpassword: ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),\n});\nexport type LoginDTO = DTO<typeof LoginSchema>;\n\nconst metadataSchema = z.object({\n\tpage: ZodValidation.number(),\n\tsize: ZodValidation.number(),\n\ttotalElements: ZodValidation.number(),\n\ttotalPages: ZodValidation.number(),\n});\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tmetadata: metadataSchema.optional(),\n\t\tdocuments: ZodValidation.array(documentSchema),\n\t});\n\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tsuccess: ZodValidation.boolean(),\n\t\tmessage: ZodValidation.string(),\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\n\t});\n\n/**\n * Schema for validating token data, typically used for authentication.\n * This schema ensures that the provided access token and refresh token are valid strings.\n *\n * @example\n * ```typescript\n * const tokens = {\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * };\n * ```\n */\nexport const TokenSchema = z.object({\n\taccessToken: ZodValidation.string('AccessToken'),\n\trefreshToken: ZodValidation.string('RefreshToken'),\n});\n\n/**\n * Schema validation for sorting order\n */\nexport const UpdateSortingOrderSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tnewPosition: ZodValidation.number('newPosition'),\n});\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\n\n/**\n * Schema validation for delete\n */\nexport const DeleteSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\n});\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\n\n/**\n * Schema validation for Id\n */\nexport const IdSchema = ZodValidation.objectId();\n\n/**\n * Schema validation get by id\n */\nexport const GetByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\nexport type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;\n\n\nconst ShareableLinkSchema = z.object({\n\tlink: ZodValidation.url()\n});\n\nexport const ShareableLinkResponseSchema = createResponseSchema(ShareableLinkSchema);\nexport type ShareableLinkDTO = DTO<typeof ShareableLinkSchema>;"]}
|
|
1
|
+
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,2DAAyD;AACzD,kCAAkF;AAKlF,MAAM,gBAAgB,GAAmC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACpE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAClD,CAAC;AAKF,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxB,GAAG,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,g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,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9E,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACvE,CAAC,CAAC;AAGH,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,iCAAa,CAAC,GAAG,EAAE;CACzB,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,4BAAoB,EAAC,mBAAmB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from './global-validation';\nimport { GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from '../enum';\n\n/**\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\n */\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\n);\n\n/**\n * Define allowed MongoDB query operators\n */\nconst MongoOperatorsSchema = z.object({\n\t$eq: z.any().optional(),\n\t$ne: z.any().optional(),\n\t$gt: z.any().optional(),\n\t$gte: z.any().optional(),\n\t$lt: z.any().optional(),\n\t$lte: z.any().optional(),\n\t$in: z.array(z.any()).optional(),\n\t$nin: z.array(z.any()).optional(),\n\t$exists: z.boolean().optional(),\n\t$regex: z.string().optional(),\n\t$and: z.array(MongoQuerySchema).optional(),\n\t$or: z.array(MongoQuerySchema).optional(),\n\t$not: MongoQuerySchema.optional(),\n\t$nor: z.array(MongoQuerySchema).optional(),\n});\n\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\n\nconst populateSchema: z.ZodType<any> = z.lazy(() =>\n\tz.object({\n\t\tpath: z.string(), // required\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tmatch: z.record(z.string(), z.any()).optional(),\n\t\toptions: z\n\t\t\t.object({\n\t\t\t\tsort: sortSchema.optional(),\n\t\t\t\tlimit: z.number().optional(),\n\t\t\t\tskip: z.number().optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t})\n);\n\n/**\n * Define the filter schema using MongoQuerySchema\n */\nexport const FilterSchema = z\n\t.object({\n\t\tsize: z\n\t\t\t.number()\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\n\t\t\t.optional()\n\t\t\t.default(10),\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\n\t\tsort: sortSchema.optional(),\n\t\tquery: MongoQuerySchema.optional(),\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t\tsearch: z.object({ searchKey: z.string(), searchFields: z.array(z.string()).optional() }).optional(),\n\t})\n\t.optional();\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FilterDTO = z.infer<typeof FilterSchema>;\n\n/**\n * Define String schema\n */\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\n\n/**\n * Common address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: AddressSchema\n * });\n * ```\n */\nexport const AddressSchema = z.object({\n\taddress: ZodValidation.string('Address'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tcity: ZodValidation.string('City'),\n\tstate: ZodValidation.string('State'),\n\tcountry: ZodValidation.string('Country'),\n\tlocation: z.object({\n\t\ttype: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\n\t\tcoordinates: z.tuple([\n\t\t\tZodValidation.number('Longitude', { min: -180, max: 180 }),\n\t\t\tZodValidation.number('Latitude', { min: -90, max: 90 }),\n\t\t]),\n\t}),\n\tlatitude: ZodValidation.number('Latitude', { min: -90, max: 90 }),\n\tlongitude: ZodValidation.number('Longitude', { min: -180, max: 180 }),\n\tzone: ZodValidation.objectId('Zone').optional(),\n});\nexport type AddressDTO = DTO<typeof AddressSchema>;\n\n/**\n * Common user address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: UserAddressSchema\n * });\n * ```\n */\nexport const UserAddressSchema = AddressSchema.extend({\n\taddressLabel: ZodValidation.string('Address Label'),\n\tapartment: ZodValidation.string('Apartment'),\n\tbuildingName: ZodValidation.string('Building Name'),\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\n\tinstructions: ZodValidation.string('Instructions').optional(),\n});\nexport type UserAddressDTO = DTO<typeof UserAddressSchema>;\n\n/**\n * Common courier address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const courierAddressSchema = z.object({\n * name: z.string(),\n * address: courierAddressSchema\n * });\n * ```\n */\nexport const CourierAddressSchema = UserAddressSchema.extend({\n\tname: ZodValidation.string('Name'),\n\tphoneNumber: ZodValidation.string('Phone Number'),\n});\nexport type CourierAddressDTO = DTO<typeof CourierAddressSchema>;\n\n/**\n * Common duration validation schema that can be reused across models.\n * Provides validation for duration fields.\n *\n * @example\n * ```typescript\n * const subscriptionSchema = z.object({\n * fee: z.number(),\n * duration: DurationSchema\n * });\n * ```\n */\nexport const DurationSchema = z.object({\n\tstart: ZodValidation.date('Start'),\n\tend: ZodValidation.date('End').optional(),\n});\n\n/**\n * Common Work Hour validation schema that can be reused across models.\n * Provides validation for workHourSetting fields.\n *\n * @example\n * ```typescript\n * const settingSchema = z.object({\n * vat: z.number(),\n * workHourSetting: WorkHourSettingSchema\n * });\n * ```\n */\nconst StartEndTimeSchema = z.object({\n\tstart: ZodValidation.string('Start'),\n\tend: ZodValidation.string('End'),\n});\n\nexport const NormalHourSchema = z.object({\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\n\topeningHours: ZodValidation.array(StartEndTimeSchema).default([]),\n});\n\nexport const HolidayHourSchema = z.object({\n\tdate: ZodValidation.date('Date'),\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\n\tclosingHour: StartEndTimeSchema,\n});\n\nexport const WorkHourSettingSchema = z.object({\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\n});\n\n/**\n * Schema for validating user login credentials.\n * This schema ensures that the provided email and password meet the required validation rules.\n *\n * @example\n * ```typescript\n * const credentials = {\n * email: 'user@example.com',\n * password: 'securePassword123',\n * };\n * ```\n */\nexport const LoginSchema = z.object({\n\temail: ZodValidation.email('Email', {\n\t\trequiredMessage: 'Please enter a valid email address.',\n\t\tinvalidMessage: 'Please enter a valid email address.',\n\t}),\n\tpassword: ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),\n});\nexport type LoginDTO = DTO<typeof LoginSchema>;\n\nconst metadataSchema = z.object({\n\tpage: ZodValidation.number(),\n\tsize: ZodValidation.number(),\n\ttotalElements: ZodValidation.number(),\n\ttotalPages: ZodValidation.number(),\n});\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tmetadata: metadataSchema.optional(),\n\t\tdocuments: ZodValidation.array(documentSchema),\n\t});\n\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tsuccess: ZodValidation.boolean(),\n\t\tmessage: ZodValidation.string(),\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\n\t});\n\n/**\n * Schema for validating token data, typically used for authentication.\n * This schema ensures that the provided access token and refresh token are valid strings.\n *\n * @example\n * ```typescript\n * const tokens = {\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * };\n * ```\n */\nexport const TokenSchema = z.object({\n\taccessToken: ZodValidation.string('AccessToken'),\n\trefreshToken: ZodValidation.string('RefreshToken'),\n});\n\n/**\n * Schema validation for sorting order\n */\nexport const UpdateSortingOrderSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tnewPosition: ZodValidation.number('newPosition'),\n});\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\n\n/**\n * Schema validation for delete\n */\nexport const DeleteSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\n});\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\n\n/**\n * Schema validation for Id\n */\nexport const IdSchema = ZodValidation.objectId();\n\n/**\n * Schema validation get by id\n */\nexport const GetByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\nexport type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;\n\nconst ShareableLinkSchema = z.object({\n\tlink: ZodValidation.url(),\n});\n\nexport const ShareableLinkResponseSchema = createResponseSchema(ShareableLinkSchema);\nexport type ShareableLinkDTO = DTO<typeof ShareableLinkSchema>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Ref } from '@typegoose/typegoose';
|
|
2
|
-
import { Shop } from '../shop.model';
|
|
3
|
-
import { Order } from '../order.model';
|
|
4
|
-
declare class UsedPoint {
|
|
5
|
-
amountUsed: number;
|
|
6
|
-
dateUsed: Date;
|
|
7
|
-
}
|
|
8
|
-
export declare class LoyaltyPoint {
|
|
9
|
-
points: number;
|
|
10
|
-
dateGenerated: Date;
|
|
11
|
-
dateExpiry: Date;
|
|
12
|
-
shop?: Ref<Shop>;
|
|
13
|
-
order?: Ref<Order>;
|
|
14
|
-
usedPoints: UsedPoint[];
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LoyaltyPoint = void 0;
|
|
13
|
-
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const shop_model_1 = require("../shop.model");
|
|
15
|
-
const order_model_1 = require("../order.model");
|
|
16
|
-
class UsedPoint {
|
|
17
|
-
amountUsed;
|
|
18
|
-
dateUsed;
|
|
19
|
-
}
|
|
20
|
-
__decorate([
|
|
21
|
-
(0, typegoose_1.prop)({ required: true }),
|
|
22
|
-
__metadata("design:type", Number)
|
|
23
|
-
], UsedPoint.prototype, "amountUsed", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, typegoose_1.prop)({ required: true }),
|
|
26
|
-
__metadata("design:type", Date)
|
|
27
|
-
], UsedPoint.prototype, "dateUsed", void 0);
|
|
28
|
-
class LoyaltyPoint {
|
|
29
|
-
points;
|
|
30
|
-
dateGenerated;
|
|
31
|
-
dateExpiry;
|
|
32
|
-
shop;
|
|
33
|
-
order;
|
|
34
|
-
usedPoints;
|
|
35
|
-
}
|
|
36
|
-
exports.LoyaltyPoint = LoyaltyPoint;
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, typegoose_1.prop)({ required: true }),
|
|
39
|
-
__metadata("design:type", Number)
|
|
40
|
-
], LoyaltyPoint.prototype, "points", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, typegoose_1.prop)({ required: true }),
|
|
43
|
-
__metadata("design:type", Date)
|
|
44
|
-
], LoyaltyPoint.prototype, "dateGenerated", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typegoose_1.prop)({ required: true }),
|
|
47
|
-
__metadata("design:type", Date)
|
|
48
|
-
], LoyaltyPoint.prototype, "dateExpiry", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop, required: true }),
|
|
51
|
-
__metadata("design:type", Object)
|
|
52
|
-
], LoyaltyPoint.prototype, "shop", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typegoose_1.prop)({ ref: () => order_model_1.Order, required: true }),
|
|
55
|
-
__metadata("design:type", Object)
|
|
56
|
-
], LoyaltyPoint.prototype, "order", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, typegoose_1.prop)({ type: () => [UsedPoint], default: [] }),
|
|
59
|
-
__metadata("design:type", Array)
|
|
60
|
-
], LoyaltyPoint.prototype, "usedPoints", void 0);
|
|
61
|
-
//# sourceMappingURL=loyaltyPoint.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loyaltyPoint.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/loyaltyPoint.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAAiD;AACjD,8CAAqC;AACrC,gDAAuC;AAEvC,MAAM,SAAS;IAEP,UAAU,CAAU;IAGpB,QAAQ,CAAQ;CACvB;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACE;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACP,IAAI;2CAAC;AAGxB,MAAa,YAAY;IAEjB,MAAM,CAAU;IAGhB,aAAa,CAAQ;IAGrB,UAAU,CAAQ;IAGlB,IAAI,CAAa;IAGjB,KAAK,CAAc;IAEnB,UAAU,CAAe;CAChC;AAjBD,oCAiBC;AAfO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACF,IAAI;mDAAC;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;gDAAC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACjB;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gDACf","sourcesContent":["// loyaltyPoint.model.ts\nimport { prop, Ref } from '@typegoose/typegoose';\nimport { Shop } from '../shop.model';\nimport { Order } from '../order.model';\n\nclass UsedPoint {\n\t@prop({ required: true })\n\tpublic amountUsed!: number;\n\n\t@prop({ required: true })\n\tpublic dateUsed!: Date;\n}\n\nexport class LoyaltyPoint {\n\t@prop({ required: true })\n\tpublic points!: number;\n\n\t@prop({ required: true })\n\tpublic dateGenerated!: Date;\n\n\t@prop({ required: true })\n\tpublic dateExpiry!: Date;\n\n\t@prop({ ref: () => Shop, required: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ ref: () => Order, required: true })\n\tpublic order?: Ref<Order>;\n\t@prop({ type: () => [UsedPoint], default: [] })\n\tpublic usedPoints!: UsedPoint[];\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Ref } from '@typegoose/typegoose';
|
|
2
|
-
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
-
import { OrderPricing } from './embedded/order-pricing.model';
|
|
4
|
-
import { PaymentInformation } from './embedded/payment-infromation.model';
|
|
5
|
-
import { Order } from './order.model';
|
|
6
|
-
import { OrderType, PaymentMethod } from '../../../utilities/enum';
|
|
7
|
-
import { RiderProfit } from './embedded/profit.model';
|
|
8
|
-
import { Rider } from './rider.model';
|
|
9
|
-
import { CashSettlement } from './embedded/cash-settlement.model';
|
|
10
|
-
export declare class OrderFinance extends TimeStamps {
|
|
11
|
-
order: Ref<Order>;
|
|
12
|
-
rider?: Ref<Rider>;
|
|
13
|
-
orderType?: OrderType;
|
|
14
|
-
status?: string;
|
|
15
|
-
exchangeRate?: number;
|
|
16
|
-
paymentMethod?: PaymentMethod;
|
|
17
|
-
paymentInformation?: PaymentInformation;
|
|
18
|
-
pricing?: OrderPricing;
|
|
19
|
-
riderProfit?: RiderProfit;
|
|
20
|
-
cashSettlement?: CashSettlement;
|
|
21
|
-
processedAt?: Date;
|
|
22
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.OrderFinance = void 0;
|
|
13
|
-
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
-
const order_pricing_model_1 = require("./embedded/order-pricing.model");
|
|
16
|
-
const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
|
|
17
|
-
const order_model_1 = require("./order.model");
|
|
18
|
-
const enum_1 = require("../../../utilities/enum");
|
|
19
|
-
const profit_model_1 = require("./embedded/profit.model");
|
|
20
|
-
const rider_model_1 = require("./rider.model");
|
|
21
|
-
const cash_settlement_model_1 = require("./embedded/cash-settlement.model");
|
|
22
|
-
let OrderFinance = class OrderFinance extends defaultClasses_1.TimeStamps {
|
|
23
|
-
order;
|
|
24
|
-
rider;
|
|
25
|
-
orderType;
|
|
26
|
-
status;
|
|
27
|
-
exchangeRate;
|
|
28
|
-
paymentMethod;
|
|
29
|
-
paymentInformation;
|
|
30
|
-
pricing;
|
|
31
|
-
riderProfit;
|
|
32
|
-
cashSettlement;
|
|
33
|
-
processedAt;
|
|
34
|
-
};
|
|
35
|
-
exports.OrderFinance = OrderFinance;
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typegoose_1.prop)({ required: true, ref: () => order_model_1.Order, index: true, unique: true }),
|
|
38
|
-
__metadata("design:type", Object)
|
|
39
|
-
], OrderFinance.prototype, "order", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typegoose_1.prop)({ ref: () => rider_model_1.Rider, index: true }),
|
|
42
|
-
__metadata("design:type", Object)
|
|
43
|
-
], OrderFinance.prototype, "rider", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.OrderType, default: enum_1.OrderType.REGULAR }),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], OrderFinance.prototype, "orderType", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.OrderFinanceStatus, default: enum_1.OrderFinanceStatus.PENDING }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], OrderFinance.prototype, "status", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typegoose_1.prop)({ type: Number, default: 1 }),
|
|
54
|
-
__metadata("design:type", Number)
|
|
55
|
-
], OrderFinance.prototype, "exchangeRate", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentMethod, default: enum_1.PaymentMethod.CASH }),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], OrderFinance.prototype, "paymentMethod", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
|
|
62
|
-
__metadata("design:type", payment_infromation_model_1.PaymentInformation)
|
|
63
|
-
], OrderFinance.prototype, "paymentInformation", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, typegoose_1.prop)({ type: () => order_pricing_model_1.OrderPricing }),
|
|
66
|
-
__metadata("design:type", order_pricing_model_1.OrderPricing)
|
|
67
|
-
], OrderFinance.prototype, "pricing", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, typegoose_1.prop)({ type: () => profit_model_1.RiderProfit }),
|
|
70
|
-
__metadata("design:type", profit_model_1.RiderProfit)
|
|
71
|
-
], OrderFinance.prototype, "riderProfit", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, typegoose_1.prop)({ type: () => cash_settlement_model_1.CashSettlement }),
|
|
74
|
-
__metadata("design:type", cash_settlement_model_1.CashSettlement)
|
|
75
|
-
], OrderFinance.prototype, "cashSettlement", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, typegoose_1.prop)({ type: Date }),
|
|
78
|
-
__metadata("design:type", Date)
|
|
79
|
-
], OrderFinance.prototype, "processedAt", void 0);
|
|
80
|
-
exports.OrderFinance = OrderFinance = __decorate([
|
|
81
|
-
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'orderFinances' } })
|
|
82
|
-
], OrderFinance);
|
|
83
|
-
//# sourceMappingURL=order-finance.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,wEAA8D;AAC9D,oFAA0E;AAC1E,+CAAsC;AACtC,kDAAuF;AACvF,0DAAsD;AACtD,+CAAsC;AACtC,4EAAkE;AAG3D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAEpC,KAAK,CAAc;IAGnB,KAAK,CAAc;IAGnB,SAAS,CAAa;IAGtB,MAAM,CAAU;IAGhB,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAGrC,kBAAkB,CAAsB;IAGjC,OAAO,CAAgB;IAGvB,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,WAAW,CAAQ;CAC1B,CAAA;AAjCY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;2CAC5C;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;2CACd;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,OAAO,EAAE,CAAC;;+CACvC;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,EAAE,OAAO,EAAE,yBAAkB,CAAC,OAAO,EAAE,CAAC;;4CAC/D;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,IAAI,EAAE,CAAC;;mDACpC;AAGrC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,CAAC;8BACpB,8CAAkB;wDAAC;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BAClB,kCAAY;6CAAC;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,0BAAW,EAAE,CAAC;8BACb,0BAAW;iDAAC;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;8BACb,sCAAc;oDAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACA,IAAI;iDAAC;uBAhCd,YAAY;IADxB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE,CAAC;GACpD,YAAY,CAiCxB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { OrderPricing } from './embedded/order-pricing.model';\nimport { PaymentInformation } from './embedded/payment-infromation.model';\nimport { Order } from './order.model';\nimport { OrderFinanceStatus, OrderType, PaymentMethod } from '../../../utilities/enum';\nimport { RiderProfit } from './embedded/profit.model';\nimport { Rider } from './rider.model';\nimport { CashSettlement } from './embedded/cash-settlement.model';\n\n@modelOptions({ schemaOptions: { collection: 'orderFinances' } })\nexport class OrderFinance extends TimeStamps {\n\t@prop({ required: true, ref: () => Order, index: true, unique: true })\n\tpublic order!: Ref<Order>;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ type: String, enum: OrderType, default: OrderType.REGULAR })\n\tpublic orderType?: OrderType;\n\n\t@prop({ type: String, enum: OrderFinanceStatus, default: OrderFinanceStatus.PENDING })\n\tpublic status?: string;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic exchangeRate?: number;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpublic paymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: () => OrderPricing })\n\tpublic pricing?: OrderPricing;\n\n\t@prop({ type: () => RiderProfit })\n\tpublic riderProfit?: RiderProfit;\n\n\t@prop({ type: () => CashSettlement })\n\tpublic cashSettlement?: CashSettlement;\n\n\t@prop({ type: Date })\n\tpublic processedAt?: Date;\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { OrderFinance } from '../order-finance.model';
|
|
2
|
-
import { OrderType } from '../../../../utilities/enum';
|
|
3
|
-
import { CourierOrderProfit } from '../embedded/profit.model';
|
|
4
|
-
export declare class CourierOrderFinance extends OrderFinance {
|
|
5
|
-
orderType: OrderType.COURIER;
|
|
6
|
-
companyProfit?: CourierOrderProfit;
|
|
7
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CourierOrderFinance = void 0;
|
|
13
|
-
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const order_finance_model_1 = require("../order-finance.model");
|
|
15
|
-
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
-
const profit_model_1 = require("../embedded/profit.model");
|
|
17
|
-
class CourierOrderFinance extends order_finance_model_1.OrderFinance {
|
|
18
|
-
orderType = enum_1.OrderType.COURIER;
|
|
19
|
-
companyProfit;
|
|
20
|
-
}
|
|
21
|
-
exports.CourierOrderFinance = CourierOrderFinance;
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, typegoose_1.prop)({ type: () => profit_model_1.CourierOrderProfit }),
|
|
24
|
-
__metadata("design:type", profit_model_1.CourierOrderProfit)
|
|
25
|
-
], CourierOrderFinance.prototype, "companyProfit", void 0);
|
|
26
|
-
//# sourceMappingURL=courier-order-finance.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"courier-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/courier-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,gEAAsD;AACtD,qDAAuD;AACvD,2DAA8D;AAE9D,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,aAAa,CAAsB;CAC1C;AALD,kDAKC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { OrderType } from '../../../../utilities/enum';\nimport { CourierOrderProfit } from '../embedded/profit.model';\n\nexport class CourierOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.COURIER as const;\n\n\t@prop({ type: () => CourierOrderProfit })\n\tpublic companyProfit?: CourierOrderProfit;\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Ref } from '@typegoose/typegoose';
|
|
2
|
-
import { OrderFinance } from '../order-finance.model';
|
|
3
|
-
import { ItemType, OrderType } from '../../../../utilities/enum';
|
|
4
|
-
import { RegularOrderProfit } from '../embedded/profit.model';
|
|
5
|
-
import { Vat } from '../embedded/vat.model';
|
|
6
|
-
import { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';
|
|
7
|
-
import { Parent } from '../parent.model';
|
|
8
|
-
import { Shop } from '../shop.model';
|
|
9
|
-
export declare class RegularOrderFinance extends OrderFinance {
|
|
10
|
-
orderType: OrderType.REGULAR;
|
|
11
|
-
parent: Ref<Parent>;
|
|
12
|
-
shop: Ref<Shop>;
|
|
13
|
-
itemType: ItemType;
|
|
14
|
-
isShopDelivery?: boolean;
|
|
15
|
-
companyProfit?: RegularOrderProfit;
|
|
16
|
-
shopProfit?: RegularOrderProfit;
|
|
17
|
-
vat?: Vat;
|
|
18
|
-
discount?: MarketingCut;
|
|
19
|
-
buy1get1?: MarketingCut;
|
|
20
|
-
loyaltyPoint?: LoyaltyPoint;
|
|
21
|
-
coupon?: CouponDetails;
|
|
22
|
-
freeDelivery?: MarketingCut;
|
|
23
|
-
replacementOrder?: MarketingCut;
|
|
24
|
-
endorseLoss?: MarketingCut;
|
|
25
|
-
}
|