vr-commons 1.0.176 → 1.0.177
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/constants/regex.constants.d.ts +19 -0
- package/dist/constants/regex.constants.js +24 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/middlewares/admin/admin.auth.middleware.js +60 -0
- package/dist/middlewares/index.d.ts +4 -5
- package/dist/middlewares/index.js +11 -14
- package/dist/middlewares/shared/auth.admin.middlewares.d.ts +3 -0
- package/dist/middlewares/{auth.admin.middlewares.js → shared/auth.admin.middlewares.js} +7 -7
- package/dist/middlewares/{account.shared.middlewares.js → shared/shared.account.middleware.js} +8 -8
- package/dist/middlewares/{errorHandler.middleware.js → shared/shared.errorHandler.middleware.js} +0 -1
- package/dist/middlewares/{auth.users.middlewares.js → users/users.auth.middleware.js} +10 -10
- package/dist/utils/{admin.devicePayment.utils.js → admin/admin.devicePayments.utils.js} +0 -1
- package/dist/utils/{admin.device.utils.d.ts → admin/admin.devices.utils.d.ts} +1 -1
- package/dist/utils/{admin.device.utils.js → admin/admin.devices.utils.js} +11 -12
- package/dist/utils/{eventlogs.admin.utils.js → admin/admin.eventLogs.utils.js} +0 -1
- package/dist/utils/{hierarchy.utils.js → admin/admin.hierarchy.utils.js} +0 -2
- package/dist/utils/{product.utils.d.ts → admin/admin.products.utils.d.ts} +1 -1
- package/dist/utils/{systemLog.utils.js → admin/admin.systemLogs.utils.js} +0 -1
- package/dist/utils/index.d.ts +16 -18
- package/dist/utils/index.js +88 -99
- package/dist/utils/{account.utils.js → shared/shared.accounts.utils.js} +0 -1
- package/dist/utils/{profiles.utils.d.ts → shared/shared.profiles.utils.d.ts} +2 -1
- package/dist/utils/{profiles.utils.js → shared/shared.profiles.utils.js} +3 -2
- package/dist/utils/{verification.utils.d.ts → users/users.verification.utils.d.ts} +1 -1
- package/dist/utils/{verification.utils.js → users/users.verification.utils.js} +3 -2
- package/dist/validations/{admin.devicePayment.validations.js → admin/admin.devicePayments.validations.js} +3 -2
- package/dist/validations/{admin.devices.validations.js → admin/admin.devices.validations.js} +4 -5
- package/dist/validations/{eventlogs.admin.validations.js → admin/admin.eventLogs.validations.js} +2 -2
- package/dist/validations/{admin.installment.validations.js → admin/admin.installments.validations.js} +4 -3
- package/dist/validations/{pricings.validations.js → admin/admin.pricings.validations.js} +5 -5
- package/dist/validations/{product.validations.js → admin/admin.products.validations.js} +4 -3
- package/dist/validations/{users.admin.validations.js → admin/admin.users.validations.js} +13 -13
- package/dist/validations/index.d.ts +16 -15
- package/dist/validations/index.js +132 -125
- package/dist/validations/{account.validations.js → shared/shared.account.validations.js} +7 -7
- package/dist/validations/{appSpecs.validations.js → shared/shared.appSpecs.validations.js} +0 -1
- package/dist/validations/{auth.validations.js → shared/shared.auth.validations.js} +6 -6
- package/dist/validations/{dateRange.validations.js → shared/shared.dateRanges.validations.js} +5 -5
- package/dist/validations/{moderation.validations.js → shared/shared.moderation.validations.js} +24 -25
- package/dist/validations/{profiles.validations.js → shared/shared.profiles.validations.js} +22 -21
- package/dist/validations/{devices.validations.js → users/users.devices.validations.js} +2 -1
- package/package.json +1 -1
- package/dist/middlewares/idempotency.middlewares.d.ts +0 -3
- package/dist/middlewares/idempotency.middlewares.js +0 -74
- package/dist/utils/deviceUtils.d.ts +0 -2
- package/dist/utils/deviceUtils.js +0 -21
- package/dist/utils/session.utils.d.ts +0 -6
- package/dist/utils/session.utils.js +0 -25
- package/dist/validations/appeals.validations.d.ts +0 -61
- package/dist/validations/appeals.validations.js +0 -31
- package/dist/validations/payinstallment.validations.d.ts +0 -56
- package/dist/validations/payinstallment.validations.js +0 -23
- package/dist/validations/pricing.validations.d.ts +0 -313
- package/dist/validations/pricing.validations.js +0 -376
- /package/dist/middlewares/{auth.admin.middlewares.d.ts → admin/admin.auth.middleware.d.ts} +0 -0
- /package/dist/middlewares/{account.shared.middlewares.d.ts → shared/shared.account.middleware.d.ts} +0 -0
- /package/dist/middlewares/{errorHandler.middleware.d.ts → shared/shared.errorHandler.middleware.d.ts} +0 -0
- /package/dist/middlewares/{auth.users.middlewares.d.ts → users/users.auth.middleware.d.ts} +0 -0
- /package/dist/utils/{bans.utils.d.ts → admin/admin.bans.utils.d.ts} +0 -0
- /package/dist/utils/{bans.utils.js → admin/admin.bans.utils.js} +0 -0
- /package/dist/utils/{admin.devicePayment.utils.d.ts → admin/admin.devicePayments.utils.d.ts} +0 -0
- /package/dist/utils/{eventlogs.admin.utils.d.ts → admin/admin.eventLogs.utils.d.ts} +0 -0
- /package/dist/utils/{hierarchy.utils.d.ts → admin/admin.hierarchy.utils.d.ts} +0 -0
- /package/dist/utils/{moderation.utils.d.ts → admin/admin.moderation.utils.d.ts} +0 -0
- /package/dist/utils/{moderation.utils.js → admin/admin.moderation.utils.js} +0 -0
- /package/dist/utils/{product.utils.js → admin/admin.products.utils.js} +0 -0
- /package/dist/utils/{suspension.utils.d.ts → admin/admin.suspensions.utils.d.ts} +0 -0
- /package/dist/utils/{suspension.utils.js → admin/admin.suspensions.utils.js} +0 -0
- /package/dist/utils/{systemLog.utils.d.ts → admin/admin.systemLogs.utils.d.ts} +0 -0
- /package/dist/utils/{account.utils.d.ts → shared/shared.accounts.utils.d.ts} +0 -0
- /package/dist/utils/{authTokens.utils.d.ts → shared/shared.authTokens.utils.d.ts} +0 -0
- /package/dist/utils/{authTokens.utils.js → shared/shared.authTokens.utils.js} +0 -0
- /package/dist/utils/{eventLog.utils.d.ts → shared/shared.eventLogs.utils.d.ts} +0 -0
- /package/dist/utils/{eventLog.utils.js → shared/shared.eventLogs.utils.js} +0 -0
- /package/dist/utils/{response.utils.d.ts → shared/shared.responses.utils.d.ts} +0 -0
- /package/dist/utils/{response.utils.js → shared/shared.responses.utils.js} +0 -0
- /package/dist/utils/{types.d.ts → shared/shared.types.d.ts} +0 -0
- /package/dist/utils/{types.js → shared/shared.types.js} +0 -0
- /package/dist/validations/{bans.validations.d.ts → admin/admin.bans.validations.d.ts} +0 -0
- /package/dist/validations/{bans.validations.js → admin/admin.bans.validations.js} +0 -0
- /package/dist/validations/{admin.devicePayment.validations.d.ts → admin/admin.devicePayments.validations.d.ts} +0 -0
- /package/dist/validations/{admin.devices.validations.d.ts → admin/admin.devices.validations.d.ts} +0 -0
- /package/dist/validations/{eventlogs.admin.validations.d.ts → admin/admin.eventLogs.validations.d.ts} +0 -0
- /package/dist/validations/{admin.installment.validations.d.ts → admin/admin.installments.validations.d.ts} +0 -0
- /package/dist/validations/{pricings.validations.d.ts → admin/admin.pricings.validations.d.ts} +0 -0
- /package/dist/validations/{product.validations.d.ts → admin/admin.products.validations.d.ts} +0 -0
- /package/dist/validations/{suspensions.validations.d.ts → admin/admin.suspensions.validations.d.ts} +0 -0
- /package/dist/validations/{suspensions.validations.js → admin/admin.suspensions.validations.js} +0 -0
- /package/dist/validations/{users.admin.validations.d.ts → admin/admin.users.validations.d.ts} +0 -0
- /package/dist/validations/{account.validations.d.ts → shared/shared.account.validations.d.ts} +0 -0
- /package/dist/validations/{appSpecs.validations.d.ts → shared/shared.appSpecs.validations.d.ts} +0 -0
- /package/dist/validations/{auth.validations.d.ts → shared/shared.auth.validations.d.ts} +0 -0
- /package/dist/validations/{dateRange.validations.d.ts → shared/shared.dateRanges.validations.d.ts} +0 -0
- /package/dist/validations/{moderation.validations.d.ts → shared/shared.moderation.validations.d.ts} +0 -0
- /package/dist/validations/{profiles.validations.d.ts → shared/shared.profiles.validations.d.ts} +0 -0
- /package/dist/validations/{validate.validations.d.ts → shared/shared.validate.validations.d.ts} +0 -0
- /package/dist/validations/{validate.validations.js → shared/shared.validate.validations.js} +0 -0
- /package/dist/validations/{devicePaymentPlan.validations.d.ts → users/users.devicePaymentPlans.validations.d.ts} +0 -0
- /package/dist/validations/{devicePaymentPlan.validations.js → users/users.devicePaymentPlans.validations.js} +0 -0
- /package/dist/validations/{devices.validations.d.ts → users/users.devices.validations.d.ts} +0 -0
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const createPricingSchema: z.ZodObject<{
|
|
3
|
-
body: z.ZodEffects<z.ZodObject<{
|
|
4
|
-
productId: z.ZodString;
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
type: z.ZodEnum<["HIRE_PURCHASE", "FULL_PAYMENT"]>;
|
|
7
|
-
totalAmount: z.ZodNumber;
|
|
8
|
-
downPayment: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
installmentAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
10
|
-
installmentFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>>>;
|
|
11
|
-
installmentCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
12
|
-
gracePeriodDays: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
autoLockOnMiss: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
-
minOrderQuantity: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
maxOrderQuantity: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
19
|
-
productId: string;
|
|
20
|
-
name: string;
|
|
21
|
-
totalAmount: number;
|
|
22
|
-
isActive?: boolean | undefined;
|
|
23
|
-
downPayment?: number | undefined;
|
|
24
|
-
installmentAmount?: number | null | undefined;
|
|
25
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
26
|
-
installmentCount?: number | null | undefined;
|
|
27
|
-
gracePeriodDays?: number | undefined;
|
|
28
|
-
autoLockOnMiss?: boolean | undefined;
|
|
29
|
-
minOrderQuantity?: number | undefined;
|
|
30
|
-
maxOrderQuantity?: number | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
33
|
-
productId: string;
|
|
34
|
-
name: string;
|
|
35
|
-
totalAmount: number;
|
|
36
|
-
isActive?: boolean | undefined;
|
|
37
|
-
downPayment?: number | undefined;
|
|
38
|
-
installmentAmount?: number | null | undefined;
|
|
39
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
40
|
-
installmentCount?: number | null | undefined;
|
|
41
|
-
gracePeriodDays?: number | undefined;
|
|
42
|
-
autoLockOnMiss?: boolean | undefined;
|
|
43
|
-
minOrderQuantity?: number | undefined;
|
|
44
|
-
maxOrderQuantity?: number | undefined;
|
|
45
|
-
}>, {
|
|
46
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
47
|
-
productId: string;
|
|
48
|
-
name: string;
|
|
49
|
-
totalAmount: number;
|
|
50
|
-
isActive?: boolean | undefined;
|
|
51
|
-
downPayment?: number | undefined;
|
|
52
|
-
installmentAmount?: number | null | undefined;
|
|
53
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
54
|
-
installmentCount?: number | null | undefined;
|
|
55
|
-
gracePeriodDays?: number | undefined;
|
|
56
|
-
autoLockOnMiss?: boolean | undefined;
|
|
57
|
-
minOrderQuantity?: number | undefined;
|
|
58
|
-
maxOrderQuantity?: number | undefined;
|
|
59
|
-
}, {
|
|
60
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
61
|
-
productId: string;
|
|
62
|
-
name: string;
|
|
63
|
-
totalAmount: number;
|
|
64
|
-
isActive?: boolean | undefined;
|
|
65
|
-
downPayment?: number | undefined;
|
|
66
|
-
installmentAmount?: number | null | undefined;
|
|
67
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
68
|
-
installmentCount?: number | null | undefined;
|
|
69
|
-
gracePeriodDays?: number | undefined;
|
|
70
|
-
autoLockOnMiss?: boolean | undefined;
|
|
71
|
-
minOrderQuantity?: number | undefined;
|
|
72
|
-
maxOrderQuantity?: number | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
body: {
|
|
76
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
77
|
-
productId: string;
|
|
78
|
-
name: string;
|
|
79
|
-
totalAmount: number;
|
|
80
|
-
isActive?: boolean | undefined;
|
|
81
|
-
downPayment?: number | undefined;
|
|
82
|
-
installmentAmount?: number | null | undefined;
|
|
83
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
84
|
-
installmentCount?: number | null | undefined;
|
|
85
|
-
gracePeriodDays?: number | undefined;
|
|
86
|
-
autoLockOnMiss?: boolean | undefined;
|
|
87
|
-
minOrderQuantity?: number | undefined;
|
|
88
|
-
maxOrderQuantity?: number | undefined;
|
|
89
|
-
};
|
|
90
|
-
}, {
|
|
91
|
-
body: {
|
|
92
|
-
type: "HIRE_PURCHASE" | "FULL_PAYMENT";
|
|
93
|
-
productId: string;
|
|
94
|
-
name: string;
|
|
95
|
-
totalAmount: number;
|
|
96
|
-
isActive?: boolean | undefined;
|
|
97
|
-
downPayment?: number | undefined;
|
|
98
|
-
installmentAmount?: number | null | undefined;
|
|
99
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
100
|
-
installmentCount?: number | null | undefined;
|
|
101
|
-
gracePeriodDays?: number | undefined;
|
|
102
|
-
autoLockOnMiss?: boolean | undefined;
|
|
103
|
-
minOrderQuantity?: number | undefined;
|
|
104
|
-
maxOrderQuantity?: number | undefined;
|
|
105
|
-
};
|
|
106
|
-
}>;
|
|
107
|
-
export declare const updatePricingSchema: z.ZodObject<{
|
|
108
|
-
params: z.ZodObject<{
|
|
109
|
-
id: z.ZodString;
|
|
110
|
-
}, "strip", z.ZodTypeAny, {
|
|
111
|
-
id: string;
|
|
112
|
-
}, {
|
|
113
|
-
id: string;
|
|
114
|
-
}>;
|
|
115
|
-
body: z.ZodEffects<z.ZodObject<{
|
|
116
|
-
name: z.ZodOptional<z.ZodString>;
|
|
117
|
-
type: z.ZodOptional<z.ZodEnum<["HIRE_PURCHASE", "FULL_PAYMENT"]>>;
|
|
118
|
-
totalAmount: z.ZodOptional<z.ZodNumber>;
|
|
119
|
-
downPayment: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
120
|
-
installmentAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
121
|
-
installmentFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>>>;
|
|
122
|
-
installmentCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
123
|
-
gracePeriodDays: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
124
|
-
autoLockOnMiss: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
125
|
-
minOrderQuantity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
126
|
-
maxOrderQuantity: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
127
|
-
isActive: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
128
|
-
}, "strip", z.ZodTypeAny, {
|
|
129
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
130
|
-
isActive?: boolean | undefined;
|
|
131
|
-
name?: string | undefined;
|
|
132
|
-
totalAmount?: number | undefined;
|
|
133
|
-
downPayment?: number | undefined;
|
|
134
|
-
installmentAmount?: number | null | undefined;
|
|
135
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
136
|
-
installmentCount?: number | null | undefined;
|
|
137
|
-
gracePeriodDays?: number | undefined;
|
|
138
|
-
autoLockOnMiss?: boolean | undefined;
|
|
139
|
-
minOrderQuantity?: number | undefined;
|
|
140
|
-
maxOrderQuantity?: number | undefined;
|
|
141
|
-
}, {
|
|
142
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
143
|
-
isActive?: boolean | undefined;
|
|
144
|
-
name?: string | undefined;
|
|
145
|
-
totalAmount?: number | undefined;
|
|
146
|
-
downPayment?: number | undefined;
|
|
147
|
-
installmentAmount?: number | null | undefined;
|
|
148
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
149
|
-
installmentCount?: number | null | undefined;
|
|
150
|
-
gracePeriodDays?: number | undefined;
|
|
151
|
-
autoLockOnMiss?: boolean | undefined;
|
|
152
|
-
minOrderQuantity?: number | undefined;
|
|
153
|
-
maxOrderQuantity?: number | undefined;
|
|
154
|
-
}>, {
|
|
155
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
156
|
-
isActive?: boolean | undefined;
|
|
157
|
-
name?: string | undefined;
|
|
158
|
-
totalAmount?: number | undefined;
|
|
159
|
-
downPayment?: number | undefined;
|
|
160
|
-
installmentAmount?: number | null | undefined;
|
|
161
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
162
|
-
installmentCount?: number | null | undefined;
|
|
163
|
-
gracePeriodDays?: number | undefined;
|
|
164
|
-
autoLockOnMiss?: boolean | undefined;
|
|
165
|
-
minOrderQuantity?: number | undefined;
|
|
166
|
-
maxOrderQuantity?: number | undefined;
|
|
167
|
-
}, {
|
|
168
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
169
|
-
isActive?: boolean | undefined;
|
|
170
|
-
name?: string | undefined;
|
|
171
|
-
totalAmount?: number | undefined;
|
|
172
|
-
downPayment?: number | undefined;
|
|
173
|
-
installmentAmount?: number | null | undefined;
|
|
174
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
175
|
-
installmentCount?: number | null | undefined;
|
|
176
|
-
gracePeriodDays?: number | undefined;
|
|
177
|
-
autoLockOnMiss?: boolean | undefined;
|
|
178
|
-
minOrderQuantity?: number | undefined;
|
|
179
|
-
maxOrderQuantity?: number | undefined;
|
|
180
|
-
}>;
|
|
181
|
-
}, "strip", z.ZodTypeAny, {
|
|
182
|
-
params: {
|
|
183
|
-
id: string;
|
|
184
|
-
};
|
|
185
|
-
body: {
|
|
186
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
187
|
-
isActive?: boolean | undefined;
|
|
188
|
-
name?: string | undefined;
|
|
189
|
-
totalAmount?: number | undefined;
|
|
190
|
-
downPayment?: number | undefined;
|
|
191
|
-
installmentAmount?: number | null | undefined;
|
|
192
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
193
|
-
installmentCount?: number | null | undefined;
|
|
194
|
-
gracePeriodDays?: number | undefined;
|
|
195
|
-
autoLockOnMiss?: boolean | undefined;
|
|
196
|
-
minOrderQuantity?: number | undefined;
|
|
197
|
-
maxOrderQuantity?: number | undefined;
|
|
198
|
-
};
|
|
199
|
-
}, {
|
|
200
|
-
params: {
|
|
201
|
-
id: string;
|
|
202
|
-
};
|
|
203
|
-
body: {
|
|
204
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
205
|
-
isActive?: boolean | undefined;
|
|
206
|
-
name?: string | undefined;
|
|
207
|
-
totalAmount?: number | undefined;
|
|
208
|
-
downPayment?: number | undefined;
|
|
209
|
-
installmentAmount?: number | null | undefined;
|
|
210
|
-
installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
|
|
211
|
-
installmentCount?: number | null | undefined;
|
|
212
|
-
gracePeriodDays?: number | undefined;
|
|
213
|
-
autoLockOnMiss?: boolean | undefined;
|
|
214
|
-
minOrderQuantity?: number | undefined;
|
|
215
|
-
maxOrderQuantity?: number | undefined;
|
|
216
|
-
};
|
|
217
|
-
}>;
|
|
218
|
-
export declare const getPricingSchema: z.ZodObject<{
|
|
219
|
-
params: z.ZodObject<{
|
|
220
|
-
id: z.ZodString;
|
|
221
|
-
}, "strip", z.ZodTypeAny, {
|
|
222
|
-
id: string;
|
|
223
|
-
}, {
|
|
224
|
-
id: string;
|
|
225
|
-
}>;
|
|
226
|
-
}, "strip", z.ZodTypeAny, {
|
|
227
|
-
params: {
|
|
228
|
-
id: string;
|
|
229
|
-
};
|
|
230
|
-
}, {
|
|
231
|
-
params: {
|
|
232
|
-
id: string;
|
|
233
|
-
};
|
|
234
|
-
}>;
|
|
235
|
-
export declare const getPricingsSchema: z.ZodObject<{
|
|
236
|
-
query: z.ZodObject<{
|
|
237
|
-
page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
238
|
-
limit: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
239
|
-
productId: z.ZodOptional<z.ZodString>;
|
|
240
|
-
type: z.ZodOptional<z.ZodEnum<["HIRE_PURCHASE", "FULL_PAYMENT"]>>;
|
|
241
|
-
isActive: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
242
|
-
minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
243
|
-
maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
244
|
-
search: z.ZodOptional<z.ZodString>;
|
|
245
|
-
sortBy: z.ZodOptional<z.ZodEnum<["name", "totalAmount", "createdAt", "updatedAt"]>>;
|
|
246
|
-
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
247
|
-
}, "strip", z.ZodTypeAny, {
|
|
248
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
249
|
-
productId?: string | undefined;
|
|
250
|
-
page?: number | undefined;
|
|
251
|
-
limit?: number | undefined;
|
|
252
|
-
search?: string | undefined;
|
|
253
|
-
sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
|
|
254
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
255
|
-
isActive?: "true" | "false" | undefined;
|
|
256
|
-
minAmount?: number | undefined;
|
|
257
|
-
maxAmount?: number | undefined;
|
|
258
|
-
}, {
|
|
259
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
260
|
-
productId?: string | undefined;
|
|
261
|
-
page?: string | undefined;
|
|
262
|
-
limit?: string | undefined;
|
|
263
|
-
search?: string | undefined;
|
|
264
|
-
sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
|
|
265
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
266
|
-
isActive?: "true" | "false" | undefined;
|
|
267
|
-
minAmount?: string | undefined;
|
|
268
|
-
maxAmount?: string | undefined;
|
|
269
|
-
}>;
|
|
270
|
-
}, "strip", z.ZodTypeAny, {
|
|
271
|
-
query: {
|
|
272
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
273
|
-
productId?: string | undefined;
|
|
274
|
-
page?: number | undefined;
|
|
275
|
-
limit?: number | undefined;
|
|
276
|
-
search?: string | undefined;
|
|
277
|
-
sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
|
|
278
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
279
|
-
isActive?: "true" | "false" | undefined;
|
|
280
|
-
minAmount?: number | undefined;
|
|
281
|
-
maxAmount?: number | undefined;
|
|
282
|
-
};
|
|
283
|
-
}, {
|
|
284
|
-
query: {
|
|
285
|
-
type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
|
|
286
|
-
productId?: string | undefined;
|
|
287
|
-
page?: string | undefined;
|
|
288
|
-
limit?: string | undefined;
|
|
289
|
-
search?: string | undefined;
|
|
290
|
-
sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
|
|
291
|
-
sortOrder?: "ASC" | "DESC" | undefined;
|
|
292
|
-
isActive?: "true" | "false" | undefined;
|
|
293
|
-
minAmount?: string | undefined;
|
|
294
|
-
maxAmount?: string | undefined;
|
|
295
|
-
};
|
|
296
|
-
}>;
|
|
297
|
-
export declare const deletePricingSchema: z.ZodObject<{
|
|
298
|
-
params: z.ZodObject<{
|
|
299
|
-
id: z.ZodString;
|
|
300
|
-
}, "strip", z.ZodTypeAny, {
|
|
301
|
-
id: string;
|
|
302
|
-
}, {
|
|
303
|
-
id: string;
|
|
304
|
-
}>;
|
|
305
|
-
}, "strip", z.ZodTypeAny, {
|
|
306
|
-
params: {
|
|
307
|
-
id: string;
|
|
308
|
-
};
|
|
309
|
-
}, {
|
|
310
|
-
params: {
|
|
311
|
-
id: string;
|
|
312
|
-
};
|
|
313
|
-
}>;
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = void 0;
|
|
4
|
-
// src/validations/pricing.validation.ts
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
// Constants
|
|
7
|
-
const PRICING_TYPES = ["HIRE_PURCHASE", "FULL_PAYMENT"];
|
|
8
|
-
const INSTALLMENT_FREQUENCIES = ["DAILY", "WEEKLY", "MONTHLY"];
|
|
9
|
-
// Base pricing schema
|
|
10
|
-
const pricingBaseSchema = {
|
|
11
|
-
productId: zod_1.z.string().uuid("Invalid product ID"),
|
|
12
|
-
name: zod_1.z.string().min(3, "Name must be at least 3 characters").max(100),
|
|
13
|
-
type: zod_1.z.enum(PRICING_TYPES, {
|
|
14
|
-
errorMap: () => ({ message: "Type must be HIRE_PURCHASE or FULL_PAYMENT" }),
|
|
15
|
-
}),
|
|
16
|
-
totalAmount: zod_1.z.number().min(0, "Total amount cannot be negative"),
|
|
17
|
-
downPayment: zod_1.z.number().min(0, "Down payment cannot be negative").optional(),
|
|
18
|
-
installmentAmount: zod_1.z
|
|
19
|
-
.number()
|
|
20
|
-
.min(0, "Installment amount cannot be negative")
|
|
21
|
-
.nullable()
|
|
22
|
-
.optional(),
|
|
23
|
-
installmentFrequency: zod_1.z.enum(INSTALLMENT_FREQUENCIES).nullable().optional(),
|
|
24
|
-
installmentCount: zod_1.z
|
|
25
|
-
.number()
|
|
26
|
-
.int()
|
|
27
|
-
.min(1, "Installment count must be at least 1")
|
|
28
|
-
.nullable()
|
|
29
|
-
.optional(),
|
|
30
|
-
gracePeriodDays: zod_1.z
|
|
31
|
-
.number()
|
|
32
|
-
.int()
|
|
33
|
-
.min(0, "Grace period cannot be negative")
|
|
34
|
-
.max(30, "Grace period too long")
|
|
35
|
-
.optional(),
|
|
36
|
-
autoLockOnMiss: zod_1.z.boolean().optional(),
|
|
37
|
-
// NEW FIELDS
|
|
38
|
-
minOrderQuantity: zod_1.z
|
|
39
|
-
.number()
|
|
40
|
-
.int()
|
|
41
|
-
.min(1, "Minimum order quantity must be at least 1")
|
|
42
|
-
.optional(),
|
|
43
|
-
maxOrderQuantity: zod_1.z
|
|
44
|
-
.number()
|
|
45
|
-
.int()
|
|
46
|
-
.min(1, "Maximum order quantity must be at least 1")
|
|
47
|
-
.optional(),
|
|
48
|
-
isActive: zod_1.z.boolean().optional(),
|
|
49
|
-
};
|
|
50
|
-
// Create pricing schema with STRICT validation
|
|
51
|
-
exports.createPricingSchema = zod_1.z.object({
|
|
52
|
-
body: zod_1.z
|
|
53
|
-
.object({
|
|
54
|
-
productId: pricingBaseSchema.productId,
|
|
55
|
-
name: pricingBaseSchema.name,
|
|
56
|
-
type: pricingBaseSchema.type,
|
|
57
|
-
totalAmount: pricingBaseSchema.totalAmount,
|
|
58
|
-
downPayment: pricingBaseSchema.downPayment,
|
|
59
|
-
installmentAmount: pricingBaseSchema.installmentAmount,
|
|
60
|
-
installmentFrequency: pricingBaseSchema.installmentFrequency,
|
|
61
|
-
installmentCount: pricingBaseSchema.installmentCount,
|
|
62
|
-
gracePeriodDays: pricingBaseSchema.gracePeriodDays,
|
|
63
|
-
autoLockOnMiss: pricingBaseSchema.autoLockOnMiss,
|
|
64
|
-
minOrderQuantity: pricingBaseSchema.minOrderQuantity,
|
|
65
|
-
maxOrderQuantity: pricingBaseSchema.maxOrderQuantity,
|
|
66
|
-
isActive: pricingBaseSchema.isActive,
|
|
67
|
-
})
|
|
68
|
-
.superRefine((data, ctx) => {
|
|
69
|
-
// Validate minOrderQuantity <= maxOrderQuantity
|
|
70
|
-
const minQty = data.minOrderQuantity ?? 1;
|
|
71
|
-
const maxQty = data.maxOrderQuantity ?? 1;
|
|
72
|
-
if (minQty > maxQty) {
|
|
73
|
-
ctx.addIssue({
|
|
74
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
75
|
-
message: "Minimum order quantity cannot be greater than maximum order quantity",
|
|
76
|
-
path: ["minOrderQuantity"],
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
// HIRE_PURCHASE validation
|
|
80
|
-
if (data.type === "HIRE_PURCHASE") {
|
|
81
|
-
// Must have downPayment (can be 0, but must be present)
|
|
82
|
-
if (data.downPayment === undefined) {
|
|
83
|
-
ctx.addIssue({
|
|
84
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
85
|
-
message: "Down payment is required for hire purchase",
|
|
86
|
-
path: ["downPayment"],
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
// Must have installmentAmount
|
|
90
|
-
if (!data.installmentAmount || data.installmentAmount <= 0) {
|
|
91
|
-
ctx.addIssue({
|
|
92
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
93
|
-
message: "Installment amount is required and must be > 0 for hire purchase",
|
|
94
|
-
path: ["installmentAmount"],
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
// Must have installmentFrequency
|
|
98
|
-
if (!data.installmentFrequency) {
|
|
99
|
-
ctx.addIssue({
|
|
100
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
101
|
-
message: "Installment frequency is required for hire purchase",
|
|
102
|
-
path: ["installmentFrequency"],
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
// Must have installmentCount
|
|
106
|
-
if (!data.installmentCount || data.installmentCount <= 0) {
|
|
107
|
-
ctx.addIssue({
|
|
108
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
109
|
-
message: "Installment count is required and must be > 0 for hire purchase",
|
|
110
|
-
path: ["installmentCount"],
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
// Grace period days is required for hire purchase
|
|
114
|
-
if (data.gracePeriodDays === undefined) {
|
|
115
|
-
ctx.addIssue({
|
|
116
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
117
|
-
message: "Grace period days is required for hire purchase",
|
|
118
|
-
path: ["gracePeriodDays"],
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
// Auto lock on miss is required for hire purchase
|
|
122
|
-
if (data.autoLockOnMiss === undefined) {
|
|
123
|
-
ctx.addIssue({
|
|
124
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
125
|
-
message: "Auto lock on miss is required for hire purchase",
|
|
126
|
-
path: ["autoLockOnMiss"],
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
// Validate math: totalAmount = downPayment + (installmentAmount × installmentCount)
|
|
130
|
-
if (data.installmentAmount && data.installmentCount) {
|
|
131
|
-
const calculatedTotal = (data.downPayment || 0) +
|
|
132
|
-
data.installmentAmount * data.installmentCount;
|
|
133
|
-
if (Math.abs(calculatedTotal - data.totalAmount) > 0.01) {
|
|
134
|
-
ctx.addIssue({
|
|
135
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
136
|
-
message: `Total amount must equal downPayment + (installmentAmount × installmentCount). Expected ~${calculatedTotal.toFixed(2)}`,
|
|
137
|
-
path: ["totalAmount"],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Down payment must be less than total amount
|
|
142
|
-
if (data.downPayment && data.downPayment >= data.totalAmount) {
|
|
143
|
-
ctx.addIssue({
|
|
144
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
145
|
-
message: "Down payment must be less than total amount",
|
|
146
|
-
path: ["downPayment"],
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// FULL_PAYMENT validation - STRICT: ONLY totalAmount allowed!
|
|
151
|
-
if (data.type === "FULL_PAYMENT") {
|
|
152
|
-
// NO down payment allowed
|
|
153
|
-
if (data.downPayment !== undefined && data.downPayment > 0) {
|
|
154
|
-
ctx.addIssue({
|
|
155
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
156
|
-
message: "Down payment cannot be set for full payment. Use totalAmount only.",
|
|
157
|
-
path: ["downPayment"],
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
// NO installment amount allowed
|
|
161
|
-
if (data.installmentAmount !== undefined &&
|
|
162
|
-
data.installmentAmount !== null) {
|
|
163
|
-
ctx.addIssue({
|
|
164
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
165
|
-
message: "Installment amount cannot be set for full payment",
|
|
166
|
-
path: ["installmentAmount"],
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
// NO installment frequency allowed
|
|
170
|
-
if (data.installmentFrequency !== undefined &&
|
|
171
|
-
data.installmentFrequency !== null) {
|
|
172
|
-
ctx.addIssue({
|
|
173
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
174
|
-
message: "Installment frequency cannot be set for full payment",
|
|
175
|
-
path: ["installmentFrequency"],
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
// NO installment count allowed
|
|
179
|
-
if (data.installmentCount !== undefined &&
|
|
180
|
-
data.installmentCount !== null) {
|
|
181
|
-
ctx.addIssue({
|
|
182
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
183
|
-
message: "Installment count cannot be set for full payment",
|
|
184
|
-
path: ["installmentCount"],
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
// NO grace period days needed for full payment
|
|
188
|
-
if (data.gracePeriodDays !== undefined) {
|
|
189
|
-
ctx.addIssue({
|
|
190
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
191
|
-
message: "Grace period days is not applicable for full payment",
|
|
192
|
-
path: ["gracePeriodDays"],
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
// NO auto lock on miss needed for full payment
|
|
196
|
-
if (data.autoLockOnMiss !== undefined) {
|
|
197
|
-
ctx.addIssue({
|
|
198
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
199
|
-
message: "Auto lock on miss is not applicable for full payment",
|
|
200
|
-
path: ["autoLockOnMiss"],
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
// Total amount is required and must be positive
|
|
204
|
-
if (!data.totalAmount || data.totalAmount <= 0) {
|
|
205
|
-
ctx.addIssue({
|
|
206
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
207
|
-
message: "Total amount is required and must be > 0 for full payment",
|
|
208
|
-
path: ["totalAmount"],
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}),
|
|
213
|
-
});
|
|
214
|
-
// Update pricing schema with STRICT validation
|
|
215
|
-
exports.updatePricingSchema = zod_1.z.object({
|
|
216
|
-
params: zod_1.z.object({
|
|
217
|
-
id: zod_1.z.string().uuid("Invalid pricing ID"),
|
|
218
|
-
}),
|
|
219
|
-
body: zod_1.z
|
|
220
|
-
.object({
|
|
221
|
-
name: pricingBaseSchema.name.optional(),
|
|
222
|
-
type: pricingBaseSchema.type.optional(),
|
|
223
|
-
totalAmount: pricingBaseSchema.totalAmount.optional(),
|
|
224
|
-
downPayment: pricingBaseSchema.downPayment.optional(),
|
|
225
|
-
installmentAmount: pricingBaseSchema.installmentAmount,
|
|
226
|
-
installmentFrequency: pricingBaseSchema.installmentFrequency,
|
|
227
|
-
installmentCount: pricingBaseSchema.installmentCount,
|
|
228
|
-
gracePeriodDays: pricingBaseSchema.gracePeriodDays.optional(),
|
|
229
|
-
autoLockOnMiss: pricingBaseSchema.autoLockOnMiss.optional(),
|
|
230
|
-
minOrderQuantity: pricingBaseSchema.minOrderQuantity.optional(),
|
|
231
|
-
maxOrderQuantity: pricingBaseSchema.maxOrderQuantity.optional(),
|
|
232
|
-
isActive: pricingBaseSchema.isActive.optional(),
|
|
233
|
-
})
|
|
234
|
-
.superRefine((data, ctx) => {
|
|
235
|
-
// Validate minOrderQuantity <= maxOrderQuantity if both are provided
|
|
236
|
-
if (data.minOrderQuantity !== undefined &&
|
|
237
|
-
data.maxOrderQuantity !== undefined) {
|
|
238
|
-
if (data.minOrderQuantity > data.maxOrderQuantity) {
|
|
239
|
-
ctx.addIssue({
|
|
240
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
241
|
-
message: "Minimum order quantity cannot be greater than maximum order quantity",
|
|
242
|
-
path: ["minOrderQuantity"],
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
// If type is being updated to HIRE_PURCHASE
|
|
247
|
-
if (data.type === "HIRE_PURCHASE") {
|
|
248
|
-
if (data.downPayment === undefined) {
|
|
249
|
-
ctx.addIssue({
|
|
250
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
251
|
-
message: "Down payment is required when updating to hire purchase",
|
|
252
|
-
path: ["downPayment"],
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
if (!data.installmentAmount) {
|
|
256
|
-
ctx.addIssue({
|
|
257
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
258
|
-
message: "Installment amount is required when updating to hire purchase",
|
|
259
|
-
path: ["installmentAmount"],
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
if (!data.installmentFrequency) {
|
|
263
|
-
ctx.addIssue({
|
|
264
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
265
|
-
message: "Installment frequency is required when updating to hire purchase",
|
|
266
|
-
path: ["installmentFrequency"],
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
if (!data.installmentCount) {
|
|
270
|
-
ctx.addIssue({
|
|
271
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
272
|
-
message: "Installment count is required when updating to hire purchase",
|
|
273
|
-
path: ["installmentCount"],
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
if (data.gracePeriodDays === undefined) {
|
|
277
|
-
ctx.addIssue({
|
|
278
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
279
|
-
message: "Grace period days is required for hire purchase",
|
|
280
|
-
path: ["gracePeriodDays"],
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
if (data.autoLockOnMiss === undefined) {
|
|
284
|
-
ctx.addIssue({
|
|
285
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
286
|
-
message: "Auto lock on miss is required for hire purchase",
|
|
287
|
-
path: ["autoLockOnMiss"],
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
// If type is being updated to FULL_PAYMENT - STRICT: NO extra fields!
|
|
292
|
-
if (data.type === "FULL_PAYMENT") {
|
|
293
|
-
if (data.downPayment !== undefined && data.downPayment > 0) {
|
|
294
|
-
ctx.addIssue({
|
|
295
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
296
|
-
message: "Down payment cannot be set for full payment",
|
|
297
|
-
path: ["downPayment"],
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
if (data.installmentAmount !== undefined &&
|
|
301
|
-
data.installmentAmount !== null) {
|
|
302
|
-
ctx.addIssue({
|
|
303
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
304
|
-
message: "Installment amount cannot be set for full payment",
|
|
305
|
-
path: ["installmentAmount"],
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
if (data.installmentFrequency !== undefined &&
|
|
309
|
-
data.installmentFrequency !== null) {
|
|
310
|
-
ctx.addIssue({
|
|
311
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
312
|
-
message: "Installment frequency cannot be set for full payment",
|
|
313
|
-
path: ["installmentFrequency"],
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
if (data.installmentCount !== undefined &&
|
|
317
|
-
data.installmentCount !== null) {
|
|
318
|
-
ctx.addIssue({
|
|
319
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
320
|
-
message: "Installment count cannot be set for full payment",
|
|
321
|
-
path: ["installmentCount"],
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
if (data.gracePeriodDays !== undefined) {
|
|
325
|
-
ctx.addIssue({
|
|
326
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
327
|
-
message: "Grace period days is not applicable for full payment",
|
|
328
|
-
path: ["gracePeriodDays"],
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
if (data.autoLockOnMiss !== undefined) {
|
|
332
|
-
ctx.addIssue({
|
|
333
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
334
|
-
message: "Auto lock on miss is not applicable for full payment",
|
|
335
|
-
path: ["autoLockOnMiss"],
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (!data.type && data.installmentAmount) {
|
|
340
|
-
ctx.addIssue({
|
|
341
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
342
|
-
message: "Cannot add installment fields to existing pricing without changing type to HIRE_PURCHASE",
|
|
343
|
-
path: ["installmentAmount"],
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
}),
|
|
347
|
-
});
|
|
348
|
-
// Get pricing by ID schema
|
|
349
|
-
exports.getPricingSchema = zod_1.z.object({
|
|
350
|
-
params: zod_1.z.object({
|
|
351
|
-
id: zod_1.z.string().uuid("Invalid pricing ID"),
|
|
352
|
-
}),
|
|
353
|
-
});
|
|
354
|
-
// Get all pricings schema
|
|
355
|
-
exports.getPricingsSchema = zod_1.z.object({
|
|
356
|
-
query: zod_1.z.object({
|
|
357
|
-
page: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
|
|
358
|
-
limit: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
|
|
359
|
-
productId: zod_1.z.string().uuid().optional(),
|
|
360
|
-
type: zod_1.z.enum(PRICING_TYPES).optional(),
|
|
361
|
-
isActive: zod_1.z.enum(["true", "false"]).optional(),
|
|
362
|
-
minAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
|
|
363
|
-
maxAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
|
|
364
|
-
search: zod_1.z.string().optional(),
|
|
365
|
-
sortBy: zod_1.z
|
|
366
|
-
.enum(["name", "totalAmount", "createdAt", "updatedAt"])
|
|
367
|
-
.optional(),
|
|
368
|
-
sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
|
|
369
|
-
}),
|
|
370
|
-
});
|
|
371
|
-
// Delete pricing schema
|
|
372
|
-
exports.deletePricingSchema = zod_1.z.object({
|
|
373
|
-
params: zod_1.z.object({
|
|
374
|
-
id: zod_1.z.string().uuid("Invalid pricing ID"),
|
|
375
|
-
}),
|
|
376
|
-
});
|
|
File without changes
|