vr-commons 1.0.138 → 1.0.139

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.
@@ -4,7 +4,7 @@ export declare const createPricingSchema: z.ZodObject<{
4
4
  productId: z.ZodString;
5
5
  name: z.ZodString;
6
6
  type: z.ZodEnum<["HIRE_PURCHASE", "FULL_PAYMENT"]>;
7
- totalAmount: z.ZodNumber;
7
+ unitPrice: z.ZodNumber;
8
8
  downPayment: z.ZodOptional<z.ZodNumber>;
9
9
  installmentAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
10
10
  installmentFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>>>;
@@ -18,7 +18,7 @@ export declare const createPricingSchema: z.ZodObject<{
18
18
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
19
19
  name: string;
20
20
  productId: string;
21
- totalAmount: number;
21
+ unitPrice: number;
22
22
  isActive?: boolean | undefined;
23
23
  downPayment?: number | undefined;
24
24
  installmentAmount?: number | null | undefined;
@@ -32,7 +32,7 @@ export declare const createPricingSchema: z.ZodObject<{
32
32
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
33
33
  name: string;
34
34
  productId: string;
35
- totalAmount: number;
35
+ unitPrice: number;
36
36
  isActive?: boolean | undefined;
37
37
  downPayment?: number | undefined;
38
38
  installmentAmount?: number | null | undefined;
@@ -46,7 +46,7 @@ export declare const createPricingSchema: z.ZodObject<{
46
46
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
47
47
  name: string;
48
48
  productId: string;
49
- totalAmount: number;
49
+ unitPrice: number;
50
50
  isActive?: boolean | undefined;
51
51
  downPayment?: number | undefined;
52
52
  installmentAmount?: number | null | undefined;
@@ -60,7 +60,7 @@ export declare const createPricingSchema: z.ZodObject<{
60
60
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
61
61
  name: string;
62
62
  productId: string;
63
- totalAmount: number;
63
+ unitPrice: number;
64
64
  isActive?: boolean | undefined;
65
65
  downPayment?: number | undefined;
66
66
  installmentAmount?: number | null | undefined;
@@ -76,7 +76,7 @@ export declare const createPricingSchema: z.ZodObject<{
76
76
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
77
77
  name: string;
78
78
  productId: string;
79
- totalAmount: number;
79
+ unitPrice: number;
80
80
  isActive?: boolean | undefined;
81
81
  downPayment?: number | undefined;
82
82
  installmentAmount?: number | null | undefined;
@@ -92,7 +92,7 @@ export declare const createPricingSchema: z.ZodObject<{
92
92
  type: "HIRE_PURCHASE" | "FULL_PAYMENT";
93
93
  name: string;
94
94
  productId: string;
95
- totalAmount: number;
95
+ unitPrice: number;
96
96
  isActive?: boolean | undefined;
97
97
  downPayment?: number | undefined;
98
98
  installmentAmount?: number | null | undefined;
@@ -115,7 +115,7 @@ export declare const updatePricingSchema: z.ZodObject<{
115
115
  body: z.ZodEffects<z.ZodObject<{
116
116
  name: z.ZodOptional<z.ZodString>;
117
117
  type: z.ZodOptional<z.ZodEnum<["HIRE_PURCHASE", "FULL_PAYMENT"]>>;
118
- totalAmount: z.ZodOptional<z.ZodNumber>;
118
+ unitPrice: z.ZodOptional<z.ZodNumber>;
119
119
  downPayment: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
120
120
  installmentAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
121
121
  installmentFrequency: z.ZodOptional<z.ZodNullable<z.ZodEnum<["DAILY", "WEEKLY", "MONTHLY"]>>>;
@@ -129,7 +129,7 @@ export declare const updatePricingSchema: z.ZodObject<{
129
129
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
130
130
  isActive?: boolean | undefined;
131
131
  name?: string | undefined;
132
- totalAmount?: number | undefined;
132
+ unitPrice?: number | undefined;
133
133
  downPayment?: number | undefined;
134
134
  installmentAmount?: number | null | undefined;
135
135
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -142,7 +142,7 @@ export declare const updatePricingSchema: z.ZodObject<{
142
142
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
143
143
  isActive?: boolean | undefined;
144
144
  name?: string | undefined;
145
- totalAmount?: number | undefined;
145
+ unitPrice?: number | undefined;
146
146
  downPayment?: number | undefined;
147
147
  installmentAmount?: number | null | undefined;
148
148
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -155,7 +155,7 @@ export declare const updatePricingSchema: z.ZodObject<{
155
155
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
156
156
  isActive?: boolean | undefined;
157
157
  name?: string | undefined;
158
- totalAmount?: number | undefined;
158
+ unitPrice?: number | undefined;
159
159
  downPayment?: number | undefined;
160
160
  installmentAmount?: number | null | undefined;
161
161
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -168,7 +168,7 @@ export declare const updatePricingSchema: z.ZodObject<{
168
168
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
169
169
  isActive?: boolean | undefined;
170
170
  name?: string | undefined;
171
- totalAmount?: number | undefined;
171
+ unitPrice?: number | undefined;
172
172
  downPayment?: number | undefined;
173
173
  installmentAmount?: number | null | undefined;
174
174
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -179,14 +179,11 @@ export declare const updatePricingSchema: z.ZodObject<{
179
179
  maxOrderQuantity?: number | undefined;
180
180
  }>;
181
181
  }, "strip", z.ZodTypeAny, {
182
- params: {
183
- id: string;
184
- };
185
182
  body: {
186
183
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
187
184
  isActive?: boolean | undefined;
188
185
  name?: string | undefined;
189
- totalAmount?: number | undefined;
186
+ unitPrice?: number | undefined;
190
187
  downPayment?: number | undefined;
191
188
  installmentAmount?: number | null | undefined;
192
189
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -196,15 +193,15 @@ export declare const updatePricingSchema: z.ZodObject<{
196
193
  minOrderQuantity?: number | undefined;
197
194
  maxOrderQuantity?: number | undefined;
198
195
  };
199
- }, {
200
196
  params: {
201
197
  id: string;
202
198
  };
199
+ }, {
203
200
  body: {
204
201
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
205
202
  isActive?: boolean | undefined;
206
203
  name?: string | undefined;
207
- totalAmount?: number | undefined;
204
+ unitPrice?: number | undefined;
208
205
  downPayment?: number | undefined;
209
206
  installmentAmount?: number | null | undefined;
210
207
  installmentFrequency?: "DAILY" | "WEEKLY" | "MONTHLY" | null | undefined;
@@ -214,6 +211,9 @@ export declare const updatePricingSchema: z.ZodObject<{
214
211
  minOrderQuantity?: number | undefined;
215
212
  maxOrderQuantity?: number | undefined;
216
213
  };
214
+ params: {
215
+ id: string;
216
+ };
217
217
  }>;
218
218
  export declare const getPricingSchema: z.ZodObject<{
219
219
  params: z.ZodObject<{
@@ -242,26 +242,26 @@ export declare const getPricingsSchema: z.ZodObject<{
242
242
  minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
243
243
  maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
244
244
  search: z.ZodOptional<z.ZodString>;
245
- sortBy: z.ZodOptional<z.ZodEnum<["name", "totalAmount", "createdAt", "updatedAt"]>>;
245
+ sortBy: z.ZodOptional<z.ZodEnum<["name", "unitPrice", "createdAt", "updatedAt"]>>;
246
246
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
247
247
  }, "strip", z.ZodTypeAny, {
248
+ search?: string | undefined;
248
249
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
249
- page?: number | undefined;
250
250
  limit?: number | undefined;
251
- search?: string | undefined;
252
251
  isActive?: "true" | "false" | undefined;
253
- sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
252
+ page?: number | undefined;
253
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
254
254
  sortOrder?: "DESC" | "ASC" | undefined;
255
255
  productId?: string | undefined;
256
256
  minAmount?: number | undefined;
257
257
  maxAmount?: number | undefined;
258
258
  }, {
259
+ search?: string | undefined;
259
260
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
260
- page?: string | undefined;
261
261
  limit?: string | undefined;
262
- search?: string | undefined;
263
262
  isActive?: "true" | "false" | undefined;
264
- sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
263
+ page?: string | undefined;
264
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
265
265
  sortOrder?: "DESC" | "ASC" | undefined;
266
266
  productId?: string | undefined;
267
267
  minAmount?: string | undefined;
@@ -269,12 +269,12 @@ export declare const getPricingsSchema: z.ZodObject<{
269
269
  }>;
270
270
  }, "strip", z.ZodTypeAny, {
271
271
  query: {
272
+ search?: string | undefined;
272
273
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
273
- page?: number | undefined;
274
274
  limit?: number | undefined;
275
- search?: string | undefined;
276
275
  isActive?: "true" | "false" | undefined;
277
- sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
276
+ page?: number | undefined;
277
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
278
278
  sortOrder?: "DESC" | "ASC" | undefined;
279
279
  productId?: string | undefined;
280
280
  minAmount?: number | undefined;
@@ -282,12 +282,12 @@ export declare const getPricingsSchema: z.ZodObject<{
282
282
  };
283
283
  }, {
284
284
  query: {
285
+ search?: string | undefined;
285
286
  type?: "HIRE_PURCHASE" | "FULL_PAYMENT" | undefined;
286
- page?: string | undefined;
287
287
  limit?: string | undefined;
288
- search?: string | undefined;
289
288
  isActive?: "true" | "false" | undefined;
290
- sortBy?: "createdAt" | "updatedAt" | "name" | "totalAmount" | undefined;
289
+ page?: string | undefined;
290
+ sortBy?: "createdAt" | "updatedAt" | "name" | "unitPrice" | undefined;
291
291
  sortOrder?: "DESC" | "ASC" | undefined;
292
292
  productId?: string | undefined;
293
293
  minAmount?: string | undefined;
@@ -3,24 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = void 0;
4
4
  // src/validations/pricing.validation.ts
5
5
  const zod_1 = require("zod");
6
- // Constants
7
- const PRICING_TYPES = ["HIRE_PURCHASE", "FULL_PAYMENT"];
8
- const INSTALLMENT_FREQUENCIES = ["DAILY", "WEEKLY", "MONTHLY"];
6
+ const vr_models_1 = require("vr-models");
9
7
  // Base pricing schema
10
8
  const pricingBaseSchema = {
11
9
  productId: zod_1.z.string().uuid("Invalid product ID"),
12
10
  name: zod_1.z.string().min(3, "Name must be at least 3 characters").max(100),
13
- type: zod_1.z.enum(PRICING_TYPES, {
11
+ type: zod_1.z.enum(vr_models_1.PRICING_TYPE, {
14
12
  errorMap: () => ({ message: "Type must be HIRE_PURCHASE or FULL_PAYMENT" }),
15
13
  }),
16
- totalAmount: zod_1.z.number().min(0, "Total amount cannot be negative"),
14
+ unitPrice: zod_1.z.number().min(0, "Unit price cannot be negative"), // ✅ Changed from totalAmount
17
15
  downPayment: zod_1.z.number().min(0, "Down payment cannot be negative").optional(),
18
16
  installmentAmount: zod_1.z
19
17
  .number()
20
18
  .min(0, "Installment amount cannot be negative")
21
19
  .nullable()
22
20
  .optional(),
23
- installmentFrequency: zod_1.z.enum(INSTALLMENT_FREQUENCIES).nullable().optional(),
21
+ installmentFrequency: zod_1.z.enum(vr_models_1.INSTALLMENTFREQUENCY).nullable().optional(),
24
22
  installmentCount: zod_1.z
25
23
  .number()
26
24
  .int()
@@ -34,7 +32,6 @@ const pricingBaseSchema = {
34
32
  .max(30, "Grace period too long")
35
33
  .optional(),
36
34
  autoLockOnMiss: zod_1.z.boolean().optional(),
37
- // NEW FIELDS
38
35
  minOrderQuantity: zod_1.z
39
36
  .number()
40
37
  .int()
@@ -54,7 +51,7 @@ exports.createPricingSchema = zod_1.z.object({
54
51
  productId: pricingBaseSchema.productId,
55
52
  name: pricingBaseSchema.name,
56
53
  type: pricingBaseSchema.type,
57
- totalAmount: pricingBaseSchema.totalAmount,
54
+ unitPrice: pricingBaseSchema.unitPrice, // ✅ Changed
58
55
  downPayment: pricingBaseSchema.downPayment,
59
56
  installmentAmount: pricingBaseSchema.installmentAmount,
60
57
  installmentFrequency: pricingBaseSchema.installmentFrequency,
@@ -78,7 +75,6 @@ exports.createPricingSchema = zod_1.z.object({
78
75
  }
79
76
  // HIRE_PURCHASE validation
80
77
  if (data.type === "HIRE_PURCHASE") {
81
- // Must have downPayment (can be 0, but must be present)
82
78
  if (data.downPayment === undefined) {
83
79
  ctx.addIssue({
84
80
  code: zod_1.z.ZodIssueCode.custom,
@@ -86,7 +82,6 @@ exports.createPricingSchema = zod_1.z.object({
86
82
  path: ["downPayment"],
87
83
  });
88
84
  }
89
- // Must have installmentAmount
90
85
  if (!data.installmentAmount || data.installmentAmount <= 0) {
91
86
  ctx.addIssue({
92
87
  code: zod_1.z.ZodIssueCode.custom,
@@ -94,7 +89,6 @@ exports.createPricingSchema = zod_1.z.object({
94
89
  path: ["installmentAmount"],
95
90
  });
96
91
  }
97
- // Must have installmentFrequency
98
92
  if (!data.installmentFrequency) {
99
93
  ctx.addIssue({
100
94
  code: zod_1.z.ZodIssueCode.custom,
@@ -102,7 +96,6 @@ exports.createPricingSchema = zod_1.z.object({
102
96
  path: ["installmentFrequency"],
103
97
  });
104
98
  }
105
- // Must have installmentCount
106
99
  if (!data.installmentCount || data.installmentCount <= 0) {
107
100
  ctx.addIssue({
108
101
  code: zod_1.z.ZodIssueCode.custom,
@@ -110,7 +103,6 @@ exports.createPricingSchema = zod_1.z.object({
110
103
  path: ["installmentCount"],
111
104
  });
112
105
  }
113
- // Grace period days is required for hire purchase
114
106
  if (data.gracePeriodDays === undefined) {
115
107
  ctx.addIssue({
116
108
  code: zod_1.z.ZodIssueCode.custom,
@@ -118,7 +110,6 @@ exports.createPricingSchema = zod_1.z.object({
118
110
  path: ["gracePeriodDays"],
119
111
  });
120
112
  }
121
- // Auto lock on miss is required for hire purchase
122
113
  if (data.autoLockOnMiss === undefined) {
123
114
  ctx.addIssue({
124
115
  code: zod_1.z.ZodIssueCode.custom,
@@ -126,38 +117,35 @@ exports.createPricingSchema = zod_1.z.object({
126
117
  path: ["autoLockOnMiss"],
127
118
  });
128
119
  }
129
- // Validate math: totalAmount = downPayment + (installmentAmount × installmentCount)
120
+ // ✅ Updated: unitPrice = downPayment + (installmentAmount × installmentCount)
130
121
  if (data.installmentAmount && data.installmentCount) {
131
- const calculatedTotal = (data.downPayment || 0) +
122
+ const calculatedUnitPrice = (data.downPayment || 0) +
132
123
  data.installmentAmount * data.installmentCount;
133
- if (Math.abs(calculatedTotal - data.totalAmount) > 0.01) {
124
+ if (Math.abs(calculatedUnitPrice - data.unitPrice) > 0.01) {
134
125
  ctx.addIssue({
135
126
  code: zod_1.z.ZodIssueCode.custom,
136
- message: `Total amount must equal downPayment + (installmentAmount × installmentCount). Expected ~${calculatedTotal.toFixed(2)}`,
137
- path: ["totalAmount"],
127
+ message: `Unit price must equal downPayment + (installmentAmount × installmentCount). Expected ~${calculatedUnitPrice.toFixed(2)}`,
128
+ path: ["unitPrice"],
138
129
  });
139
130
  }
140
131
  }
141
- // Down payment must be less than total amount
142
- if (data.downPayment && data.downPayment >= data.totalAmount) {
132
+ if (data.downPayment && data.downPayment >= data.unitPrice) {
143
133
  ctx.addIssue({
144
134
  code: zod_1.z.ZodIssueCode.custom,
145
- message: "Down payment must be less than total amount",
135
+ message: "Down payment must be less than unit price",
146
136
  path: ["downPayment"],
147
137
  });
148
138
  }
149
139
  }
150
- // FULL_PAYMENT validation - STRICT: ONLY totalAmount allowed!
140
+ // FULL_PAYMENT validation
151
141
  if (data.type === "FULL_PAYMENT") {
152
- // NO down payment allowed
153
142
  if (data.downPayment !== undefined && data.downPayment > 0) {
154
143
  ctx.addIssue({
155
144
  code: zod_1.z.ZodIssueCode.custom,
156
- message: "Down payment cannot be set for full payment. Use totalAmount only.",
145
+ message: "Down payment cannot be set for full payment. Use unitPrice only.",
157
146
  path: ["downPayment"],
158
147
  });
159
148
  }
160
- // NO installment amount allowed
161
149
  if (data.installmentAmount !== undefined &&
162
150
  data.installmentAmount !== null) {
163
151
  ctx.addIssue({
@@ -166,7 +154,6 @@ exports.createPricingSchema = zod_1.z.object({
166
154
  path: ["installmentAmount"],
167
155
  });
168
156
  }
169
- // NO installment frequency allowed
170
157
  if (data.installmentFrequency !== undefined &&
171
158
  data.installmentFrequency !== null) {
172
159
  ctx.addIssue({
@@ -175,7 +162,6 @@ exports.createPricingSchema = zod_1.z.object({
175
162
  path: ["installmentFrequency"],
176
163
  });
177
164
  }
178
- // NO installment count allowed
179
165
  if (data.installmentCount !== undefined &&
180
166
  data.installmentCount !== null) {
181
167
  ctx.addIssue({
@@ -184,7 +170,6 @@ exports.createPricingSchema = zod_1.z.object({
184
170
  path: ["installmentCount"],
185
171
  });
186
172
  }
187
- // NO grace period days needed for full payment
188
173
  if (data.gracePeriodDays !== undefined) {
189
174
  ctx.addIssue({
190
175
  code: zod_1.z.ZodIssueCode.custom,
@@ -192,7 +177,6 @@ exports.createPricingSchema = zod_1.z.object({
192
177
  path: ["gracePeriodDays"],
193
178
  });
194
179
  }
195
- // NO auto lock on miss needed for full payment
196
180
  if (data.autoLockOnMiss !== undefined) {
197
181
  ctx.addIssue({
198
182
  code: zod_1.z.ZodIssueCode.custom,
@@ -200,12 +184,11 @@ exports.createPricingSchema = zod_1.z.object({
200
184
  path: ["autoLockOnMiss"],
201
185
  });
202
186
  }
203
- // Total amount is required and must be positive
204
- if (!data.totalAmount || data.totalAmount <= 0) {
187
+ if (!data.unitPrice || data.unitPrice <= 0) {
205
188
  ctx.addIssue({
206
189
  code: zod_1.z.ZodIssueCode.custom,
207
- message: "Total amount is required and must be > 0 for full payment",
208
- path: ["totalAmount"],
190
+ message: "Unit price is required and must be > 0 for full payment",
191
+ path: ["unitPrice"],
209
192
  });
210
193
  }
211
194
  }
@@ -220,7 +203,7 @@ exports.updatePricingSchema = zod_1.z.object({
220
203
  .object({
221
204
  name: pricingBaseSchema.name.optional(),
222
205
  type: pricingBaseSchema.type.optional(),
223
- totalAmount: pricingBaseSchema.totalAmount.optional(),
206
+ unitPrice: pricingBaseSchema.unitPrice.optional(), // ✅ Changed
224
207
  downPayment: pricingBaseSchema.downPayment.optional(),
225
208
  installmentAmount: pricingBaseSchema.installmentAmount,
226
209
  installmentFrequency: pricingBaseSchema.installmentFrequency,
@@ -232,7 +215,6 @@ exports.updatePricingSchema = zod_1.z.object({
232
215
  isActive: pricingBaseSchema.isActive.optional(),
233
216
  })
234
217
  .superRefine((data, ctx) => {
235
- // Validate minOrderQuantity <= maxOrderQuantity if both are provided
236
218
  if (data.minOrderQuantity !== undefined &&
237
219
  data.maxOrderQuantity !== undefined) {
238
220
  if (data.minOrderQuantity > data.maxOrderQuantity) {
@@ -243,7 +225,6 @@ exports.updatePricingSchema = zod_1.z.object({
243
225
  });
244
226
  }
245
227
  }
246
- // If type is being updated to HIRE_PURCHASE
247
228
  if (data.type === "HIRE_PURCHASE") {
248
229
  if (data.downPayment === undefined) {
249
230
  ctx.addIssue({
@@ -288,7 +269,6 @@ exports.updatePricingSchema = zod_1.z.object({
288
269
  });
289
270
  }
290
271
  }
291
- // If type is being updated to FULL_PAYMENT - STRICT: NO extra fields!
292
272
  if (data.type === "FULL_PAYMENT") {
293
273
  if (data.downPayment !== undefined && data.downPayment > 0) {
294
274
  ctx.addIssue({
@@ -357,13 +337,13 @@ exports.getPricingsSchema = zod_1.z.object({
357
337
  page: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
358
338
  limit: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
359
339
  productId: zod_1.z.string().uuid().optional(),
360
- type: zod_1.z.enum(PRICING_TYPES).optional(),
340
+ type: zod_1.z.enum(vr_models_1.PRICING_TYPE).optional(),
361
341
  isActive: zod_1.z.enum(["true", "false"]).optional(),
362
342
  minAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
363
343
  maxAmount: zod_1.z.string().regex(/^\d+$/).transform(Number).optional(),
364
344
  search: zod_1.z.string().optional(),
365
345
  sortBy: zod_1.z
366
- .enum(["name", "totalAmount", "createdAt", "updatedAt"])
346
+ .enum(["name", "unitPrice", "createdAt", "updatedAt"]) // ✅ Changed from totalAmount
367
347
  .optional(),
368
348
  sortOrder: zod_1.z.enum(["ASC", "DESC"]).optional(),
369
349
  }),
@@ -51,25 +51,25 @@ export declare const updateProductSchema: z.ZodObject<{
51
51
  stock?: unknown;
52
52
  }>;
53
53
  }, "strip", z.ZodTypeAny, {
54
- params: {
55
- id: string;
56
- };
57
54
  body: {
58
55
  isActive?: boolean | undefined;
59
56
  description?: string | null | undefined;
60
57
  name?: string | undefined;
61
58
  stock?: number | undefined;
62
59
  };
63
- }, {
64
60
  params: {
65
61
  id: string;
66
62
  };
63
+ }, {
67
64
  body: {
68
65
  isActive?: unknown;
69
66
  description?: unknown;
70
67
  name?: unknown;
71
68
  stock?: unknown;
72
69
  };
70
+ params: {
71
+ id: string;
72
+ };
73
73
  }>;
74
74
  export declare const getProductSchema: z.ZodObject<{
75
75
  params: z.ZodObject<{
@@ -98,38 +98,38 @@ export declare const getProductsSchema: z.ZodObject<{
98
98
  sortBy: z.ZodOptional<z.ZodEnum<["name", "stock", "createdAt", "updatedAt"]>>;
99
99
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
100
100
  }, "strip", z.ZodTypeAny, {
101
- page?: number | undefined;
102
- limit?: number | undefined;
103
101
  search?: string | undefined;
102
+ limit?: number | undefined;
104
103
  isActive?: "true" | "false" | undefined;
104
+ page?: number | undefined;
105
105
  sortBy?: "createdAt" | "updatedAt" | "name" | "stock" | undefined;
106
106
  sortOrder?: "DESC" | "ASC" | undefined;
107
107
  minStock?: number | undefined;
108
108
  }, {
109
- page?: string | undefined;
110
- limit?: string | undefined;
111
109
  search?: string | undefined;
110
+ limit?: string | undefined;
112
111
  isActive?: "true" | "false" | undefined;
112
+ page?: string | undefined;
113
113
  sortBy?: "createdAt" | "updatedAt" | "name" | "stock" | undefined;
114
114
  sortOrder?: "DESC" | "ASC" | undefined;
115
115
  minStock?: string | undefined;
116
116
  }>;
117
117
  }, "strip", z.ZodTypeAny, {
118
118
  query: {
119
- page?: number | undefined;
120
- limit?: number | undefined;
121
119
  search?: string | undefined;
120
+ limit?: number | undefined;
122
121
  isActive?: "true" | "false" | undefined;
122
+ page?: number | undefined;
123
123
  sortBy?: "createdAt" | "updatedAt" | "name" | "stock" | undefined;
124
124
  sortOrder?: "DESC" | "ASC" | undefined;
125
125
  minStock?: number | undefined;
126
126
  };
127
127
  }, {
128
128
  query: {
129
- page?: string | undefined;
130
- limit?: string | undefined;
131
129
  search?: string | undefined;
130
+ limit?: string | undefined;
132
131
  isActive?: "true" | "false" | undefined;
132
+ page?: string | undefined;
133
133
  sortBy?: "createdAt" | "updatedAt" | "name" | "stock" | undefined;
134
134
  sortOrder?: "DESC" | "ASC" | undefined;
135
135
  minStock?: string | undefined;
@@ -199,25 +199,25 @@ export declare const updateStockSchema: z.ZodObject<{
199
199
  amount: z.ZodNumber;
200
200
  }, "strip", z.ZodTypeAny, {
201
201
  amount: number;
202
- operation: "set" | "increment" | "decrement";
202
+ operation: "increment" | "decrement" | "set";
203
203
  }, {
204
204
  amount: number;
205
- operation: "set" | "increment" | "decrement";
205
+ operation: "increment" | "decrement" | "set";
206
206
  }>;
207
207
  }, "strip", z.ZodTypeAny, {
208
- params: {
209
- id: string;
210
- };
211
208
  body: {
212
209
  amount: number;
213
- operation: "set" | "increment" | "decrement";
210
+ operation: "increment" | "decrement" | "set";
214
211
  };
215
- }, {
216
212
  params: {
217
213
  id: string;
218
214
  };
215
+ }, {
219
216
  body: {
220
217
  amount: number;
221
- operation: "set" | "increment" | "decrement";
218
+ operation: "increment" | "decrement" | "set";
219
+ };
220
+ params: {
221
+ id: string;
222
222
  };
223
223
  }>;