@voyantjs/resources 0.1.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.
- package/LICENSE +109 -0
- package/README.md +34 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/routes.d.ts +1214 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +330 -0
- package/dist/schema.d.ts +1149 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +164 -0
- package/dist/service.d.ts +372 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +287 -0
- package/dist/validation.d.ts +335 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +111 -0
- package/package.json +51 -0
package/dist/service.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { and, desc, eq, sql } from "drizzle-orm";
|
|
2
|
+
import { resourceCloseouts, resourcePoolMembers, resourcePools, resourceRequirements, resourceSlotAssignments, resources, } from "./schema.js";
|
|
3
|
+
async function paginate(rowsQuery, countQuery, limit, offset) {
|
|
4
|
+
const [data, countResult] = await Promise.all([rowsQuery, countQuery]);
|
|
5
|
+
return { data, total: countResult[0]?.count ?? 0, limit, offset };
|
|
6
|
+
}
|
|
7
|
+
function toDateOrNull(value) {
|
|
8
|
+
return value ? new Date(value) : null;
|
|
9
|
+
}
|
|
10
|
+
export const resourcesService = {
|
|
11
|
+
async listResources(db, query) {
|
|
12
|
+
const conditions = [];
|
|
13
|
+
if (query.supplierId)
|
|
14
|
+
conditions.push(eq(resources.supplierId, query.supplierId));
|
|
15
|
+
if (query.facilityId)
|
|
16
|
+
conditions.push(eq(resources.facilityId, query.facilityId));
|
|
17
|
+
if (query.kind)
|
|
18
|
+
conditions.push(eq(resources.kind, query.kind));
|
|
19
|
+
if (query.active !== undefined)
|
|
20
|
+
conditions.push(eq(resources.active, query.active));
|
|
21
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
22
|
+
return paginate(db
|
|
23
|
+
.select()
|
|
24
|
+
.from(resources)
|
|
25
|
+
.where(where)
|
|
26
|
+
.limit(query.limit)
|
|
27
|
+
.offset(query.offset)
|
|
28
|
+
.orderBy(resources.createdAt), db.select({ count: sql `count(*)::int` }).from(resources).where(where), query.limit, query.offset);
|
|
29
|
+
},
|
|
30
|
+
async getResourceById(db, id) {
|
|
31
|
+
const [row] = await db.select().from(resources).where(eq(resources.id, id)).limit(1);
|
|
32
|
+
return row ?? null;
|
|
33
|
+
},
|
|
34
|
+
async createResource(db, data) {
|
|
35
|
+
const [row] = await db.insert(resources).values(data).returning();
|
|
36
|
+
return row;
|
|
37
|
+
},
|
|
38
|
+
async updateResource(db, id, data) {
|
|
39
|
+
const [row] = await db
|
|
40
|
+
.update(resources)
|
|
41
|
+
.set({ ...data, updatedAt: new Date() })
|
|
42
|
+
.where(eq(resources.id, id))
|
|
43
|
+
.returning();
|
|
44
|
+
return row ?? null;
|
|
45
|
+
},
|
|
46
|
+
async deleteResource(db, id) {
|
|
47
|
+
const [row] = await db
|
|
48
|
+
.delete(resources)
|
|
49
|
+
.where(eq(resources.id, id))
|
|
50
|
+
.returning({ id: resources.id });
|
|
51
|
+
return row ?? null;
|
|
52
|
+
},
|
|
53
|
+
async listPools(db, query) {
|
|
54
|
+
const conditions = [];
|
|
55
|
+
if (query.productId)
|
|
56
|
+
conditions.push(eq(resourcePools.productId, query.productId));
|
|
57
|
+
if (query.kind)
|
|
58
|
+
conditions.push(eq(resourcePools.kind, query.kind));
|
|
59
|
+
if (query.active !== undefined)
|
|
60
|
+
conditions.push(eq(resourcePools.active, query.active));
|
|
61
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
62
|
+
return paginate(db
|
|
63
|
+
.select()
|
|
64
|
+
.from(resourcePools)
|
|
65
|
+
.where(where)
|
|
66
|
+
.limit(query.limit)
|
|
67
|
+
.offset(query.offset)
|
|
68
|
+
.orderBy(resourcePools.createdAt), db.select({ count: sql `count(*)::int` }).from(resourcePools).where(where), query.limit, query.offset);
|
|
69
|
+
},
|
|
70
|
+
async getPoolById(db, id) {
|
|
71
|
+
const [row] = await db.select().from(resourcePools).where(eq(resourcePools.id, id)).limit(1);
|
|
72
|
+
return row ?? null;
|
|
73
|
+
},
|
|
74
|
+
async createPool(db, data) {
|
|
75
|
+
const [row] = await db.insert(resourcePools).values(data).returning();
|
|
76
|
+
return row;
|
|
77
|
+
},
|
|
78
|
+
async updatePool(db, id, data) {
|
|
79
|
+
const [row] = await db
|
|
80
|
+
.update(resourcePools)
|
|
81
|
+
.set({ ...data, updatedAt: new Date() })
|
|
82
|
+
.where(eq(resourcePools.id, id))
|
|
83
|
+
.returning();
|
|
84
|
+
return row ?? null;
|
|
85
|
+
},
|
|
86
|
+
async deletePool(db, id) {
|
|
87
|
+
const [row] = await db
|
|
88
|
+
.delete(resourcePools)
|
|
89
|
+
.where(eq(resourcePools.id, id))
|
|
90
|
+
.returning({ id: resourcePools.id });
|
|
91
|
+
return row ?? null;
|
|
92
|
+
},
|
|
93
|
+
async listPoolMembers(db, query) {
|
|
94
|
+
const conditions = [];
|
|
95
|
+
if (query.poolId)
|
|
96
|
+
conditions.push(eq(resourcePoolMembers.poolId, query.poolId));
|
|
97
|
+
if (query.resourceId)
|
|
98
|
+
conditions.push(eq(resourcePoolMembers.resourceId, query.resourceId));
|
|
99
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
100
|
+
return paginate(db
|
|
101
|
+
.select()
|
|
102
|
+
.from(resourcePoolMembers)
|
|
103
|
+
.where(where)
|
|
104
|
+
.limit(query.limit)
|
|
105
|
+
.offset(query.offset)
|
|
106
|
+
.orderBy(resourcePoolMembers.createdAt), db.select({ count: sql `count(*)::int` }).from(resourcePoolMembers).where(where), query.limit, query.offset);
|
|
107
|
+
},
|
|
108
|
+
async createPoolMember(db, data) {
|
|
109
|
+
const [row] = await db.insert(resourcePoolMembers).values(data).returning();
|
|
110
|
+
return row;
|
|
111
|
+
},
|
|
112
|
+
async deletePoolMember(db, id) {
|
|
113
|
+
const [row] = await db
|
|
114
|
+
.delete(resourcePoolMembers)
|
|
115
|
+
.where(eq(resourcePoolMembers.id, id))
|
|
116
|
+
.returning({ id: resourcePoolMembers.id });
|
|
117
|
+
return row ?? null;
|
|
118
|
+
},
|
|
119
|
+
async listRequirements(db, query) {
|
|
120
|
+
const conditions = [];
|
|
121
|
+
if (query.poolId)
|
|
122
|
+
conditions.push(eq(resourceRequirements.poolId, query.poolId));
|
|
123
|
+
if (query.productId)
|
|
124
|
+
conditions.push(eq(resourceRequirements.productId, query.productId));
|
|
125
|
+
if (query.availabilityRuleId)
|
|
126
|
+
conditions.push(eq(resourceRequirements.availabilityRuleId, query.availabilityRuleId));
|
|
127
|
+
if (query.startTimeId)
|
|
128
|
+
conditions.push(eq(resourceRequirements.startTimeId, query.startTimeId));
|
|
129
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
130
|
+
return paginate(db
|
|
131
|
+
.select()
|
|
132
|
+
.from(resourceRequirements)
|
|
133
|
+
.where(where)
|
|
134
|
+
.limit(query.limit)
|
|
135
|
+
.offset(query.offset)
|
|
136
|
+
.orderBy(resourceRequirements.priority, resourceRequirements.createdAt), db.select({ count: sql `count(*)::int` }).from(resourceRequirements).where(where), query.limit, query.offset);
|
|
137
|
+
},
|
|
138
|
+
async getRequirementById(db, id) {
|
|
139
|
+
const [row] = await db
|
|
140
|
+
.select()
|
|
141
|
+
.from(resourceRequirements)
|
|
142
|
+
.where(eq(resourceRequirements.id, id))
|
|
143
|
+
.limit(1);
|
|
144
|
+
return row ?? null;
|
|
145
|
+
},
|
|
146
|
+
async createRequirement(db, data) {
|
|
147
|
+
const [row] = await db.insert(resourceRequirements).values(data).returning();
|
|
148
|
+
return row;
|
|
149
|
+
},
|
|
150
|
+
async updateRequirement(db, id, data) {
|
|
151
|
+
const [row] = await db
|
|
152
|
+
.update(resourceRequirements)
|
|
153
|
+
.set({ ...data, updatedAt: new Date() })
|
|
154
|
+
.where(eq(resourceRequirements.id, id))
|
|
155
|
+
.returning();
|
|
156
|
+
return row ?? null;
|
|
157
|
+
},
|
|
158
|
+
async deleteRequirement(db, id) {
|
|
159
|
+
const [row] = await db
|
|
160
|
+
.delete(resourceRequirements)
|
|
161
|
+
.where(eq(resourceRequirements.id, id))
|
|
162
|
+
.returning({ id: resourceRequirements.id });
|
|
163
|
+
return row ?? null;
|
|
164
|
+
},
|
|
165
|
+
async listAllocations(db, query) {
|
|
166
|
+
return this.listRequirements(db, query);
|
|
167
|
+
},
|
|
168
|
+
async getAllocationById(db, id) {
|
|
169
|
+
return this.getRequirementById(db, id);
|
|
170
|
+
},
|
|
171
|
+
async createAllocation(db, data) {
|
|
172
|
+
return this.createRequirement(db, data);
|
|
173
|
+
},
|
|
174
|
+
async updateAllocation(db, id, data) {
|
|
175
|
+
return this.updateRequirement(db, id, data);
|
|
176
|
+
},
|
|
177
|
+
async deleteAllocation(db, id) {
|
|
178
|
+
return this.deleteRequirement(db, id);
|
|
179
|
+
},
|
|
180
|
+
async listSlotAssignments(db, query) {
|
|
181
|
+
const conditions = [];
|
|
182
|
+
if (query.slotId)
|
|
183
|
+
conditions.push(eq(resourceSlotAssignments.slotId, query.slotId));
|
|
184
|
+
if (query.poolId)
|
|
185
|
+
conditions.push(eq(resourceSlotAssignments.poolId, query.poolId));
|
|
186
|
+
if (query.resourceId)
|
|
187
|
+
conditions.push(eq(resourceSlotAssignments.resourceId, query.resourceId));
|
|
188
|
+
if (query.bookingId)
|
|
189
|
+
conditions.push(eq(resourceSlotAssignments.bookingId, query.bookingId));
|
|
190
|
+
if (query.status)
|
|
191
|
+
conditions.push(eq(resourceSlotAssignments.status, query.status));
|
|
192
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
193
|
+
return paginate(db
|
|
194
|
+
.select()
|
|
195
|
+
.from(resourceSlotAssignments)
|
|
196
|
+
.where(where)
|
|
197
|
+
.limit(query.limit)
|
|
198
|
+
.offset(query.offset)
|
|
199
|
+
.orderBy(desc(resourceSlotAssignments.assignedAt)), db.select({ count: sql `count(*)::int` }).from(resourceSlotAssignments).where(where), query.limit, query.offset);
|
|
200
|
+
},
|
|
201
|
+
async getSlotAssignmentById(db, id) {
|
|
202
|
+
const [row] = await db
|
|
203
|
+
.select()
|
|
204
|
+
.from(resourceSlotAssignments)
|
|
205
|
+
.where(eq(resourceSlotAssignments.id, id))
|
|
206
|
+
.limit(1);
|
|
207
|
+
return row ?? null;
|
|
208
|
+
},
|
|
209
|
+
async createSlotAssignment(db, data) {
|
|
210
|
+
const [row] = await db
|
|
211
|
+
.insert(resourceSlotAssignments)
|
|
212
|
+
.values({ ...data, releasedAt: toDateOrNull(data.releasedAt) })
|
|
213
|
+
.returning();
|
|
214
|
+
return row;
|
|
215
|
+
},
|
|
216
|
+
async updateSlotAssignment(db, id, data) {
|
|
217
|
+
const [row] = await db
|
|
218
|
+
.update(resourceSlotAssignments)
|
|
219
|
+
.set({
|
|
220
|
+
...data,
|
|
221
|
+
releasedAt: data.releasedAt === undefined ? undefined : toDateOrNull(data.releasedAt),
|
|
222
|
+
})
|
|
223
|
+
.where(eq(resourceSlotAssignments.id, id))
|
|
224
|
+
.returning();
|
|
225
|
+
return row ?? null;
|
|
226
|
+
},
|
|
227
|
+
async deleteSlotAssignment(db, id) {
|
|
228
|
+
const [row] = await db
|
|
229
|
+
.delete(resourceSlotAssignments)
|
|
230
|
+
.where(eq(resourceSlotAssignments.id, id))
|
|
231
|
+
.returning({ id: resourceSlotAssignments.id });
|
|
232
|
+
return row ?? null;
|
|
233
|
+
},
|
|
234
|
+
async listCloseouts(db, query) {
|
|
235
|
+
const conditions = [];
|
|
236
|
+
if (query.resourceId)
|
|
237
|
+
conditions.push(eq(resourceCloseouts.resourceId, query.resourceId));
|
|
238
|
+
if (query.dateLocal)
|
|
239
|
+
conditions.push(eq(resourceCloseouts.dateLocal, query.dateLocal));
|
|
240
|
+
const where = conditions.length ? and(...conditions) : undefined;
|
|
241
|
+
return paginate(db
|
|
242
|
+
.select()
|
|
243
|
+
.from(resourceCloseouts)
|
|
244
|
+
.where(where)
|
|
245
|
+
.limit(query.limit)
|
|
246
|
+
.offset(query.offset)
|
|
247
|
+
.orderBy(desc(resourceCloseouts.createdAt)), db.select({ count: sql `count(*)::int` }).from(resourceCloseouts).where(where), query.limit, query.offset);
|
|
248
|
+
},
|
|
249
|
+
async getCloseoutById(db, id) {
|
|
250
|
+
const [row] = await db
|
|
251
|
+
.select()
|
|
252
|
+
.from(resourceCloseouts)
|
|
253
|
+
.where(eq(resourceCloseouts.id, id))
|
|
254
|
+
.limit(1);
|
|
255
|
+
return row ?? null;
|
|
256
|
+
},
|
|
257
|
+
async createCloseout(db, data) {
|
|
258
|
+
const [row] = await db
|
|
259
|
+
.insert(resourceCloseouts)
|
|
260
|
+
.values({
|
|
261
|
+
...data,
|
|
262
|
+
startsAt: toDateOrNull(data.startsAt),
|
|
263
|
+
endsAt: toDateOrNull(data.endsAt),
|
|
264
|
+
})
|
|
265
|
+
.returning();
|
|
266
|
+
return row;
|
|
267
|
+
},
|
|
268
|
+
async updateCloseout(db, id, data) {
|
|
269
|
+
const [row] = await db
|
|
270
|
+
.update(resourceCloseouts)
|
|
271
|
+
.set({
|
|
272
|
+
...data,
|
|
273
|
+
startsAt: data.startsAt === undefined ? undefined : toDateOrNull(data.startsAt),
|
|
274
|
+
endsAt: data.endsAt === undefined ? undefined : toDateOrNull(data.endsAt),
|
|
275
|
+
})
|
|
276
|
+
.where(eq(resourceCloseouts.id, id))
|
|
277
|
+
.returning();
|
|
278
|
+
return row ?? null;
|
|
279
|
+
},
|
|
280
|
+
async deleteCloseout(db, id) {
|
|
281
|
+
const [row] = await db
|
|
282
|
+
.delete(resourceCloseouts)
|
|
283
|
+
.where(eq(resourceCloseouts.id, id))
|
|
284
|
+
.returning({ id: resourceCloseouts.id });
|
|
285
|
+
return row ?? null;
|
|
286
|
+
},
|
|
287
|
+
};
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const resourceKindSchema: z.ZodEnum<{
|
|
3
|
+
guide: "guide";
|
|
4
|
+
vehicle: "vehicle";
|
|
5
|
+
room: "room";
|
|
6
|
+
boat: "boat";
|
|
7
|
+
equipment: "equipment";
|
|
8
|
+
other: "other";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const resourceAllocationModeSchema: z.ZodEnum<{
|
|
11
|
+
shared: "shared";
|
|
12
|
+
exclusive: "exclusive";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const resourceAssignmentStatusSchema: z.ZodEnum<{
|
|
15
|
+
reserved: "reserved";
|
|
16
|
+
assigned: "assigned";
|
|
17
|
+
released: "released";
|
|
18
|
+
cancelled: "cancelled";
|
|
19
|
+
completed: "completed";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const resourceCoreSchema: z.ZodObject<{
|
|
22
|
+
supplierId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
facilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
+
kind: z.ZodEnum<{
|
|
25
|
+
guide: "guide";
|
|
26
|
+
vehicle: "vehicle";
|
|
27
|
+
room: "room";
|
|
28
|
+
boat: "boat";
|
|
29
|
+
equipment: "equipment";
|
|
30
|
+
other: "other";
|
|
31
|
+
}>;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
capacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
35
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const insertResourceSchema: z.ZodObject<{
|
|
39
|
+
supplierId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
facilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
kind: z.ZodEnum<{
|
|
42
|
+
guide: "guide";
|
|
43
|
+
vehicle: "vehicle";
|
|
44
|
+
room: "room";
|
|
45
|
+
boat: "boat";
|
|
46
|
+
equipment: "equipment";
|
|
47
|
+
other: "other";
|
|
48
|
+
}>;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
capacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const updateResourceSchema: z.ZodObject<{
|
|
56
|
+
supplierId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
57
|
+
facilityId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
58
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
guide: "guide";
|
|
60
|
+
vehicle: "vehicle";
|
|
61
|
+
room: "room";
|
|
62
|
+
boat: "boat";
|
|
63
|
+
equipment: "equipment";
|
|
64
|
+
other: "other";
|
|
65
|
+
}>>;
|
|
66
|
+
name: z.ZodOptional<z.ZodString>;
|
|
67
|
+
code: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
68
|
+
capacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
69
|
+
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
70
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const resourceListQuerySchema: z.ZodObject<{
|
|
73
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
74
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
75
|
+
supplierId: z.ZodOptional<z.ZodString>;
|
|
76
|
+
facilityId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
guide: "guide";
|
|
79
|
+
vehicle: "vehicle";
|
|
80
|
+
room: "room";
|
|
81
|
+
boat: "boat";
|
|
82
|
+
equipment: "equipment";
|
|
83
|
+
other: "other";
|
|
84
|
+
}>>;
|
|
85
|
+
active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
86
|
+
0: "0";
|
|
87
|
+
1: "1";
|
|
88
|
+
true: "true";
|
|
89
|
+
false: "false";
|
|
90
|
+
}>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export declare const resourcePoolCoreSchema: z.ZodObject<{
|
|
93
|
+
productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
kind: z.ZodEnum<{
|
|
95
|
+
guide: "guide";
|
|
96
|
+
vehicle: "vehicle";
|
|
97
|
+
room: "room";
|
|
98
|
+
boat: "boat";
|
|
99
|
+
equipment: "equipment";
|
|
100
|
+
other: "other";
|
|
101
|
+
}>;
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
sharedCapacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
104
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
105
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export declare const insertResourcePoolSchema: z.ZodObject<{
|
|
108
|
+
productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
kind: z.ZodEnum<{
|
|
110
|
+
guide: "guide";
|
|
111
|
+
vehicle: "vehicle";
|
|
112
|
+
room: "room";
|
|
113
|
+
boat: "boat";
|
|
114
|
+
equipment: "equipment";
|
|
115
|
+
other: "other";
|
|
116
|
+
}>;
|
|
117
|
+
name: z.ZodString;
|
|
118
|
+
sharedCapacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
119
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
120
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export declare const updateResourcePoolSchema: z.ZodObject<{
|
|
123
|
+
productId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
124
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
125
|
+
guide: "guide";
|
|
126
|
+
vehicle: "vehicle";
|
|
127
|
+
room: "room";
|
|
128
|
+
boat: "boat";
|
|
129
|
+
equipment: "equipment";
|
|
130
|
+
other: "other";
|
|
131
|
+
}>>;
|
|
132
|
+
name: z.ZodOptional<z.ZodString>;
|
|
133
|
+
sharedCapacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
134
|
+
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
135
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export declare const resourcePoolListQuerySchema: z.ZodObject<{
|
|
138
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
139
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
140
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
guide: "guide";
|
|
143
|
+
vehicle: "vehicle";
|
|
144
|
+
room: "room";
|
|
145
|
+
boat: "boat";
|
|
146
|
+
equipment: "equipment";
|
|
147
|
+
other: "other";
|
|
148
|
+
}>>;
|
|
149
|
+
active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
150
|
+
0: "0";
|
|
151
|
+
1: "1";
|
|
152
|
+
true: "true";
|
|
153
|
+
false: "false";
|
|
154
|
+
}>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
export declare const insertResourcePoolMemberSchema: z.ZodObject<{
|
|
157
|
+
poolId: z.ZodString;
|
|
158
|
+
resourceId: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export declare const resourcePoolMemberListQuerySchema: z.ZodObject<{
|
|
161
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
162
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
163
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
export declare const resourceRequirementCoreSchema: z.ZodObject<{
|
|
167
|
+
poolId: z.ZodString;
|
|
168
|
+
productId: z.ZodString;
|
|
169
|
+
availabilityRuleId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
|
+
startTimeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
quantityRequired: z.ZodDefault<z.ZodNumber>;
|
|
172
|
+
allocationMode: z.ZodDefault<z.ZodEnum<{
|
|
173
|
+
shared: "shared";
|
|
174
|
+
exclusive: "exclusive";
|
|
175
|
+
}>>;
|
|
176
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
export declare const insertResourceRequirementSchema: z.ZodObject<{
|
|
179
|
+
poolId: z.ZodString;
|
|
180
|
+
productId: z.ZodString;
|
|
181
|
+
availabilityRuleId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
startTimeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
quantityRequired: z.ZodDefault<z.ZodNumber>;
|
|
184
|
+
allocationMode: z.ZodDefault<z.ZodEnum<{
|
|
185
|
+
shared: "shared";
|
|
186
|
+
exclusive: "exclusive";
|
|
187
|
+
}>>;
|
|
188
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
export declare const updateResourceRequirementSchema: z.ZodObject<{
|
|
191
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
192
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
193
|
+
availabilityRuleId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
194
|
+
startTimeId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
195
|
+
quantityRequired: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
196
|
+
allocationMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
197
|
+
shared: "shared";
|
|
198
|
+
exclusive: "exclusive";
|
|
199
|
+
}>>>;
|
|
200
|
+
priority: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
export declare const resourceRequirementListQuerySchema: z.ZodObject<{
|
|
203
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
204
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
205
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
206
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
availabilityRuleId: z.ZodOptional<z.ZodString>;
|
|
208
|
+
startTimeId: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
export declare const insertResourceAllocationSchema: z.ZodObject<{
|
|
211
|
+
poolId: z.ZodString;
|
|
212
|
+
productId: z.ZodString;
|
|
213
|
+
availabilityRuleId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
startTimeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
quantityRequired: z.ZodDefault<z.ZodNumber>;
|
|
216
|
+
allocationMode: z.ZodDefault<z.ZodEnum<{
|
|
217
|
+
shared: "shared";
|
|
218
|
+
exclusive: "exclusive";
|
|
219
|
+
}>>;
|
|
220
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
export declare const updateResourceAllocationSchema: z.ZodObject<{
|
|
223
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
224
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
225
|
+
availabilityRuleId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
226
|
+
startTimeId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
227
|
+
quantityRequired: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
228
|
+
allocationMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
229
|
+
shared: "shared";
|
|
230
|
+
exclusive: "exclusive";
|
|
231
|
+
}>>>;
|
|
232
|
+
priority: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
export declare const resourceAllocationListQuerySchema: z.ZodObject<{
|
|
235
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
236
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
237
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
238
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
239
|
+
availabilityRuleId: z.ZodOptional<z.ZodString>;
|
|
240
|
+
startTimeId: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
export declare const resourceSlotAssignmentCoreSchema: z.ZodObject<{
|
|
243
|
+
slotId: z.ZodString;
|
|
244
|
+
poolId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
245
|
+
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
246
|
+
bookingId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
247
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
248
|
+
reserved: "reserved";
|
|
249
|
+
assigned: "assigned";
|
|
250
|
+
released: "released";
|
|
251
|
+
cancelled: "cancelled";
|
|
252
|
+
completed: "completed";
|
|
253
|
+
}>>;
|
|
254
|
+
assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
255
|
+
releasedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
256
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export declare const insertResourceSlotAssignmentSchema: z.ZodObject<{
|
|
259
|
+
slotId: z.ZodString;
|
|
260
|
+
poolId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
261
|
+
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
262
|
+
bookingId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
263
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
264
|
+
reserved: "reserved";
|
|
265
|
+
assigned: "assigned";
|
|
266
|
+
released: "released";
|
|
267
|
+
cancelled: "cancelled";
|
|
268
|
+
completed: "completed";
|
|
269
|
+
}>>;
|
|
270
|
+
assignedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
+
releasedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
export declare const updateResourceSlotAssignmentSchema: z.ZodObject<{
|
|
275
|
+
slotId: z.ZodOptional<z.ZodString>;
|
|
276
|
+
poolId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
277
|
+
resourceId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
278
|
+
bookingId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
279
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
280
|
+
reserved: "reserved";
|
|
281
|
+
assigned: "assigned";
|
|
282
|
+
released: "released";
|
|
283
|
+
cancelled: "cancelled";
|
|
284
|
+
completed: "completed";
|
|
285
|
+
}>>>;
|
|
286
|
+
assignedBy: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
287
|
+
releasedAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
288
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
289
|
+
}, z.core.$strip>;
|
|
290
|
+
export declare const resourceSlotAssignmentListQuerySchema: z.ZodObject<{
|
|
291
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
292
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
293
|
+
slotId: z.ZodOptional<z.ZodString>;
|
|
294
|
+
poolId: z.ZodOptional<z.ZodString>;
|
|
295
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
296
|
+
bookingId: z.ZodOptional<z.ZodString>;
|
|
297
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
298
|
+
reserved: "reserved";
|
|
299
|
+
assigned: "assigned";
|
|
300
|
+
released: "released";
|
|
301
|
+
cancelled: "cancelled";
|
|
302
|
+
completed: "completed";
|
|
303
|
+
}>>;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
export declare const resourceCloseoutCoreSchema: z.ZodObject<{
|
|
306
|
+
resourceId: z.ZodString;
|
|
307
|
+
dateLocal: z.ZodString;
|
|
308
|
+
startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
309
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
310
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
311
|
+
createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
312
|
+
}, z.core.$strip>;
|
|
313
|
+
export declare const insertResourceCloseoutSchema: z.ZodObject<{
|
|
314
|
+
resourceId: z.ZodString;
|
|
315
|
+
dateLocal: z.ZodString;
|
|
316
|
+
startsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
317
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
318
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
+
}, z.core.$strip>;
|
|
321
|
+
export declare const updateResourceCloseoutSchema: z.ZodObject<{
|
|
322
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
323
|
+
dateLocal: z.ZodOptional<z.ZodString>;
|
|
324
|
+
startsAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
325
|
+
endsAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
326
|
+
reason: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
327
|
+
createdBy: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
328
|
+
}, z.core.$strip>;
|
|
329
|
+
export declare const resourceCloseoutListQuerySchema: z.ZodObject<{
|
|
330
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
331
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
332
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
333
|
+
dateLocal: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,kBAAkB;;;;;;;EAAqE,CAAA;AACpG,eAAO,MAAM,4BAA4B;;;EAAkC,CAAA;AAC3E,eAAO,MAAM,8BAA8B;;;;;;EAMzC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;iBAS7B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;iBAAqB,CAAA;AACtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;iBAA+B,CAAA;AAChE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;iBAKlC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;iBAOjC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;iBAAyB,CAAA;AAC9D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;iBAAmC,CAAA;AACxE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;iBAItC,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;iBAG5C,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAQxC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;iBAAgC,CAAA;AAC5E,eAAO,MAAM,+BAA+B;;;;;;;;;;;iBAA0C,CAAA;AACtF,eAAO,MAAM,kCAAkC;;;;;;;iBAK7C,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBAAkC,CAAA;AAC7E,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBAAkC,CAAA;AAC7E,eAAO,MAAM,iCAAiC;;;;;;;iBAAqC,CAAA;AAEnF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;iBAS3C,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;iBAAmC,CAAA;AAClF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;iBAA6C,CAAA;AAC5F,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;iBAMhD,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;iBAOrC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;iBAA6B,CAAA;AACtE,eAAO,MAAM,4BAA4B;;;;;;;iBAAuC,CAAA;AAChF,eAAO,MAAM,+BAA+B;;;;;iBAG1C,CAAA"}
|