@servemate/dto 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,316 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Defines the options for sorting tables in the system.
4
+ *
5
+ */
6
+ export declare const TableSortOptionsEnum: {
7
+ readonly ID: "id";
8
+ readonly TABLE_NUMBER: "tableNumber";
9
+ readonly CAPACITY: "capacity";
10
+ readonly STATUS: "status";
11
+ readonly SERVER_ID: "serverId";
12
+ readonly ORDER_TIME: "orderTime";
13
+ readonly IS_OCCUPIED: "isOccupied";
14
+ };
15
+ export type TableSortOptions = (typeof TableSortOptionsEnum)[keyof typeof TableSortOptionsEnum];
16
+ /**
17
+ * Table-related schemas
18
+ */
19
+ export declare const BaseTableSchema: z.ZodObject<{
20
+ id: z.ZodNumber;
21
+ tableNumber: z.ZodNumber;
22
+ capacity: z.ZodNumber;
23
+ additionalCapacity: z.ZodNumber;
24
+ isOccupied: z.ZodBoolean;
25
+ status: z.ZodNativeEnum<{
26
+ AVAILABLE: "AVAILABLE";
27
+ OCCUPIED: "OCCUPIED";
28
+ RESERVED: "RESERVED";
29
+ ORDERING: "ORDERING";
30
+ SERVING: "SERVING";
31
+ PAYMENT: "PAYMENT";
32
+ }>;
33
+ guests: z.ZodNumber;
34
+ originalCapacity: z.ZodNumber;
35
+ }, "strip", z.ZodTypeAny, {
36
+ status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
37
+ id: number;
38
+ tableNumber: number;
39
+ capacity: number;
40
+ isOccupied: boolean;
41
+ additionalCapacity: number;
42
+ guests: number;
43
+ originalCapacity: number;
44
+ }, {
45
+ status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
46
+ id: number;
47
+ tableNumber: number;
48
+ capacity: number;
49
+ isOccupied: boolean;
50
+ additionalCapacity: number;
51
+ guests: number;
52
+ originalCapacity: number;
53
+ }>;
54
+ export declare const TableAssignmentSchema: z.ZodObject<{
55
+ serverId: z.ZodNumber;
56
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
57
+ assignedTables: z.ZodArray<z.ZodNumber, "many">;
58
+ }, "strip", z.ZodTypeAny, {
59
+ serverId: number;
60
+ isPrimary: boolean;
61
+ assignedTables: number[];
62
+ }, {
63
+ serverId: number;
64
+ assignedTables: number[];
65
+ isPrimary?: boolean | undefined;
66
+ }>;
67
+ export declare const TableSchema: z.ZodObject<z.objectUtil.extendShape<{
68
+ id: z.ZodNumber;
69
+ tableNumber: z.ZodNumber;
70
+ capacity: z.ZodNumber;
71
+ additionalCapacity: z.ZodNumber;
72
+ isOccupied: z.ZodBoolean;
73
+ status: z.ZodNativeEnum<{
74
+ AVAILABLE: "AVAILABLE";
75
+ OCCUPIED: "OCCUPIED";
76
+ RESERVED: "RESERVED";
77
+ ORDERING: "ORDERING";
78
+ SERVING: "SERVING";
79
+ PAYMENT: "PAYMENT";
80
+ }>;
81
+ guests: z.ZodNumber;
82
+ originalCapacity: z.ZodNumber;
83
+ }, {
84
+ orders: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
85
+ id: z.ZodNumber;
86
+ tableNumber: z.ZodNumber;
87
+ orderNumber: z.ZodNumber;
88
+ guestsCount: z.ZodNumber;
89
+ orderTime: z.ZodDate;
90
+ updatedAt: z.ZodDate;
91
+ allergies: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
92
+ readonly NONE: "NONE";
93
+ readonly GLUTEN: "GLUTEN";
94
+ readonly DAIRY: "DAIRY";
95
+ readonly EGG: "EGG";
96
+ readonly PEANUT: "PEANUT";
97
+ readonly TREENUT: "TREENUT";
98
+ readonly FISH: "FISH";
99
+ readonly SHELLFISH: "SHELLFISH";
100
+ readonly SOY: "SOY";
101
+ readonly SESAME: "SESAME";
102
+ readonly CELERY: "CELERY";
103
+ readonly MUSTARD: "MUSTARD";
104
+ readonly LUPIN: "LUPIN";
105
+ readonly SULPHITES: "SULPHITES";
106
+ readonly MOLLUSCS: "MOLLUSCS";
107
+ }>, "many">>;
108
+ serverId: z.ZodNumber;
109
+ totalAmount: z.ZodDefault<z.ZodNumber>;
110
+ status: z.ZodDefault<z.ZodNativeEnum<{
111
+ readonly AWAITING: "AWAITING";
112
+ readonly RECEIVED: "RECEIVED";
113
+ readonly SERVED: "SERVED";
114
+ readonly CANCELED: "CANCELED";
115
+ readonly DISPUTED: "DISPUTED";
116
+ readonly READY_TO_PAY: "READY_TO_PAY";
117
+ readonly COMPLETED: "COMPLETED";
118
+ }>>;
119
+ comments: z.ZodNullable<z.ZodOptional<z.ZodString>>;
120
+ completionTime: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
121
+ discount: z.ZodDefault<z.ZodNumber>;
122
+ tip: z.ZodDefault<z.ZodNumber>;
123
+ shiftId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
124
+ }, "status" | "id" | "orderTime">, "strip", z.ZodTypeAny, {
125
+ status: "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | "COMPLETED";
126
+ id: number;
127
+ orderTime: Date;
128
+ }, {
129
+ id: number;
130
+ orderTime: Date;
131
+ status?: "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | "COMPLETED" | undefined;
132
+ }>, "many">>;
133
+ assignment: z.ZodOptional<z.ZodArray<z.ZodObject<Pick<{
134
+ serverId: z.ZodNumber;
135
+ isPrimary: z.ZodDefault<z.ZodBoolean>;
136
+ assignedTables: z.ZodArray<z.ZodNumber, "many">;
137
+ }, "serverId" | "isPrimary">, "strip", z.ZodTypeAny, {
138
+ serverId: number;
139
+ isPrimary: boolean;
140
+ }, {
141
+ serverId: number;
142
+ isPrimary?: boolean | undefined;
143
+ }>, "many">>;
144
+ }>, "strip", z.ZodTypeAny, {
145
+ status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
146
+ id: number;
147
+ tableNumber: number;
148
+ capacity: number;
149
+ isOccupied: boolean;
150
+ additionalCapacity: number;
151
+ guests: number;
152
+ originalCapacity: number;
153
+ orders?: {
154
+ status: "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | "COMPLETED";
155
+ id: number;
156
+ orderTime: Date;
157
+ }[] | undefined;
158
+ assignment?: {
159
+ serverId: number;
160
+ isPrimary: boolean;
161
+ }[] | undefined;
162
+ }, {
163
+ status: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT";
164
+ id: number;
165
+ tableNumber: number;
166
+ capacity: number;
167
+ isOccupied: boolean;
168
+ additionalCapacity: number;
169
+ guests: number;
170
+ originalCapacity: number;
171
+ orders?: {
172
+ id: number;
173
+ orderTime: Date;
174
+ status?: "AWAITING" | "RECEIVED" | "SERVED" | "CANCELED" | "DISPUTED" | "READY_TO_PAY" | "COMPLETED" | undefined;
175
+ }[] | undefined;
176
+ assignment?: {
177
+ serverId: number;
178
+ isPrimary?: boolean | undefined;
179
+ }[] | undefined;
180
+ }>;
181
+ export declare const TableSearchCriteriaSchema: z.ZodObject<{
182
+ id: z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>;
183
+ tableNumber: z.ZodOptional<z.ZodNumber>;
184
+ minCapacity: z.ZodOptional<z.ZodNumber>;
185
+ maxCapacity: z.ZodOptional<z.ZodNumber>;
186
+ isOccupied: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "true" | "false" | undefined>;
187
+ status: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodNativeEnum<{
188
+ AVAILABLE: "AVAILABLE";
189
+ OCCUPIED: "OCCUPIED";
190
+ RESERVED: "RESERVED";
191
+ ORDERING: "ORDERING";
192
+ SERVING: "SERVING";
193
+ PAYMENT: "PAYMENT";
194
+ }>>>;
195
+ serverId: z.ZodOptional<z.ZodNumber>;
196
+ page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
197
+ pageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
198
+ sortBy: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, TableSortOptions, string | undefined>;
199
+ sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ page: number;
202
+ pageSize: number;
203
+ sortOrder: "asc" | "desc";
204
+ sortBy: TableSortOptions;
205
+ status?: "AVAILABLE" | "OCCUPIED" | "RESERVED" | "ORDERING" | "SERVING" | "PAYMENT" | undefined;
206
+ id?: number | undefined;
207
+ tableNumber?: number | undefined;
208
+ serverId?: number | undefined;
209
+ isOccupied?: boolean | undefined;
210
+ minCapacity?: number | undefined;
211
+ maxCapacity?: number | undefined;
212
+ }, {
213
+ status?: string | undefined;
214
+ page?: number | undefined;
215
+ pageSize?: number | undefined;
216
+ sortOrder?: "asc" | "desc" | undefined;
217
+ id?: string | undefined;
218
+ sortBy?: string | undefined;
219
+ tableNumber?: number | undefined;
220
+ serverId?: number | undefined;
221
+ isOccupied?: "true" | "false" | undefined;
222
+ minCapacity?: number | undefined;
223
+ maxCapacity?: number | undefined;
224
+ }>;
225
+ export declare const TableCreateSchema: z.ZodObject<{
226
+ tableNumber: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, number, string>]>, number, string | number>, number, string | number>;
227
+ capacity: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, number, string>]>, number, string | number>, number, string | number>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ tableNumber: number;
230
+ capacity: number;
231
+ }, {
232
+ tableNumber: string | number;
233
+ capacity: string | number;
234
+ }>;
235
+ export declare const TableUpdatesSchema: z.ZodObject<{
236
+ tableNumber: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>>;
237
+ capacity: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>>;
238
+ }, "strip", z.ZodTypeAny, {
239
+ tableNumber?: number | undefined;
240
+ capacity?: number | undefined;
241
+ }, {
242
+ tableNumber?: string | number | undefined;
243
+ capacity?: string | number | undefined;
244
+ }>;
245
+ export declare const TableIdSchema: z.ZodObject<{
246
+ id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, string, string>]>, number, string | number>, number, string | number>, number, string | number>;
247
+ }, "strip", z.ZodTypeAny, {
248
+ id: number;
249
+ }, {
250
+ id: string | number;
251
+ }>;
252
+ /**
253
+ * Table-related types
254
+ */
255
+ export type TablesDTO = z.infer<typeof TableSchema>;
256
+ /**
257
+ * Represents a table assignment in the restaurant management system.
258
+ * This type is inferred from the TableAssignmentSchema and includes details about
259
+ * the assignment of a server to a specific table.
260
+ */
261
+ export type TableAssignment = z.infer<typeof TableAssignmentSchema>;
262
+ /**
263
+ * Represents the structure for creating a new table in the restaurant management system.
264
+ *
265
+ * @property {number} tableNumber - The number assigned to the table. Must be a positive integer.
266
+ * @property {number} capacity - The seating capacity of the table. Must be a positive integer.
267
+ */
268
+ export type TableCreate = z.infer<typeof TableCreateSchema>;
269
+ /**
270
+ * Represents the search criteria for tables in the system.
271
+ *
272
+ * @property {number} [id] - The unique identifier of the table.
273
+ * @property {number} [tableNumber] - The number assigned to the table.
274
+ * @property {number} [minCapacity] - The minimum seating capacity of the table.
275
+ * @property {number} [maxCapacity] - The maximum seating capacity of the table.
276
+ * @property {boolean} [isOccupied] - Whether the table is currently occupied.
277
+ * @property {TableCondition} [status] - The current status of the table.
278
+ * @property {number} [serverId] - The ID of the server assigned to the table.
279
+ * @property {number} [page=1] - The page number for pagination (default: 1).
280
+ * @property {number} [pageSize=10] - The number of items per page (default: 10).
281
+ * @property {TableSortOptions} [sortBy] - The field to sort the results by.
282
+ * @property {'asc' | 'desc'} [sortOrder='asc'] - The order of sorting (default: 'asc').
283
+ */
284
+ export type TableSearchCriteria = z.infer<typeof TableSearchCriteriaSchema> & {
285
+ page: number;
286
+ pageSize: number;
287
+ sortBy: TableSortOptions;
288
+ sortOrder: 'asc' | 'desc';
289
+ };
290
+ /**
291
+ * Represents a table list item derived from the TablesDTO type, excluding the 'originalCapacity' property.
292
+ *
293
+ * @typedef {Omit<TablesDTO, 'originalCapacity'>} TableListItem
294
+ */
295
+ export type TableListItem = Omit<TablesDTO, 'originalCapacity'>;
296
+ export type TablesList = {
297
+ tables: TableListItem[];
298
+ totalCount: number;
299
+ page: number;
300
+ pageSize: number;
301
+ totalPages: number;
302
+ };
303
+ /**
304
+ * Represents the structure for updating an existing table.
305
+ *
306
+ * @property {number} [tableNumber] - The new number to assign to the table. Must be a positive integer.
307
+ * @property {number} [capacity] - The new seating capacity for the table. Must be a positive integer.
308
+ */
309
+ export type TableUpdate = z.infer<typeof TableUpdatesSchema>;
310
+ /**
311
+ * Represents the structure for identifying a specific table.
312
+ *
313
+ * @property {number} id - The unique identifier of the table. Must be a positive integer.
314
+ */
315
+ export type TableId = z.infer<typeof TableIdSchema>;
316
+ //# sourceMappingURL=tables.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.dto.d.ts","sourceRoot":"","sources":["../../src/dto/tables.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;CAQvB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,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B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableIdSchema = exports.TableUpdatesSchema = exports.TableCreateSchema = exports.TableSearchCriteriaSchema = exports.TableSchema = exports.TableAssignmentSchema = exports.BaseTableSchema = exports.TableSortOptionsEnum = void 0;
4
+ const client_1 = require("@prisma/client");
5
+ const zod_1 = require("zod");
6
+ const orders_dto_1 = require("./orders.dto");
7
+ /**
8
+ * Defines the options for sorting tables in the system.
9
+ *
10
+ */
11
+ exports.TableSortOptionsEnum = {
12
+ ID: 'id',
13
+ TABLE_NUMBER: 'tableNumber',
14
+ CAPACITY: 'capacity',
15
+ STATUS: 'status',
16
+ SERVER_ID: 'serverId',
17
+ ORDER_TIME: 'orderTime',
18
+ IS_OCCUPIED: 'isOccupied',
19
+ };
20
+ /**
21
+ * Table-related schemas
22
+ */
23
+ exports.BaseTableSchema = zod_1.z.object({
24
+ id: zod_1.z.number(),
25
+ tableNumber: zod_1.z.number(),
26
+ capacity: zod_1.z.number(),
27
+ additionalCapacity: zod_1.z.number(),
28
+ isOccupied: zod_1.z.boolean(),
29
+ status: zod_1.z.nativeEnum(client_1.TableCondition),
30
+ guests: zod_1.z.number(),
31
+ originalCapacity: zod_1.z.number(),
32
+ });
33
+ exports.TableAssignmentSchema = zod_1.z.object({
34
+ serverId: zod_1.z.coerce.number(),
35
+ isPrimary: zod_1.z.boolean().default(true),
36
+ assignedTables: zod_1.z.array(zod_1.z.coerce.number()),
37
+ });
38
+ exports.TableSchema = exports.BaseTableSchema.extend({
39
+ orders: zod_1.z
40
+ .array(orders_dto_1.OrderSchema.pick({
41
+ id: true,
42
+ orderTime: true,
43
+ status: true,
44
+ }))
45
+ .optional(),
46
+ assignment: zod_1.z
47
+ .array(exports.TableAssignmentSchema.pick({
48
+ serverId: true,
49
+ isPrimary: true,
50
+ }))
51
+ .optional(),
52
+ });
53
+ exports.TableSearchCriteriaSchema = zod_1.z.object({
54
+ id: zod_1.z
55
+ .string()
56
+ .optional()
57
+ .transform((id) => (id ? parseInt(id) : undefined)),
58
+ tableNumber: zod_1.z.coerce.number().int().positive().optional(),
59
+ minCapacity: zod_1.z.coerce.number().int().positive().optional(),
60
+ maxCapacity: zod_1.z.coerce.number().int().positive().optional(),
61
+ isOccupied: zod_1.z
62
+ .enum(['true', 'false'])
63
+ .optional()
64
+ .transform((val) => {
65
+ if (val === 'true')
66
+ return true;
67
+ if (val === 'false')
68
+ return false;
69
+ return undefined;
70
+ }),
71
+ status: zod_1.z
72
+ .string()
73
+ .transform((status) => status === null || status === void 0 ? void 0 : status.toUpperCase())
74
+ .pipe(zod_1.z.nativeEnum(client_1.TableCondition))
75
+ .optional(),
76
+ serverId: zod_1.z.coerce.number().int().positive().optional(),
77
+ page: zod_1.z.coerce.number().int().positive().optional().default(1),
78
+ pageSize: zod_1.z.coerce.number().int().positive().max(100).optional().default(10),
79
+ sortBy: zod_1.z
80
+ .string()
81
+ .optional()
82
+ .default(exports.TableSortOptionsEnum.ID)
83
+ .refine((val) => Object.values(exports.TableSortOptionsEnum).includes(val), {
84
+ message: `Invalid sort option. Must be one of: ${Object.values(exports.TableSortOptionsEnum).join(', ')}`,
85
+ }),
86
+ sortOrder: zod_1.z.enum(['asc', 'desc']).optional().default('asc'),
87
+ });
88
+ exports.TableCreateSchema = zod_1.z.object({
89
+ tableNumber: zod_1.z
90
+ .union([
91
+ zod_1.z.number(),
92
+ zod_1.z
93
+ .string()
94
+ .refine((tableNumber) => !isNaN(Number(tableNumber)), {
95
+ message: 'Table number must be a valid number',
96
+ })
97
+ .transform(Number),
98
+ ])
99
+ .refine((tableNumber) => tableNumber > 0, {
100
+ message: 'Table number must be a positive number',
101
+ })
102
+ .refine((tableNumber) => Number.isInteger(tableNumber), {
103
+ message: 'Table number must be an integer',
104
+ }),
105
+ capacity: zod_1.z
106
+ .union([
107
+ zod_1.z.number(),
108
+ zod_1.z
109
+ .string()
110
+ .refine((capacity) => !isNaN(Number(capacity)), {
111
+ message: 'Capacity must be a valid number',
112
+ })
113
+ .transform(Number),
114
+ ])
115
+ .refine((capacity) => capacity > 0, { message: 'Capacity must be a positive number' })
116
+ .refine((capacity) => Number.isInteger(capacity), {
117
+ message: 'Capacity number must be an integer',
118
+ }),
119
+ });
120
+ exports.TableUpdatesSchema = zod_1.z.object({
121
+ tableNumber: zod_1.z
122
+ .union([
123
+ zod_1.z.number(),
124
+ zod_1.z.string().refine((val) => !isNaN(Number(val)), {
125
+ message: 'Table number must be a valid number',
126
+ }),
127
+ ])
128
+ .transform((val) => Number(val))
129
+ .refine((val) => val > 0, {
130
+ message: 'Table number must be a positive number',
131
+ })
132
+ .refine((val) => Number.isInteger(val), {
133
+ message: 'Table number must be an integer',
134
+ })
135
+ .optional(),
136
+ capacity: zod_1.z
137
+ .union([
138
+ zod_1.z.number(),
139
+ zod_1.z.string().refine((val) => !isNaN(Number(val)), {
140
+ message: 'Capacity must be a valid number',
141
+ }),
142
+ ])
143
+ .transform((val) => Number(val))
144
+ .refine((val) => val > 0, {
145
+ message: 'Capacity must be a positive number',
146
+ })
147
+ .refine((val) => Number.isInteger(val), {
148
+ message: 'Capacity must be an integer',
149
+ })
150
+ .optional(),
151
+ });
152
+ exports.TableIdSchema = zod_1.z.object({
153
+ id: zod_1.z
154
+ .union([
155
+ zod_1.z.number(),
156
+ zod_1.z.string().refine((id) => !isNaN(Number(id)), {
157
+ message: 'Table ID must be a valid number',
158
+ }),
159
+ ])
160
+ .transform((id) => Number(id))
161
+ .refine((id) => id > 0, {
162
+ message: 'Table ID must be a positive number',
163
+ })
164
+ .refine((id) => Number.isInteger(id), {
165
+ message: 'Table ID must be an integer',
166
+ }),
167
+ });
168
+ // ...existing code...
169
+ //# sourceMappingURL=tables.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.dto.js","sourceRoot":"","sources":["../../src/dto/tables.dto.ts"],"names":[],"mappings":";;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,6CAA2C;AAE3C;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IACnC,EAAE,EAAE,IAAI;IACR,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,YAAY;CAChB,CAAC;AAIX;;GAEG;AACU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC9B,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE;IACvB,MAAM,EAAE,OAAC,CAAC,UAAU,CAAC,uBAAc,CAAC;IACpC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;CAC5B,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE;IAC3B,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,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