@voyantjs/resources 0.4.5 → 0.6.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/dist/routes.d.ts +17 -17
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +33 -32
- package/dist/schema.d.ts +2 -2
- package/dist/service.d.ts +15 -15
- package/dist/validation.d.ts +9 -9
- package/package.json +6 -6
package/dist/routes.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
14
14
|
id: string;
|
|
15
15
|
supplierId: string | null;
|
|
16
16
|
facilityId: string | null;
|
|
17
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
17
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
18
18
|
name: string;
|
|
19
19
|
code: string | null;
|
|
20
20
|
capacity: number | null;
|
|
@@ -39,15 +39,15 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
39
39
|
data: {
|
|
40
40
|
id: string;
|
|
41
41
|
name: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
notes: string | null;
|
|
45
|
+
code: string | null;
|
|
42
46
|
supplierId: string | null;
|
|
43
47
|
facilityId: string | null;
|
|
44
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
45
|
-
code: string | null;
|
|
48
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
46
49
|
capacity: number | null;
|
|
47
50
|
active: boolean;
|
|
48
|
-
notes: string | null;
|
|
49
|
-
createdAt: string;
|
|
50
|
-
updatedAt: string;
|
|
51
51
|
} | undefined;
|
|
52
52
|
};
|
|
53
53
|
outputFormat: "json";
|
|
@@ -63,7 +63,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
63
63
|
id: string;
|
|
64
64
|
supplierId: string | null;
|
|
65
65
|
facilityId: string | null;
|
|
66
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
66
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
67
67
|
name: string;
|
|
68
68
|
code: string | null;
|
|
69
69
|
capacity: number | null;
|
|
@@ -124,7 +124,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
124
124
|
id: string;
|
|
125
125
|
supplierId: string | null;
|
|
126
126
|
facilityId: string | null;
|
|
127
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
127
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
128
128
|
name: string;
|
|
129
129
|
code: string | null;
|
|
130
130
|
capacity: number | null;
|
|
@@ -162,7 +162,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
162
162
|
id: string;
|
|
163
163
|
supplierId: string | null;
|
|
164
164
|
facilityId: string | null;
|
|
165
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
165
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
166
166
|
name: string;
|
|
167
167
|
code: string | null;
|
|
168
168
|
capacity: number | null;
|
|
@@ -210,7 +210,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
210
210
|
data: {
|
|
211
211
|
id: string;
|
|
212
212
|
productId: string | null;
|
|
213
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
213
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
214
214
|
name: string;
|
|
215
215
|
sharedCapacity: number | null;
|
|
216
216
|
active: boolean;
|
|
@@ -234,11 +234,11 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
234
234
|
data: {
|
|
235
235
|
id: string;
|
|
236
236
|
name: string;
|
|
237
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
238
|
-
active: boolean;
|
|
239
|
-
notes: string | null;
|
|
240
237
|
createdAt: string;
|
|
241
238
|
updatedAt: string;
|
|
239
|
+
notes: string | null;
|
|
240
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
241
|
+
active: boolean;
|
|
242
242
|
productId: string | null;
|
|
243
243
|
sharedCapacity: number | null;
|
|
244
244
|
} | undefined;
|
|
@@ -255,7 +255,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
255
255
|
data: {
|
|
256
256
|
id: string;
|
|
257
257
|
productId: string | null;
|
|
258
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
258
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
259
259
|
name: string;
|
|
260
260
|
sharedCapacity: number | null;
|
|
261
261
|
active: boolean;
|
|
@@ -314,7 +314,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
314
314
|
data: {
|
|
315
315
|
id: string;
|
|
316
316
|
productId: string | null;
|
|
317
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
317
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
318
318
|
name: string;
|
|
319
319
|
sharedCapacity: number | null;
|
|
320
320
|
active: boolean;
|
|
@@ -350,7 +350,7 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
350
350
|
data: {
|
|
351
351
|
id: string;
|
|
352
352
|
productId: string | null;
|
|
353
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
353
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
354
354
|
name: string;
|
|
355
355
|
sharedCapacity: number | null;
|
|
356
356
|
active: boolean;
|
|
@@ -866,12 +866,12 @@ export declare const resourcesRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
866
866
|
output: {
|
|
867
867
|
data: {
|
|
868
868
|
id: string;
|
|
869
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
869
870
|
notes: string | null;
|
|
870
871
|
poolId: string | null;
|
|
871
872
|
resourceId: string | null;
|
|
872
873
|
slotId: string;
|
|
873
874
|
bookingId: string | null;
|
|
874
|
-
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
875
875
|
assignedAt: string;
|
|
876
876
|
assignedBy: string | null;
|
|
877
877
|
releasedAt: string | null;
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAyBjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAkFD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA8VxB,CAAA;AAEJ,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
1
2
|
import { Hono } from "hono";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { resourcesService } from "./service.js";
|
|
@@ -52,16 +53,16 @@ async function handleBatchDelete({ db, ids, remove, }) {
|
|
|
52
53
|
}
|
|
53
54
|
export const resourcesRoutes = new Hono()
|
|
54
55
|
.get("/resources", async (c) => {
|
|
55
|
-
const query =
|
|
56
|
+
const query = await parseQuery(c, resourceListQuerySchema);
|
|
56
57
|
return c.json(await resourcesService.listResources(c.get("db"), query));
|
|
57
58
|
})
|
|
58
59
|
.post("/resources", async (c) => {
|
|
59
60
|
return c.json({
|
|
60
|
-
data: await resourcesService.createResource(c.get("db"),
|
|
61
|
+
data: await resourcesService.createResource(c.get("db"), await parseJsonBody(c, insertResourceSchema)),
|
|
61
62
|
}, 201);
|
|
62
63
|
})
|
|
63
64
|
.post("/resources/batch-update", async (c) => {
|
|
64
|
-
const body =
|
|
65
|
+
const body = await parseJsonBody(c, batchUpdateResourceSchema);
|
|
65
66
|
return c.json(await handleBatchUpdate({
|
|
66
67
|
db: c.get("db"),
|
|
67
68
|
ids: body.ids,
|
|
@@ -70,7 +71,7 @@ export const resourcesRoutes = new Hono()
|
|
|
70
71
|
}));
|
|
71
72
|
})
|
|
72
73
|
.post("/resources/batch-delete", async (c) => {
|
|
73
|
-
const body =
|
|
74
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
74
75
|
return c.json(await handleBatchDelete({
|
|
75
76
|
db: c.get("db"),
|
|
76
77
|
ids: body.ids,
|
|
@@ -84,7 +85,7 @@ export const resourcesRoutes = new Hono()
|
|
|
84
85
|
return c.json({ data: row });
|
|
85
86
|
})
|
|
86
87
|
.patch("/resources/:id", async (c) => {
|
|
87
|
-
const row = await resourcesService.updateResource(c.get("db"), c.req.param("id"),
|
|
88
|
+
const row = await resourcesService.updateResource(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourceSchema));
|
|
88
89
|
if (!row)
|
|
89
90
|
return c.json({ error: "Resource not found" }, 404);
|
|
90
91
|
return c.json({ data: row });
|
|
@@ -96,16 +97,16 @@ export const resourcesRoutes = new Hono()
|
|
|
96
97
|
return c.json({ success: true });
|
|
97
98
|
})
|
|
98
99
|
.get("/pools", async (c) => {
|
|
99
|
-
const query =
|
|
100
|
+
const query = await parseQuery(c, resourcePoolListQuerySchema);
|
|
100
101
|
return c.json(await resourcesService.listPools(c.get("db"), query));
|
|
101
102
|
})
|
|
102
103
|
.post("/pools", async (c) => {
|
|
103
104
|
return c.json({
|
|
104
|
-
data: await resourcesService.createPool(c.get("db"),
|
|
105
|
+
data: await resourcesService.createPool(c.get("db"), await parseJsonBody(c, insertResourcePoolSchema)),
|
|
105
106
|
}, 201);
|
|
106
107
|
})
|
|
107
108
|
.post("/pools/batch-update", async (c) => {
|
|
108
|
-
const body =
|
|
109
|
+
const body = await parseJsonBody(c, batchUpdateResourcePoolSchema);
|
|
109
110
|
return c.json(await handleBatchUpdate({
|
|
110
111
|
db: c.get("db"),
|
|
111
112
|
ids: body.ids,
|
|
@@ -114,7 +115,7 @@ export const resourcesRoutes = new Hono()
|
|
|
114
115
|
}));
|
|
115
116
|
})
|
|
116
117
|
.post("/pools/batch-delete", async (c) => {
|
|
117
|
-
const body =
|
|
118
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
118
119
|
return c.json(await handleBatchDelete({
|
|
119
120
|
db: c.get("db"),
|
|
120
121
|
ids: body.ids,
|
|
@@ -128,7 +129,7 @@ export const resourcesRoutes = new Hono()
|
|
|
128
129
|
return c.json({ data: row });
|
|
129
130
|
})
|
|
130
131
|
.patch("/pools/:id", async (c) => {
|
|
131
|
-
const row = await resourcesService.updatePool(c.get("db"), c.req.param("id"),
|
|
132
|
+
const row = await resourcesService.updatePool(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourcePoolSchema));
|
|
132
133
|
if (!row)
|
|
133
134
|
return c.json({ error: "Resource pool not found" }, 404);
|
|
134
135
|
return c.json({ data: row });
|
|
@@ -140,12 +141,12 @@ export const resourcesRoutes = new Hono()
|
|
|
140
141
|
return c.json({ success: true });
|
|
141
142
|
})
|
|
142
143
|
.get("/pool-members", async (c) => {
|
|
143
|
-
const query =
|
|
144
|
+
const query = await parseQuery(c, resourcePoolMemberListQuerySchema);
|
|
144
145
|
return c.json(await resourcesService.listPoolMembers(c.get("db"), query));
|
|
145
146
|
})
|
|
146
147
|
.post("/pool-members", async (c) => {
|
|
147
148
|
return c.json({
|
|
148
|
-
data: await resourcesService.createPoolMember(c.get("db"),
|
|
149
|
+
data: await resourcesService.createPoolMember(c.get("db"), await parseJsonBody(c, insertResourcePoolMemberSchema)),
|
|
149
150
|
}, 201);
|
|
150
151
|
})
|
|
151
152
|
.delete("/pool-members/:id", async (c) => {
|
|
@@ -155,16 +156,16 @@ export const resourcesRoutes = new Hono()
|
|
|
155
156
|
return c.json({ success: true });
|
|
156
157
|
})
|
|
157
158
|
.get("/requirements", async (c) => {
|
|
158
|
-
const query =
|
|
159
|
+
const query = await parseQuery(c, resourceRequirementListQuerySchema);
|
|
159
160
|
return c.json(await resourcesService.listRequirements(c.get("db"), query));
|
|
160
161
|
})
|
|
161
162
|
.post("/requirements", async (c) => {
|
|
162
163
|
return c.json({
|
|
163
|
-
data: await resourcesService.createRequirement(c.get("db"),
|
|
164
|
+
data: await resourcesService.createRequirement(c.get("db"), await parseJsonBody(c, insertResourceRequirementSchema)),
|
|
164
165
|
}, 201);
|
|
165
166
|
})
|
|
166
167
|
.post("/requirements/batch-update", async (c) => {
|
|
167
|
-
const body =
|
|
168
|
+
const body = await parseJsonBody(c, batchUpdateResourceRequirementSchema);
|
|
168
169
|
return c.json(await handleBatchUpdate({
|
|
169
170
|
db: c.get("db"),
|
|
170
171
|
ids: body.ids,
|
|
@@ -173,7 +174,7 @@ export const resourcesRoutes = new Hono()
|
|
|
173
174
|
}));
|
|
174
175
|
})
|
|
175
176
|
.post("/requirements/batch-delete", async (c) => {
|
|
176
|
-
const body =
|
|
177
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
177
178
|
return c.json(await handleBatchDelete({
|
|
178
179
|
db: c.get("db"),
|
|
179
180
|
ids: body.ids,
|
|
@@ -187,7 +188,7 @@ export const resourcesRoutes = new Hono()
|
|
|
187
188
|
return c.json({ data: row });
|
|
188
189
|
})
|
|
189
190
|
.patch("/requirements/:id", async (c) => {
|
|
190
|
-
const row = await resourcesService.updateRequirement(c.get("db"), c.req.param("id"),
|
|
191
|
+
const row = await resourcesService.updateRequirement(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourceRequirementSchema));
|
|
191
192
|
if (!row)
|
|
192
193
|
return c.json({ error: "Resource requirement not found" }, 404);
|
|
193
194
|
return c.json({ data: row });
|
|
@@ -199,16 +200,16 @@ export const resourcesRoutes = new Hono()
|
|
|
199
200
|
return c.json({ success: true });
|
|
200
201
|
})
|
|
201
202
|
.get("/allocations", async (c) => {
|
|
202
|
-
const query =
|
|
203
|
+
const query = await parseQuery(c, resourceRequirementListQuerySchema);
|
|
203
204
|
return c.json(await resourcesService.listRequirements(c.get("db"), query));
|
|
204
205
|
})
|
|
205
206
|
.post("/allocations", async (c) => {
|
|
206
207
|
return c.json({
|
|
207
|
-
data: await resourcesService.createRequirement(c.get("db"),
|
|
208
|
+
data: await resourcesService.createRequirement(c.get("db"), await parseJsonBody(c, insertResourceRequirementSchema)),
|
|
208
209
|
}, 201);
|
|
209
210
|
})
|
|
210
211
|
.post("/allocations/batch-update", async (c) => {
|
|
211
|
-
const body =
|
|
212
|
+
const body = await parseJsonBody(c, batchUpdateResourceRequirementSchema);
|
|
212
213
|
return c.json(await handleBatchUpdate({
|
|
213
214
|
db: c.get("db"),
|
|
214
215
|
ids: body.ids,
|
|
@@ -217,7 +218,7 @@ export const resourcesRoutes = new Hono()
|
|
|
217
218
|
}));
|
|
218
219
|
})
|
|
219
220
|
.post("/allocations/batch-delete", async (c) => {
|
|
220
|
-
const body =
|
|
221
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
221
222
|
return c.json(await handleBatchDelete({
|
|
222
223
|
db: c.get("db"),
|
|
223
224
|
ids: body.ids,
|
|
@@ -231,7 +232,7 @@ export const resourcesRoutes = new Hono()
|
|
|
231
232
|
return c.json({ data: row });
|
|
232
233
|
})
|
|
233
234
|
.patch("/allocations/:id", async (c) => {
|
|
234
|
-
const row = await resourcesService.updateRequirement(c.get("db"), c.req.param("id"),
|
|
235
|
+
const row = await resourcesService.updateRequirement(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourceRequirementSchema));
|
|
235
236
|
if (!row)
|
|
236
237
|
return c.json({ error: "Resource allocation not found" }, 404);
|
|
237
238
|
return c.json({ data: row });
|
|
@@ -243,16 +244,16 @@ export const resourcesRoutes = new Hono()
|
|
|
243
244
|
return c.json({ success: true });
|
|
244
245
|
})
|
|
245
246
|
.get("/slot-assignments", async (c) => {
|
|
246
|
-
const query =
|
|
247
|
+
const query = await parseQuery(c, resourceSlotAssignmentListQuerySchema);
|
|
247
248
|
return c.json(await resourcesService.listSlotAssignments(c.get("db"), query));
|
|
248
249
|
})
|
|
249
250
|
.post("/slot-assignments", async (c) => {
|
|
250
251
|
return c.json({
|
|
251
|
-
data: await resourcesService.createSlotAssignment(c.get("db"),
|
|
252
|
+
data: await resourcesService.createSlotAssignment(c.get("db"), await parseJsonBody(c, insertResourceSlotAssignmentSchema)),
|
|
252
253
|
}, 201);
|
|
253
254
|
})
|
|
254
255
|
.post("/slot-assignments/batch-update", async (c) => {
|
|
255
|
-
const body =
|
|
256
|
+
const body = await parseJsonBody(c, batchUpdateResourceSlotAssignmentSchema);
|
|
256
257
|
return c.json(await handleBatchUpdate({
|
|
257
258
|
db: c.get("db"),
|
|
258
259
|
ids: body.ids,
|
|
@@ -261,7 +262,7 @@ export const resourcesRoutes = new Hono()
|
|
|
261
262
|
}));
|
|
262
263
|
})
|
|
263
264
|
.post("/slot-assignments/batch-delete", async (c) => {
|
|
264
|
-
const body =
|
|
265
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
265
266
|
return c.json(await handleBatchDelete({
|
|
266
267
|
db: c.get("db"),
|
|
267
268
|
ids: body.ids,
|
|
@@ -275,7 +276,7 @@ export const resourcesRoutes = new Hono()
|
|
|
275
276
|
return c.json({ data: row });
|
|
276
277
|
})
|
|
277
278
|
.patch("/slot-assignments/:id", async (c) => {
|
|
278
|
-
const row = await resourcesService.updateSlotAssignment(c.get("db"), c.req.param("id"),
|
|
279
|
+
const row = await resourcesService.updateSlotAssignment(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourceSlotAssignmentSchema));
|
|
279
280
|
if (!row)
|
|
280
281
|
return c.json({ error: "Resource slot assignment not found" }, 404);
|
|
281
282
|
return c.json({ data: row });
|
|
@@ -287,16 +288,16 @@ export const resourcesRoutes = new Hono()
|
|
|
287
288
|
return c.json({ success: true });
|
|
288
289
|
})
|
|
289
290
|
.get("/closeouts", async (c) => {
|
|
290
|
-
const query =
|
|
291
|
+
const query = await parseQuery(c, resourceCloseoutListQuerySchema);
|
|
291
292
|
return c.json(await resourcesService.listCloseouts(c.get("db"), query));
|
|
292
293
|
})
|
|
293
294
|
.post("/closeouts", async (c) => {
|
|
294
295
|
return c.json({
|
|
295
|
-
data: await resourcesService.createCloseout(c.get("db"),
|
|
296
|
+
data: await resourcesService.createCloseout(c.get("db"), await parseJsonBody(c, insertResourceCloseoutSchema)),
|
|
296
297
|
}, 201);
|
|
297
298
|
})
|
|
298
299
|
.post("/closeouts/batch-update", async (c) => {
|
|
299
|
-
const body =
|
|
300
|
+
const body = await parseJsonBody(c, batchUpdateResourceCloseoutSchema);
|
|
300
301
|
return c.json(await handleBatchUpdate({
|
|
301
302
|
db: c.get("db"),
|
|
302
303
|
ids: body.ids,
|
|
@@ -305,7 +306,7 @@ export const resourcesRoutes = new Hono()
|
|
|
305
306
|
}));
|
|
306
307
|
})
|
|
307
308
|
.post("/closeouts/batch-delete", async (c) => {
|
|
308
|
-
const body =
|
|
309
|
+
const body = await parseJsonBody(c, batchIdsSchema);
|
|
309
310
|
return c.json(await handleBatchDelete({
|
|
310
311
|
db: c.get("db"),
|
|
311
312
|
ids: body.ids,
|
|
@@ -319,7 +320,7 @@ export const resourcesRoutes = new Hono()
|
|
|
319
320
|
return c.json({ data: row });
|
|
320
321
|
})
|
|
321
322
|
.patch("/closeouts/:id", async (c) => {
|
|
322
|
-
const row = await resourcesService.updateCloseout(c.get("db"), c.req.param("id"),
|
|
323
|
+
const row = await resourcesService.updateCloseout(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateResourceCloseoutSchema));
|
|
323
324
|
if (!row)
|
|
324
325
|
return c.json({ error: "Resource closeout not found" }, 404);
|
|
325
326
|
return c.json({ data: row });
|
package/dist/schema.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare const resources: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
61
61
|
tableName: "resources";
|
|
62
62
|
dataType: "string";
|
|
63
63
|
columnType: "PgEnumColumn";
|
|
64
|
-
data: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
64
|
+
data: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
65
65
|
driverParam: string;
|
|
66
66
|
notNull: true;
|
|
67
67
|
hasDefault: false;
|
|
@@ -238,7 +238,7 @@ export declare const resourcePools: import("drizzle-orm/pg-core").PgTableWithCol
|
|
|
238
238
|
tableName: "resource_pools";
|
|
239
239
|
dataType: "string";
|
|
240
240
|
columnType: "PgEnumColumn";
|
|
241
|
-
data: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
241
|
+
data: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
242
242
|
driverParam: string;
|
|
243
243
|
notNull: true;
|
|
244
244
|
hasDefault: false;
|
package/dist/service.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const resourcesService: {
|
|
|
24
24
|
id: string;
|
|
25
25
|
supplierId: string | null;
|
|
26
26
|
facilityId: string | null;
|
|
27
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
27
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
28
28
|
name: string;
|
|
29
29
|
code: string | null;
|
|
30
30
|
capacity: number | null;
|
|
@@ -41,7 +41,7 @@ export declare const resourcesService: {
|
|
|
41
41
|
id: string;
|
|
42
42
|
supplierId: string | null;
|
|
43
43
|
facilityId: string | null;
|
|
44
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
44
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
45
45
|
name: string;
|
|
46
46
|
code: string | null;
|
|
47
47
|
capacity: number | null;
|
|
@@ -53,21 +53,21 @@ export declare const resourcesService: {
|
|
|
53
53
|
createResource(db: PostgresJsDatabase, data: CreateResourceInput): Promise<{
|
|
54
54
|
id: string;
|
|
55
55
|
name: string;
|
|
56
|
+
createdAt: Date;
|
|
57
|
+
updatedAt: Date;
|
|
58
|
+
notes: string | null;
|
|
59
|
+
code: string | null;
|
|
56
60
|
supplierId: string | null;
|
|
57
61
|
facilityId: string | null;
|
|
58
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
59
|
-
code: string | null;
|
|
62
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
60
63
|
capacity: number | null;
|
|
61
64
|
active: boolean;
|
|
62
|
-
notes: string | null;
|
|
63
|
-
createdAt: Date;
|
|
64
|
-
updatedAt: Date;
|
|
65
65
|
} | undefined>;
|
|
66
66
|
updateResource(db: PostgresJsDatabase, id: string, data: UpdateResourceInput): Promise<{
|
|
67
67
|
id: string;
|
|
68
68
|
supplierId: string | null;
|
|
69
69
|
facilityId: string | null;
|
|
70
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
70
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
71
71
|
name: string;
|
|
72
72
|
code: string | null;
|
|
73
73
|
capacity: number | null;
|
|
@@ -83,7 +83,7 @@ export declare const resourcesService: {
|
|
|
83
83
|
data: {
|
|
84
84
|
id: string;
|
|
85
85
|
productId: string | null;
|
|
86
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
86
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
87
87
|
name: string;
|
|
88
88
|
sharedCapacity: number | null;
|
|
89
89
|
active: boolean;
|
|
@@ -98,7 +98,7 @@ export declare const resourcesService: {
|
|
|
98
98
|
getPoolById(db: PostgresJsDatabase, id: string): Promise<{
|
|
99
99
|
id: string;
|
|
100
100
|
productId: string | null;
|
|
101
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
101
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
102
102
|
name: string;
|
|
103
103
|
sharedCapacity: number | null;
|
|
104
104
|
active: boolean;
|
|
@@ -109,18 +109,18 @@ export declare const resourcesService: {
|
|
|
109
109
|
createPool(db: PostgresJsDatabase, data: CreateResourcePoolInput): Promise<{
|
|
110
110
|
id: string;
|
|
111
111
|
name: string;
|
|
112
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
113
|
-
active: boolean;
|
|
114
|
-
notes: string | null;
|
|
115
112
|
createdAt: Date;
|
|
116
113
|
updatedAt: Date;
|
|
114
|
+
notes: string | null;
|
|
115
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
116
|
+
active: boolean;
|
|
117
117
|
productId: string | null;
|
|
118
118
|
sharedCapacity: number | null;
|
|
119
119
|
} | undefined>;
|
|
120
120
|
updatePool(db: PostgresJsDatabase, id: string, data: UpdateResourcePoolInput): Promise<{
|
|
121
121
|
id: string;
|
|
122
122
|
productId: string | null;
|
|
123
|
-
kind: "guide" | "vehicle" | "room" | "boat" | "equipment"
|
|
123
|
+
kind: "other" | "guide" | "vehicle" | "room" | "boat" | "equipment";
|
|
124
124
|
name: string;
|
|
125
125
|
sharedCapacity: number | null;
|
|
126
126
|
active: boolean;
|
|
@@ -294,12 +294,12 @@ export declare const resourcesService: {
|
|
|
294
294
|
} | null>;
|
|
295
295
|
createSlotAssignment(db: PostgresJsDatabase, data: CreateResourceSlotAssignmentInput): Promise<{
|
|
296
296
|
id: string;
|
|
297
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
297
298
|
notes: string | null;
|
|
298
299
|
poolId: string | null;
|
|
299
300
|
resourceId: string | null;
|
|
300
301
|
slotId: string;
|
|
301
302
|
bookingId: string | null;
|
|
302
|
-
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
303
303
|
assignedAt: Date;
|
|
304
304
|
assignedBy: string | null;
|
|
305
305
|
releasedAt: Date | null;
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const resourceKindSchema: z.ZodEnum<{
|
|
3
|
+
other: "other";
|
|
3
4
|
guide: "guide";
|
|
4
5
|
vehicle: "vehicle";
|
|
5
6
|
room: "room";
|
|
6
7
|
boat: "boat";
|
|
7
8
|
equipment: "equipment";
|
|
8
|
-
other: "other";
|
|
9
9
|
}>;
|
|
10
10
|
export declare const resourceAllocationModeSchema: z.ZodEnum<{
|
|
11
11
|
shared: "shared";
|
|
@@ -22,12 +22,12 @@ export declare const resourceCoreSchema: z.ZodObject<{
|
|
|
22
22
|
supplierId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
23
|
facilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
24
|
kind: z.ZodEnum<{
|
|
25
|
+
other: "other";
|
|
25
26
|
guide: "guide";
|
|
26
27
|
vehicle: "vehicle";
|
|
27
28
|
room: "room";
|
|
28
29
|
boat: "boat";
|
|
29
30
|
equipment: "equipment";
|
|
30
|
-
other: "other";
|
|
31
31
|
}>;
|
|
32
32
|
name: z.ZodString;
|
|
33
33
|
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -39,12 +39,12 @@ export declare const insertResourceSchema: z.ZodObject<{
|
|
|
39
39
|
supplierId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
40
|
facilityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
41
|
kind: z.ZodEnum<{
|
|
42
|
+
other: "other";
|
|
42
43
|
guide: "guide";
|
|
43
44
|
vehicle: "vehicle";
|
|
44
45
|
room: "room";
|
|
45
46
|
boat: "boat";
|
|
46
47
|
equipment: "equipment";
|
|
47
|
-
other: "other";
|
|
48
48
|
}>;
|
|
49
49
|
name: z.ZodString;
|
|
50
50
|
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -56,12 +56,12 @@ export declare const updateResourceSchema: z.ZodObject<{
|
|
|
56
56
|
supplierId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
57
57
|
facilityId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
58
58
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
other: "other";
|
|
59
60
|
guide: "guide";
|
|
60
61
|
vehicle: "vehicle";
|
|
61
62
|
room: "room";
|
|
62
63
|
boat: "boat";
|
|
63
64
|
equipment: "equipment";
|
|
64
|
-
other: "other";
|
|
65
65
|
}>>;
|
|
66
66
|
name: z.ZodOptional<z.ZodString>;
|
|
67
67
|
code: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
@@ -75,12 +75,12 @@ export declare const resourceListQuerySchema: z.ZodObject<{
|
|
|
75
75
|
supplierId: z.ZodOptional<z.ZodString>;
|
|
76
76
|
facilityId: z.ZodOptional<z.ZodString>;
|
|
77
77
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
other: "other";
|
|
78
79
|
guide: "guide";
|
|
79
80
|
vehicle: "vehicle";
|
|
80
81
|
room: "room";
|
|
81
82
|
boat: "boat";
|
|
82
83
|
equipment: "equipment";
|
|
83
|
-
other: "other";
|
|
84
84
|
}>>;
|
|
85
85
|
active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
86
86
|
0: "0";
|
|
@@ -92,12 +92,12 @@ export declare const resourceListQuerySchema: z.ZodObject<{
|
|
|
92
92
|
export declare const resourcePoolCoreSchema: z.ZodObject<{
|
|
93
93
|
productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
94
|
kind: z.ZodEnum<{
|
|
95
|
+
other: "other";
|
|
95
96
|
guide: "guide";
|
|
96
97
|
vehicle: "vehicle";
|
|
97
98
|
room: "room";
|
|
98
99
|
boat: "boat";
|
|
99
100
|
equipment: "equipment";
|
|
100
|
-
other: "other";
|
|
101
101
|
}>;
|
|
102
102
|
name: z.ZodString;
|
|
103
103
|
sharedCapacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -107,12 +107,12 @@ export declare const resourcePoolCoreSchema: z.ZodObject<{
|
|
|
107
107
|
export declare const insertResourcePoolSchema: z.ZodObject<{
|
|
108
108
|
productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
109
|
kind: z.ZodEnum<{
|
|
110
|
+
other: "other";
|
|
110
111
|
guide: "guide";
|
|
111
112
|
vehicle: "vehicle";
|
|
112
113
|
room: "room";
|
|
113
114
|
boat: "boat";
|
|
114
115
|
equipment: "equipment";
|
|
115
|
-
other: "other";
|
|
116
116
|
}>;
|
|
117
117
|
name: z.ZodString;
|
|
118
118
|
sharedCapacity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -122,12 +122,12 @@ export declare const insertResourcePoolSchema: z.ZodObject<{
|
|
|
122
122
|
export declare const updateResourcePoolSchema: z.ZodObject<{
|
|
123
123
|
productId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
124
124
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
125
|
+
other: "other";
|
|
125
126
|
guide: "guide";
|
|
126
127
|
vehicle: "vehicle";
|
|
127
128
|
room: "room";
|
|
128
129
|
boat: "boat";
|
|
129
130
|
equipment: "equipment";
|
|
130
|
-
other: "other";
|
|
131
131
|
}>>;
|
|
132
132
|
name: z.ZodOptional<z.ZodString>;
|
|
133
133
|
sharedCapacity: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
@@ -139,12 +139,12 @@ export declare const resourcePoolListQuerySchema: z.ZodObject<{
|
|
|
139
139
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
140
140
|
productId: z.ZodOptional<z.ZodString>;
|
|
141
141
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
other: "other";
|
|
142
143
|
guide: "guide";
|
|
143
144
|
vehicle: "vehicle";
|
|
144
145
|
room: "room";
|
|
145
146
|
boat: "boat";
|
|
146
147
|
equipment: "equipment";
|
|
147
|
-
other: "other";
|
|
148
148
|
}>>;
|
|
149
149
|
active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
150
150
|
0: "0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/resources",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"drizzle-orm": "^0.45.2",
|
|
26
26
|
"hono": "^4.12.10",
|
|
27
27
|
"zod": "^4.3.6",
|
|
28
|
-
"@voyantjs/core": "0.
|
|
29
|
-
"@voyantjs/db": "0.
|
|
30
|
-
"@voyantjs/hono": "0.
|
|
28
|
+
"@voyantjs/core": "0.6.0",
|
|
29
|
+
"@voyantjs/db": "0.6.0",
|
|
30
|
+
"@voyantjs/hono": "0.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^6.0.2",
|
|
34
|
-
"@voyantjs/availability": "0.
|
|
35
|
-
"@voyantjs/products": "0.
|
|
34
|
+
"@voyantjs/availability": "0.6.0",
|
|
35
|
+
"@voyantjs/products": "0.6.0",
|
|
36
36
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|