@lyxa.ai/marketing 1.0.18 → 1.0.19
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/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +2 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +16 -7
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +3 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +1 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/loyalty-point-setting/routers/index.d.ts +2 -0
- package/dist/lib/modules/loyalty-point-setting/routers/index.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/routers/index.js +18 -0
- package/dist/lib/modules/loyalty-point-setting/routers/index.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/routers/loyalty-point-setting.router.d.ts +321 -0
- package/dist/lib/modules/loyalty-point-setting/routers/loyalty-point-setting.router.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/routers/loyalty-point-setting.router.js +82 -0
- package/dist/lib/modules/loyalty-point-setting/routers/loyalty-point-setting.router.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/index.d.ts +3 -0
- package/dist/lib/modules/loyalty-point-setting/services/index.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/index.js +19 -0
- package/dist/lib/modules/loyalty-point-setting/services/index.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-category.service.d.ts +16 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-category.service.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-category.service.js +133 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-category.service.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-setting.service.d.ts +16 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-setting.service.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-setting.service.js +156 -0
- package/dist/lib/modules/loyalty-point-setting/services/loyalty-point-setting.service.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/index.d.ts +3 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/index.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/index.js +19 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/index.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.d.ts +8 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.js +7 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.d.ts +9 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.js +7 -0
- package/dist/lib/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/index.d.ts +3 -0
- package/dist/lib/modules/loyalty-point-setting/validations/index.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/index.js +19 -0
- package/dist/lib/modules/loyalty-point-setting/validations/index.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.d.ts +170 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.js +19 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.js.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts +188 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts.map +1 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.js +19 -0
- package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.js.map +1 -0
- package/dist/lib/modules/marketing/services/discount-marketing.service.js +2 -2
- package/dist/lib/modules/marketing/services/discount-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/loyalty-point-marketing.service.d.ts +12 -0
- package/dist/lib/modules/marketing/services/loyalty-point-marketing.service.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/loyalty-point-marketing.service.js +149 -0
- package/dist/lib/modules/marketing/services/loyalty-point-marketing.service.js.map +1 -0
- package/dist/lib/modules/marketing/transformers/loyalty-point-marketing.transformer.d.ts +47 -0
- package/dist/lib/modules/marketing/transformers/loyalty-point-marketing.transformer.d.ts.map +1 -0
- package/dist/lib/modules/marketing/transformers/loyalty-point-marketing.transformer.js +7 -0
- package/dist/lib/modules/marketing/transformers/loyalty-point-marketing.transformer.js.map +1 -0
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.js +3 -3
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.js.map +1 -1
- package/dist/lib/modules/marketing/validations/loyalty-point-marketing.validation.d.ts +504 -0
- package/dist/lib/modules/marketing/validations/loyalty-point-marketing.validation.d.ts.map +1 -0
- package/dist/lib/modules/marketing/validations/loyalty-point-marketing.validation.js +34 -0
- package/dist/lib/modules/marketing/validations/loyalty-point-marketing.validation.js.map +1 -0
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js +50 -4
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +2 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +3 -0
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/loyalty-point-setting/routers/index.d.ts +2 -0
- package/dist/types/modules/loyalty-point-setting/routers/index.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/routers/loyalty-point-setting.router.d.ts +321 -0
- package/dist/types/modules/loyalty-point-setting/routers/loyalty-point-setting.router.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/services/index.d.ts +3 -0
- package/dist/types/modules/loyalty-point-setting/services/index.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/services/loyalty-point-category.service.d.ts +37 -0
- package/dist/types/modules/loyalty-point-setting/services/loyalty-point-category.service.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/services/loyalty-point-setting.service.d.ts +34 -0
- package/dist/types/modules/loyalty-point-setting/services/loyalty-point-setting.service.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/transformers/index.d.ts +3 -0
- package/dist/types/modules/loyalty-point-setting/transformers/index.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.d.ts +8 -0
- package/dist/types/modules/loyalty-point-setting/transformers/loyalty-point-category.transformer.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.d.ts +9 -0
- package/dist/types/modules/loyalty-point-setting/transformers/loyalty-point-setting.transformer.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/validations/index.d.ts +3 -0
- package/dist/types/modules/loyalty-point-setting/validations/index.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/validations/loyalty-point-category.validation.d.ts +179 -0
- package/dist/types/modules/loyalty-point-setting/validations/loyalty-point-category.validation.d.ts.map +1 -0
- package/dist/types/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts +197 -0
- package/dist/types/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/loyalty-point-marketing.service.d.ts +21 -0
- package/dist/types/modules/marketing/services/loyalty-point-marketing.service.d.ts.map +1 -0
- package/dist/types/modules/marketing/transformers/loyalty-point-marketing.transformer.d.ts +47 -0
- package/dist/types/modules/marketing/transformers/loyalty-point-marketing.transformer.d.ts.map +1 -0
- package/dist/types/modules/marketing/validations/loyalty-point-marketing.validation.d.ts +513 -0
- package/dist/types/modules/marketing/validations/loyalty-point-marketing.validation.d.ts.map +1 -0
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DTO } from '@lyxa.ai/core/dist/utilities/validation/global-validation';
|
|
3
|
+
import { Status } from '@lyxa.ai/core/dist/utilities/enum';
|
|
4
|
+
declare const LoyaltyPointCategoryValidationSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
6
|
+
status: z.ZodDefault<z.ZodNativeEnum<typeof Status>>;
|
|
7
|
+
sortingOrder: z.ZodNumber;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
status: Status;
|
|
10
|
+
name: string;
|
|
11
|
+
sortingOrder: number;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
sortingOrder: number;
|
|
15
|
+
status?: Status | undefined;
|
|
16
|
+
}>, LoyaltyPointCategorySchema: z.ZodObject<{
|
|
17
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
18
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
19
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
_id: 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>]>>;
|
|
21
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
22
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
23
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
24
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
_id: 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>]>>;
|
|
26
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
27
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
28
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
29
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
_id: 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>]>>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough">>, LoyaltyPointCategoryIdSchema: 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>]>, UpdateLoyaltyPointCategorySchema: z.ZodObject<{
|
|
32
|
+
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
}, {
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
}> | z.ZodObject<{
|
|
38
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
39
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
40
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
_id: 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>]>>;
|
|
42
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
43
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
44
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
45
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
_id: 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>]>>;
|
|
47
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
48
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
49
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
50
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
_id: 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>]>>;
|
|
52
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
53
|
+
export { LoyaltyPointCategoryValidationSchema, LoyaltyPointCategorySchema, LoyaltyPointCategoryIdSchema as LoyaltyPointCategoryIdValidationSchema, UpdateLoyaltyPointCategorySchema, };
|
|
54
|
+
export declare const LoyaltyPointCategoryResponseSchema: z.ZodObject<{
|
|
55
|
+
success: z.ZodBoolean;
|
|
56
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
57
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
58
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
page: z.ZodNumber;
|
|
60
|
+
size: z.ZodNumber;
|
|
61
|
+
totalElements: z.ZodNumber;
|
|
62
|
+
totalPages: z.ZodNumber;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
page: number;
|
|
65
|
+
size: number;
|
|
66
|
+
totalElements: number;
|
|
67
|
+
totalPages: number;
|
|
68
|
+
}, {
|
|
69
|
+
page: number;
|
|
70
|
+
size: number;
|
|
71
|
+
totalElements: number;
|
|
72
|
+
totalPages: number;
|
|
73
|
+
}>>;
|
|
74
|
+
documents: z.ZodArray<z.ZodType<z.objectInputType<{
|
|
75
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
76
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
77
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
_id: 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>]>>;
|
|
79
|
+
}, z.ZodTypeAny, "passthrough">, z.ZodTypeDef, z.objectInputType<{
|
|
80
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
81
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
82
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
_id: 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>]>>;
|
|
84
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
documents: z.objectInputType<{
|
|
87
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
88
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
89
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
_id: 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>]>>;
|
|
91
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
92
|
+
metadata?: {
|
|
93
|
+
page: number;
|
|
94
|
+
size: number;
|
|
95
|
+
totalElements: number;
|
|
96
|
+
totalPages: number;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
documents: z.objectInputType<{
|
|
100
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
101
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
102
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
_id: 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>]>>;
|
|
104
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
105
|
+
metadata?: {
|
|
106
|
+
page: number;
|
|
107
|
+
size: number;
|
|
108
|
+
totalElements: number;
|
|
109
|
+
totalPages: number;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}>, z.ZodType<z.objectInputType<{
|
|
112
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
113
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
114
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
_id: 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>]>>;
|
|
116
|
+
}, z.ZodTypeAny, "passthrough">, z.ZodTypeDef, z.objectInputType<{
|
|
117
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
118
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
119
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
_id: 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>]>>;
|
|
121
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
message: string;
|
|
124
|
+
success: boolean;
|
|
125
|
+
data?: z.objectInputType<{
|
|
126
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
127
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
128
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
_id: 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>]>>;
|
|
130
|
+
}, z.ZodTypeAny, "passthrough"> | {
|
|
131
|
+
documents: z.objectInputType<{
|
|
132
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
133
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
134
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
_id: 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>]>>;
|
|
136
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
137
|
+
metadata?: {
|
|
138
|
+
page: number;
|
|
139
|
+
size: number;
|
|
140
|
+
totalElements: number;
|
|
141
|
+
totalPages: number;
|
|
142
|
+
} | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
message: string;
|
|
146
|
+
success: boolean;
|
|
147
|
+
data?: z.objectInputType<{
|
|
148
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
149
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
150
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
_id: 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>]>>;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough"> | {
|
|
153
|
+
documents: z.objectInputType<{
|
|
154
|
+
name: z.ZodOptional<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
155
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<typeof Status>>>;
|
|
156
|
+
sortingOrder: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
_id: 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>]>>;
|
|
158
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
159
|
+
metadata?: {
|
|
160
|
+
page: number;
|
|
161
|
+
size: number;
|
|
162
|
+
totalElements: number;
|
|
163
|
+
totalPages: number;
|
|
164
|
+
} | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
export type CreateLoyaltyPointCategoryDTO = DTO<typeof LoyaltyPointCategoryValidationSchema>;
|
|
168
|
+
export type LoyaltyPointCategoryDTO = DTO<typeof LoyaltyPointCategorySchema>;
|
|
169
|
+
export type UpdateLoyaltyPointCategoryDTO = DTO<typeof UpdateLoyaltyPointCategorySchema>;
|
|
170
|
+
//# sourceMappingURL=loyalty-point-category.validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty-point-category.validation.d.ts","sourceRoot":"/","sources":["modules/loyalty-point-setting/validations/loyalty-point-category.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAsB3D,QAAA,MACa,oCAAoC;;;;;;;;;;;;IAClC,0BAA0B;;;;;;;;;;;;;;;kCAC9B,4BAA4B,mNACxB,gCAAgC;;;;;;;;;;;;;;;;;;;;;gCACK,CAAC;AAKrD,OAAO,EACN,oCAAoC,EACpC,0BAA0B,EAC1B,4BAA4B,IAAI,sCAAsC,EACtE,gCAAgC,GAChC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAmD,CAAC;AAKnG,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAC7F,MAAM,MAAM,uBAAuB,GAAG,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoyaltyPointCategoryResponseSchema = exports.UpdateLoyaltyPointCategorySchema = exports.LoyaltyPointCategoryIdValidationSchema = exports.LoyaltyPointCategorySchema = exports.LoyaltyPointCategoryValidationSchema = void 0;
|
|
4
|
+
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
5
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
6
|
+
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
7
|
+
const baseFields = {
|
|
8
|
+
name: global_validation_1.ZodValidation.string('Name'),
|
|
9
|
+
status: global_validation_1.ZodValidation.enumType(enum_1.Status, 'Status').default(enum_1.Status.ACTIVE),
|
|
10
|
+
sortingOrder: global_validation_1.ZodValidation.number('Sorting order'),
|
|
11
|
+
};
|
|
12
|
+
const schemaBuilder = (0, global_validation_1.createSchemaBuilder)(baseFields);
|
|
13
|
+
const { BaseSchema: LoyaltyPointCategoryValidationSchema, EntitySchema: LoyaltyPointCategorySchema, IdSchema: LoyaltyPointCategoryIdSchema, UpdateSchema: UpdateLoyaltyPointCategorySchema, } = schemaBuilder.getAllSchemas({ createdAt: true });
|
|
14
|
+
exports.LoyaltyPointCategoryValidationSchema = LoyaltyPointCategoryValidationSchema;
|
|
15
|
+
exports.LoyaltyPointCategorySchema = LoyaltyPointCategorySchema;
|
|
16
|
+
exports.LoyaltyPointCategoryIdValidationSchema = LoyaltyPointCategoryIdSchema;
|
|
17
|
+
exports.UpdateLoyaltyPointCategorySchema = UpdateLoyaltyPointCategorySchema;
|
|
18
|
+
exports.LoyaltyPointCategoryResponseSchema = (0, validation_1.createResponseSchema)(LoyaltyPointCategorySchema);
|
|
19
|
+
//# sourceMappingURL=loyalty-point-category.validation.js.map
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-category.validation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty-point-category.validation.js","sourceRoot":"/","sources":["modules/loyalty-point-setting/validations/loyalty-point-category.validation.ts"],"names":[],"mappings":";;;AACA,iGAImE;AACnE,4DAA2D;AAC3D,wEAA+E;AAK/E,MAAM,UAAU,GAAG;IAClB,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAM,CAAC,MAAM,CAAC;IACvE,YAAY,EAAE,iCAAa,CAAC,MAAM,CAAC,eAAe,CAAC;CACnD,CAAC;AAOF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AAKtD,MAAM,EACL,UAAU,EAAE,oCAAoC,EAChD,YAAY,EAAE,0BAA0B,EACxC,QAAQ,EAAE,4BAA4B,EACtC,YAAY,EAAE,gCAAgC,GAC9C,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAMpD,oFAAoC;AACpC,gEAA0B;AACM,8EAAsC;AACtE,4EAAgC;AAGpB,QAAA,kCAAkC,GAAG,IAAA,iCAAoB,EAAC,0BAA0B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { Status } from '@lyxa.ai/core/dist/utilities/enum';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\n/**\n * Define the base parent schema fields\n */\nconst baseFields = {\n\tname: ZodValidation.string('Name'),\n\tstatus: ZodValidation.enumType(Status, 'Status').default(Status.ACTIVE),\n\tsortingOrder: ZodValidation.number('Sorting order'),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: LoyaltyPointCategoryValidationSchema,\n\tEntitySchema: LoyaltyPointCategorySchema,\n\tIdSchema: LoyaltyPointCategoryIdSchema,\n\tUpdateSchema: UpdateLoyaltyPointCategorySchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tLoyaltyPointCategoryValidationSchema,\n\tLoyaltyPointCategorySchema,\n\tLoyaltyPointCategoryIdSchema as LoyaltyPointCategoryIdValidationSchema,\n\tUpdateLoyaltyPointCategorySchema,\n};\n\nexport const LoyaltyPointCategoryResponseSchema = createResponseSchema(LoyaltyPointCategorySchema);\n\n/**\n * Export DTO types\n */\nexport type CreateLoyaltyPointCategoryDTO = DTO<typeof LoyaltyPointCategoryValidationSchema>;\nexport type LoyaltyPointCategoryDTO = DTO<typeof LoyaltyPointCategorySchema>;\nexport type UpdateLoyaltyPointCategoryDTO = DTO<typeof UpdateLoyaltyPointCategorySchema>;\n"]}
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DTO } from '@lyxa.ai/core/dist/utilities/validation/global-validation';
|
|
3
|
+
declare const LoyaltyPointSettingValidationSchema: z.ZodObject<{
|
|
4
|
+
earnedValue: z.ZodNumber;
|
|
5
|
+
usedValue: z.ZodNumber;
|
|
6
|
+
rewardBundles: z.ZodArray<z.ZodNumber, "many">;
|
|
7
|
+
expirationInDays: z.ZodNumber;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
earnedValue: number;
|
|
10
|
+
usedValue: number;
|
|
11
|
+
rewardBundles: number[];
|
|
12
|
+
expirationInDays: number;
|
|
13
|
+
}, {
|
|
14
|
+
earnedValue: number;
|
|
15
|
+
usedValue: number;
|
|
16
|
+
rewardBundles: number[];
|
|
17
|
+
expirationInDays: number;
|
|
18
|
+
}>, LoyaltyPointSettingSchema: z.ZodObject<{
|
|
19
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
22
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
_id: 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>]>>;
|
|
24
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
25
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
28
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
_id: 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>]>>;
|
|
30
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
31
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
34
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
_id: 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>]>>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>, LoyaltyPointSettingIdSchema: 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>]>, UpdateLoyaltyPointSettingSchema: z.ZodObject<{
|
|
37
|
+
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
38
|
+
}, "strict", z.ZodTypeAny, {
|
|
39
|
+
[x: string]: any;
|
|
40
|
+
}, {
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
}> | z.ZodObject<{
|
|
43
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
46
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
_id: 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>]>>;
|
|
48
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
49
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
52
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
_id: 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>]>>;
|
|
54
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
55
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
58
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
_id: 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>]>>;
|
|
60
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
61
|
+
export { LoyaltyPointSettingValidationSchema, LoyaltyPointSettingSchema, LoyaltyPointSettingIdSchema as LoyaltyPointSettingIdValidationSchema, UpdateLoyaltyPointSettingSchema, };
|
|
62
|
+
export declare const LoyaltyPointSettingResponseSchema: z.ZodObject<{
|
|
63
|
+
success: z.ZodBoolean;
|
|
64
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
65
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
66
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
page: z.ZodNumber;
|
|
68
|
+
size: z.ZodNumber;
|
|
69
|
+
totalElements: z.ZodNumber;
|
|
70
|
+
totalPages: z.ZodNumber;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
page: number;
|
|
73
|
+
size: number;
|
|
74
|
+
totalElements: number;
|
|
75
|
+
totalPages: number;
|
|
76
|
+
}, {
|
|
77
|
+
page: number;
|
|
78
|
+
size: number;
|
|
79
|
+
totalElements: number;
|
|
80
|
+
totalPages: number;
|
|
81
|
+
}>>;
|
|
82
|
+
documents: z.ZodArray<z.ZodType<z.objectInputType<{
|
|
83
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
86
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
_id: 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>]>>;
|
|
88
|
+
}, z.ZodTypeAny, "passthrough">, z.ZodTypeDef, z.objectInputType<{
|
|
89
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
92
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
_id: 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>]>>;
|
|
94
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
95
|
+
}, "strip", z.ZodTypeAny, {
|
|
96
|
+
documents: z.objectInputType<{
|
|
97
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
100
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
_id: 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>]>>;
|
|
102
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
103
|
+
metadata?: {
|
|
104
|
+
page: number;
|
|
105
|
+
size: number;
|
|
106
|
+
totalElements: number;
|
|
107
|
+
totalPages: number;
|
|
108
|
+
} | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
documents: z.objectInputType<{
|
|
111
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
114
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
_id: 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>]>>;
|
|
116
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
117
|
+
metadata?: {
|
|
118
|
+
page: number;
|
|
119
|
+
size: number;
|
|
120
|
+
totalElements: number;
|
|
121
|
+
totalPages: number;
|
|
122
|
+
} | undefined;
|
|
123
|
+
}>, z.ZodType<z.objectInputType<{
|
|
124
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
127
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
_id: 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>]>>;
|
|
129
|
+
}, z.ZodTypeAny, "passthrough">, z.ZodTypeDef, z.objectInputType<{
|
|
130
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
133
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
_id: 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>]>>;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
message: string;
|
|
138
|
+
success: boolean;
|
|
139
|
+
data?: z.objectInputType<{
|
|
140
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
143
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
_id: 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>]>>;
|
|
145
|
+
}, z.ZodTypeAny, "passthrough"> | {
|
|
146
|
+
documents: z.objectInputType<{
|
|
147
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
150
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
_id: 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>]>>;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
153
|
+
metadata?: {
|
|
154
|
+
page: number;
|
|
155
|
+
size: number;
|
|
156
|
+
totalElements: number;
|
|
157
|
+
totalPages: number;
|
|
158
|
+
} | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
message: string;
|
|
162
|
+
success: boolean;
|
|
163
|
+
data?: z.objectInputType<{
|
|
164
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
167
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
168
|
+
_id: 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>]>>;
|
|
169
|
+
}, z.ZodTypeAny, "passthrough"> | {
|
|
170
|
+
documents: z.objectInputType<{
|
|
171
|
+
earnedValue: z.ZodOptional<z.ZodNumber>;
|
|
172
|
+
usedValue: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
rewardBundles: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
174
|
+
expirationInDays: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
_id: 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>]>>;
|
|
176
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
177
|
+
metadata?: {
|
|
178
|
+
page: number;
|
|
179
|
+
size: number;
|
|
180
|
+
totalElements: number;
|
|
181
|
+
totalPages: number;
|
|
182
|
+
} | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
}>;
|
|
185
|
+
export type CreateLoyaltyPointSettingDTO = DTO<typeof LoyaltyPointSettingValidationSchema>;
|
|
186
|
+
export type LoyaltyPointSettingDTO = DTO<typeof LoyaltyPointSettingSchema>;
|
|
187
|
+
export type UpdateLoyaltyPointSettingDTO = DTO<typeof UpdateLoyaltyPointSettingSchema>;
|
|
188
|
+
//# sourceMappingURL=loyalty-point-setting.validation.d.ts.map
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty-point-setting.validation.d.ts","sourceRoot":"/","sources":["modules/loyalty-point-setting/validations/loyalty-point-setting.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AAuBnE,QAAA,MACa,mCAAmC;;;;;;;;;;;;;;;IACjC,yBAAyB;;;;;;;;;;;;;;;;;;kCAC7B,2BAA2B,mNACvB,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;gCACM,CAAC;AAKrD,OAAO,EACN,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,IAAI,qCAAqC,EACpE,+BAA+B,GAC/B,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkD,CAAC;AAKjG,MAAM,MAAM,4BAA4B,GAAG,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAC3F,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC3E,MAAM,MAAM,4BAA4B,GAAG,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoyaltyPointSettingResponseSchema = exports.UpdateLoyaltyPointSettingSchema = exports.LoyaltyPointSettingIdValidationSchema = exports.LoyaltyPointSettingSchema = exports.LoyaltyPointSettingValidationSchema = void 0;
|
|
4
|
+
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
5
|
+
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
6
|
+
const baseFields = {
|
|
7
|
+
earnedValue: global_validation_1.ZodValidation.number('Earned value'),
|
|
8
|
+
usedValue: global_validation_1.ZodValidation.number('Used value'),
|
|
9
|
+
rewardBundles: global_validation_1.ZodValidation.array(global_validation_1.ZodValidation.number('Reward bundle'), 'Reward bundles'),
|
|
10
|
+
expirationInDays: global_validation_1.ZodValidation.number('Expiration in days'),
|
|
11
|
+
};
|
|
12
|
+
const schemaBuilder = (0, global_validation_1.createSchemaBuilder)(baseFields);
|
|
13
|
+
const { BaseSchema: LoyaltyPointSettingValidationSchema, EntitySchema: LoyaltyPointSettingSchema, IdSchema: LoyaltyPointSettingIdSchema, UpdateSchema: UpdateLoyaltyPointSettingSchema, } = schemaBuilder.getAllSchemas({ createdAt: true });
|
|
14
|
+
exports.LoyaltyPointSettingValidationSchema = LoyaltyPointSettingValidationSchema;
|
|
15
|
+
exports.LoyaltyPointSettingSchema = LoyaltyPointSettingSchema;
|
|
16
|
+
exports.LoyaltyPointSettingIdValidationSchema = LoyaltyPointSettingIdSchema;
|
|
17
|
+
exports.UpdateLoyaltyPointSettingSchema = UpdateLoyaltyPointSettingSchema;
|
|
18
|
+
exports.LoyaltyPointSettingResponseSchema = (0, validation_1.createResponseSchema)(LoyaltyPointSettingSchema);
|
|
19
|
+
//# sourceMappingURL=loyalty-point-setting.validation.js.map
|
package/dist/lib/modules/loyalty-point-setting/validations/loyalty-point-setting.validation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty-point-setting.validation.js","sourceRoot":"/","sources":["modules/loyalty-point-setting/validations/loyalty-point-setting.validation.ts"],"names":[],"mappings":";;;AACA,iGAImE;AACnE,wEAA+E;AAK/E,MAAM,UAAU,GAAG;IAClB,WAAW,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC;IACjD,SAAS,EAAE,iCAAa,CAAC,MAAM,CAAC,YAAY,CAAC;IAC7C,aAAa,EAAE,iCAAa,CAAC,KAAK,CAAC,iCAAa,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,gBAAgB,CAAC;IAC3F,gBAAgB,EAAE,iCAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC;CAC5D,CAAC;AAOF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AAKtD,MAAM,EACL,UAAU,EAAE,mCAAmC,EAC/C,YAAY,EAAE,yBAAyB,EACvC,QAAQ,EAAE,2BAA2B,EACrC,YAAY,EAAE,+BAA+B,GAC7C,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAMpD,kFAAmC;AACnC,8DAAyB;AACM,4EAAqC;AACpE,0EAA+B;AAGnB,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,yBAAyB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\n/**\n * Define the base parent schema fields\n */\nconst baseFields = {\n\tearnedValue: ZodValidation.number('Earned value'),\n\tusedValue: ZodValidation.number('Used value'),\n\trewardBundles: ZodValidation.array(ZodValidation.number('Reward bundle'), 'Reward bundles'),\n\texpirationInDays: ZodValidation.number('Expiration in days'),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: LoyaltyPointSettingValidationSchema,\n\tEntitySchema: LoyaltyPointSettingSchema,\n\tIdSchema: LoyaltyPointSettingIdSchema,\n\tUpdateSchema: UpdateLoyaltyPointSettingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tLoyaltyPointSettingValidationSchema,\n\tLoyaltyPointSettingSchema,\n\tLoyaltyPointSettingIdSchema as LoyaltyPointSettingIdValidationSchema,\n\tUpdateLoyaltyPointSettingSchema,\n};\n\nexport const LoyaltyPointSettingResponseSchema = createResponseSchema(LoyaltyPointSettingSchema);\n\n/**\n * Export DTO types\n */\nexport type CreateLoyaltyPointSettingDTO = DTO<typeof LoyaltyPointSettingValidationSchema>;\nexport type LoyaltyPointSettingDTO = DTO<typeof LoyaltyPointSettingSchema>;\nexport type UpdateLoyaltyPointSettingDTO = DTO<typeof UpdateLoyaltyPointSettingSchema>;\n"]}
|
|
@@ -130,7 +130,7 @@ let DiscountMarketingService = class DiscountMarketingService {
|
|
|
130
130
|
const record = await this.model.findOneAndUpdate({
|
|
131
131
|
_id: _id,
|
|
132
132
|
deletedAt: null,
|
|
133
|
-
}, rest, {
|
|
133
|
+
}, { categories, ...rest }, {
|
|
134
134
|
new: true,
|
|
135
135
|
runValidators: true,
|
|
136
136
|
});
|
|
@@ -214,7 +214,7 @@ let DiscountMarketingService = class DiscountMarketingService {
|
|
|
214
214
|
marketing: marketingId,
|
|
215
215
|
product: productId,
|
|
216
216
|
value: value,
|
|
217
|
-
valueType: valueType
|
|
217
|
+
valueType: valueType
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discount-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAImD;AAKnD,yBAA6C;AAE7C,4EAA2F;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S,EAAE,CAAC;wBAClC,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;oBACpF,CAAC;yBAAM,CAAC;wBACP,IAAA,8BAAe,EAAC,yDAAyD,CAAC,CAAC;oBAC5E,CAAC;gBACF,CAAC;YACF,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM;YAAE,IAAA,4BAAa,EAAC,kBAAkB,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,KAAK,CAAC,uBAAuB,CACnC,WAAoC,EACpC,SAAkC,EAClC,KAAa,EACb,SAAoB;QAEpB,0BAAuB,CAAC,MAAM,CAAC;YAC9B,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,SAAS;SACpB,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAvMY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAuMpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tDiscountMarketingModel,\n\tDiscountMarketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreateDiscountMarketingDTO as CreateDTO,\n\tUpdateDiscountMarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { badRequestError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class DiscountMarketingService {\n\tprivate model: typeof DiscountMarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = DiscountMarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\t// Only products\n\t\tif (data.products && data.products.length > 0 && (!data.categories || data.categories.length === 0)) {\n\t\t\tfor (const product of data.products) {\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && (!data.products || data.products.length === 0)) { // Only categories\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && data.products && data.products.length > 0) { // Both products and categories\n\t\t\t// For category\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For products\n\t\t\tfor (const product of data.products) {\n\t\t\t\t// Ignore the product which is already added by category\n\t\t\t\tconst isProductAddedByCategory = categoryWiseProducts.find(p => p._id.toString() === product.product.toString());\n\t\t\t\tif (isProductAddedByCategory) continue;\n\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isEntireMenu) { // Entire menu\n\t\t\tthis.productModel\n\t\t\t\t.find({\n\t\t\t\t\tshop: data.shop,\n\t\t\t\t})\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tif (data.valueType !== undefined) {\n\t\t\t\t\t\t\tthis.productMarketingsCreate(result._id, product._id, Number(data.value), data.valueType);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbadRequestError('Discount value & value-type is required for entire menu');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { categories, products, ...rest } = data;\n\t\tconst record = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\t_id: _id,\n\t\t\t\tdeletedAt: null,\n\t\t\t},\n\t\t\trest,\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\t// Remove all products from product-marketings collection\n\t\tif((data.products && data.products.length > 0) || (data.categories && data.categories.length > 0) || data.isEntireMenu) {\n\t\t\tawait productMarketingService.deleteMany(\n\t\t\t\t{ marketing: _id },\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\t// Only products\n\t\tif (data.products && data.products.length > 0 && (!data.categories || data.categories.length === 0)) {\n\t\t\tfor (const product of data.products) {\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole.log('Step 6.1');\n\t\t} else if (data.categories && data.categories.length > 0 && (!data.products || data.products.length === 0)) { // Only categories\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && data.products && data.products.length > 0) { // Both products and categories\n\t\t\t// For category\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For products\n\t\t\tfor (const product of data.products) {\n\t\t\t\t// Ignore the product which is already added by category\n\t\t\t\tconst isProductAddedByCategory = categoryWiseProducts.find(p => p._id.toString() === product.product.toString());\n\t\t\t\tif (isProductAddedByCategory) continue;\n\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isEntireMenu) { // Entire menu\n\t\t\tthis.productModel\n\t\t\t\t.find({\n\t\t\t\t\tshop: data.shop,\n\t\t\t\t})\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tif (data.valueType !== undefined) {\n\t\t\t\t\t\t\tthis.productMarketingsCreate(_id, product._id, Number(data.value), data.valueType);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbadRequestError('Discount value & value-type is required for entire menu');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n\n\tpublic async productMarketingsCreate(\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproductId: mongoose.Types.ObjectId,\n\t\tvalue: number,\n\t\tvalueType: ValueType\n\t): Promise<void> {\n\t\tproductMarketingService.create({\n\t\t\tmarketing: marketingId,\n\t\t\tproduct: productId,\n\t\t\tvalue: value,\n\t\t\tvalueType: valueType,\n\t\t});\n\t}\n}\n\nexport const discountMarketingService = Container.get(DiscountMarketingService);\n"]}
|
|
1
|
+
{"version":3,"file":"discount-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAImD;AAKnD,yBAA6C;AAE7C,4EAA2F;AAGpF,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAgC;IACrC,YAAY,CAAsB;IAE1C;QACC,IAAI,CAAC,KAAK,GAAG,+BAAsB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,qBAAY,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AS,CAAC,CAAC;oBACpF,CAAC;yBAAM,CAAC;wBACP,IAAA,8BAAe,EAAC,yDAAyD,CAAC,CAAC;oBAC5E,CAAC;gBACF,CAAC;YACF,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM;YAAE,IAAA,4BAAa,EAAC,kBAAkB,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,KAAK,CAAC,uBAAuB,CACnC,WAAoC,EACpC,SAAkC,EAClC,KAAa,EACb,SAAoB;QAEpB,0BAAuB,CAAC,MAAM,CAAC;YAC9B,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,SAAS;SACpB,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAvMY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAuMpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tDiscountMarketingModel,\n\tDiscountMarketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreateDiscountMarketingDTO as CreateDTO,\n\tUpdateDiscountMarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { badRequestError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class DiscountMarketingService {\n\tprivate model: typeof DiscountMarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = DiscountMarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\t// Only products\n\t\tif (data.products && data.products.length > 0 && (!data.categories || data.categories.length === 0)) {\n\t\t\tfor (const product of data.products) {\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && (!data.products || data.products.length === 0)) { // Only categories\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && data.products && data.products.length > 0) { // Both products and categories\n\t\t\t// For category\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For products\n\t\t\tfor (const product of data.products) {\n\t\t\t\t// Ignore the product which is already added by category\n\t\t\t\tconst isProductAddedByCategory = categoryWiseProducts.find(p => p._id.toString() === product.product.toString());\n\t\t\t\tif (isProductAddedByCategory) continue;\n\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(result._id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isEntireMenu) { // Entire menu\n\t\t\tthis.productModel\n\t\t\t\t.find({\n\t\t\t\t\tshop: data.shop,\n\t\t\t\t})\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tif (data.valueType !== undefined) {\n\t\t\t\t\t\t\tthis.productMarketingsCreate(result._id, product._id, Number(data.value), data.valueType);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbadRequestError('Discount value & value-type is required for entire menu');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { categories, products, ...rest } = data;\n\t\tconst record = await this.model.findOneAndUpdate(\n\t\t\t{\n\t\t\t\t_id: _id,\n\t\t\t\tdeletedAt: null,\n\t\t\t},\n\t\t\t{categories, ...rest},\n\t\t\t{\n\t\t\t\tnew: true,\n\t\t\t\trunValidators: true,\n\t\t\t}\n\t\t);\n\n\t\t// Remove all products from product-marketings collection\n\t\tif((data.products && data.products.length > 0) || (data.categories && data.categories.length > 0) || data.isEntireMenu) {\n\t\t\tawait productMarketingService.deleteMany(\n\t\t\t\t{ marketing: _id },\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\t// Only products\n\t\tif (data.products && data.products.length > 0 && (!data.categories || data.categories.length === 0)) {\n\t\t\tfor (const product of data.products) {\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole.log('Step 6.1');\n\t\t} else if (data.categories && data.categories.length > 0 && (!data.products || data.products.length === 0)) { // Only categories\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.categories && data.categories.length > 0 && data.products && data.products.length > 0) { // Both products and categories\n\t\t\t// For category\n\t\t\tconst categoryWiseProducts = await this.productModel.find({\n\t\t\t\tshopCategory: { $in: data.categories }\n\t\t\t})\n\t\t\t.lean();\n\n\t\t\tfor (const product of categoryWiseProducts) {\n\t\t\t\tif (data.categoryValueType !== undefined && data.categoryValueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product._id, Number(data.categoryValue), data.categoryValueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Category discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For products\n\t\t\tfor (const product of data.products) {\n\t\t\t\t// Ignore the product which is already added by category\n\t\t\t\tconst isProductAddedByCategory = categoryWiseProducts.find(p => p._id.toString() === product.product.toString());\n\t\t\t\tif (isProductAddedByCategory) continue;\n\n\t\t\t\tif (product.valueType !== undefined && product.valueType !== null) {\n\t\t\t\t\tawait this.productMarketingsCreate(_id, product.product, Number(product.value), product.valueType);\n\t\t\t\t} else {\n\t\t\t\t\tbadRequestError('Product discount value & value-type is required');\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (data.isEntireMenu) { // Entire menu\n\t\t\tthis.productModel\n\t\t\t\t.find({\n\t\t\t\t\tshop: data.shop,\n\t\t\t\t})\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tif (data.valueType !== undefined) {\n\t\t\t\t\t\t\tthis.productMarketingsCreate(_id, product._id, Number(data.value), data.valueType);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbadRequestError('Discount value & value-type is required for entire menu');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n\n\tpublic async productMarketingsCreate(\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproductId: mongoose.Types.ObjectId,\n\t\tvalue: number,\n\t\tvalueType: ValueType,\n\t): Promise<void> {\n\t\tproductMarketingService.create({\n\t\t\tmarketing: marketingId,\n\t\t\tproduct: productId,\n\t\t\tvalue: value,\n\t\t\tvalueType: valueType\n\t\t});\n\t}\n}\n\nexport const discountMarketingService = Container.get(DiscountMarketingService);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DocumentType, mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { LoyaltyPointMarketing as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
import { CreateLoyaltyPointMarketingDTO as CreateDTO, UpdateLoyaltyPointMarketingDTO as UpdateDTO } from '../../marketing/validations';
|
|
4
|
+
export declare class LoyaltyPointMarketingService {
|
|
5
|
+
private model;
|
|
6
|
+
private productModel;
|
|
7
|
+
constructor();
|
|
8
|
+
create(data: CreateDTO): Promise<DocumentType<Model>>;
|
|
9
|
+
update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const loyaltyPointMarketingService: LoyaltyPointMarketingService;
|
|
12
|
+
//# sourceMappingURL=loyalty-point-marketing.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty-point-marketing.service.d.ts","sourceRoot":"/","sources":["modules/marketing/services/loyalty-point-marketing.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAEN,qBAAqB,IAAI,KAAK,EAE9B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,8BAA8B,IAAI,SAAS,EAC3C,8BAA8B,IAAI,SAAS,EAC3C,MAAM,gCAAgC,CAAC;AAGxC,qBACa,4BAA4B;IACxC,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,YAAY,CAAsB;;IAW7B,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAyCrD,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;CAoEhG;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|