@voyantjs/hospitality 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.
@@ -46,16 +46,16 @@ export declare const hospitalityAccommodationRoutes: import("hono/hono-base").Ho
46
46
  input: {};
47
47
  output: {
48
48
  data: {
49
+ metadata: {
50
+ [x: string]: import("hono/utils/types").JSONValue;
51
+ } | null;
49
52
  id: string;
50
53
  name: string;
51
54
  createdAt: string;
52
55
  updatedAt: string;
53
- metadata: {
54
- [x: string]: import("hono/utils/types").JSONValue;
55
- } | null;
56
56
  description: string | null;
57
- active: boolean;
58
57
  code: string | null;
58
+ active: boolean;
59
59
  sortOrder: number;
60
60
  propertyId: string;
61
61
  inventoryMode: "virtual" | "pooled" | "serialized";
@@ -242,8 +242,8 @@ export declare const hospitalityAccommodationRoutes: import("hono/hono-base").Ho
242
242
  id: string;
243
243
  createdAt: string;
244
244
  updatedAt: string;
245
- isPrimary: boolean;
246
245
  notes: string | null;
246
+ isPrimary: boolean;
247
247
  quantity: number;
248
248
  roomTypeId: string;
249
249
  bedType: string;
@@ -387,14 +387,14 @@ export declare const hospitalityAccommodationRoutes: import("hono/hono-base").Ho
387
387
  input: {};
388
388
  output: {
389
389
  data: {
390
+ metadata: {
391
+ [x: string]: import("hono/utils/types").JSONValue;
392
+ } | null;
390
393
  id: string;
391
- status: "active" | "inactive" | "archived" | "out_of_order";
392
394
  createdAt: string;
393
395
  updatedAt: string;
396
+ status: "active" | "inactive" | "archived" | "out_of_order";
394
397
  notes: string | null;
395
- metadata: {
396
- [x: string]: import("hono/utils/types").JSONValue;
397
- } | null;
398
398
  code: string | null;
399
399
  propertyId: string;
400
400
  roomTypeId: string;
@@ -561,16 +561,16 @@ export declare const hospitalityAccommodationRoutes: import("hono/hono-base").Ho
561
561
  input: {};
562
562
  output: {
563
563
  data: {
564
+ metadata: {
565
+ [x: string]: import("hono/utils/types").JSONValue;
566
+ } | null;
564
567
  id: string;
565
568
  name: string;
566
569
  createdAt: string;
567
570
  updatedAt: string;
568
- metadata: {
569
- [x: string]: import("hono/utils/types").JSONValue;
570
- } | null;
571
571
  description: string | null;
572
- active: boolean;
573
572
  code: string;
573
+ active: boolean;
574
574
  sortOrder: number;
575
575
  propertyId: string;
576
576
  includesBreakfast: boolean;
@@ -737,16 +737,16 @@ export declare const hospitalityAccommodationRoutes: import("hono/hono-base").Ho
737
737
  input: {};
738
738
  output: {
739
739
  data: {
740
+ metadata: {
741
+ [x: string]: import("hono/utils/types").JSONValue;
742
+ } | null;
740
743
  id: string;
741
744
  name: string;
742
745
  createdAt: string;
743
746
  updatedAt: string;
744
- metadata: {
745
- [x: string]: import("hono/utils/types").JSONValue;
746
- } | null;
747
747
  description: string | null;
748
- active: boolean;
749
748
  code: string;
749
+ active: boolean;
750
750
  sortOrder: number;
751
751
  propertyId: string;
752
752
  mealPlanId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-accommodation.d.ts","sourceRoot":"","sources":["../src/routes-accommodation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AA2B7C,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA8OvC,CAAA"}
@@ -1,15 +1,16 @@
1
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { notFound } from "./routes-shared.js";
3
4
  import { hospitalityService } from "./service.js";
4
5
  import { insertMealPlanSchema, insertRatePlanRoomTypeSchema, insertRatePlanSchema, insertRoomTypeBedConfigSchema, insertRoomTypeRateSchema, insertRoomTypeSchema, insertRoomUnitSchema, mealPlanListQuerySchema, ratePlanListQuerySchema, ratePlanRoomTypeListQuerySchema, roomTypeBedConfigListQuerySchema, roomTypeListQuerySchema, roomTypeRateListQuerySchema, roomUnitListQuerySchema, updateMealPlanSchema, updateRatePlanRoomTypeSchema, updateRatePlanSchema, updateRoomTypeBedConfigSchema, updateRoomTypeRateSchema, updateRoomTypeSchema, updateRoomUnitSchema, } from "./validation.js";
5
6
  export const hospitalityAccommodationRoutes = new Hono()
6
7
  .get("/room-types", async (c) => {
7
- const query = roomTypeListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
8
+ const query = await parseQuery(c, roomTypeListQuerySchema);
8
9
  return c.json(await hospitalityService.listRoomTypes(c.get("db"), query));
9
10
  })
10
11
  .post("/room-types", async (c) => {
11
12
  return c.json({
12
- data: await hospitalityService.createRoomType(c.get("db"), insertRoomTypeSchema.parse(await c.req.json())),
13
+ data: await hospitalityService.createRoomType(c.get("db"), await parseJsonBody(c, insertRoomTypeSchema)),
13
14
  }, 201);
14
15
  })
15
16
  .get("/room-types/:id", async (c) => {
@@ -19,7 +20,7 @@ export const hospitalityAccommodationRoutes = new Hono()
19
20
  return c.json({ data: row });
20
21
  })
21
22
  .patch("/room-types/:id", async (c) => {
22
- const row = await hospitalityService.updateRoomType(c.get("db"), c.req.param("id"), updateRoomTypeSchema.parse(await c.req.json()));
23
+ const row = await hospitalityService.updateRoomType(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomTypeSchema));
23
24
  if (!row)
24
25
  return c.json(notFound("Room type"), 404);
25
26
  return c.json({ data: row });
@@ -31,12 +32,12 @@ export const hospitalityAccommodationRoutes = new Hono()
31
32
  return c.json({ success: true });
32
33
  })
33
34
  .get("/room-type-bed-configs", async (c) => {
34
- const query = roomTypeBedConfigListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
35
+ const query = await parseQuery(c, roomTypeBedConfigListQuerySchema);
35
36
  return c.json(await hospitalityService.listRoomTypeBedConfigs(c.get("db"), query));
36
37
  })
37
38
  .post("/room-type-bed-configs", async (c) => {
38
39
  return c.json({
39
- data: await hospitalityService.createRoomTypeBedConfig(c.get("db"), insertRoomTypeBedConfigSchema.parse(await c.req.json())),
40
+ data: await hospitalityService.createRoomTypeBedConfig(c.get("db"), await parseJsonBody(c, insertRoomTypeBedConfigSchema)),
40
41
  }, 201);
41
42
  })
42
43
  .get("/room-type-bed-configs/:id", async (c) => {
@@ -46,7 +47,7 @@ export const hospitalityAccommodationRoutes = new Hono()
46
47
  return c.json({ data: row });
47
48
  })
48
49
  .patch("/room-type-bed-configs/:id", async (c) => {
49
- const row = await hospitalityService.updateRoomTypeBedConfig(c.get("db"), c.req.param("id"), updateRoomTypeBedConfigSchema.parse(await c.req.json()));
50
+ const row = await hospitalityService.updateRoomTypeBedConfig(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomTypeBedConfigSchema));
50
51
  if (!row)
51
52
  return c.json(notFound("Room type bed config"), 404);
52
53
  return c.json({ data: row });
@@ -58,12 +59,12 @@ export const hospitalityAccommodationRoutes = new Hono()
58
59
  return c.json({ success: true });
59
60
  })
60
61
  .get("/room-units", async (c) => {
61
- const query = roomUnitListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
62
+ const query = await parseQuery(c, roomUnitListQuerySchema);
62
63
  return c.json(await hospitalityService.listRoomUnits(c.get("db"), query));
63
64
  })
64
65
  .post("/room-units", async (c) => {
65
66
  return c.json({
66
- data: await hospitalityService.createRoomUnit(c.get("db"), insertRoomUnitSchema.parse(await c.req.json())),
67
+ data: await hospitalityService.createRoomUnit(c.get("db"), await parseJsonBody(c, insertRoomUnitSchema)),
67
68
  }, 201);
68
69
  })
69
70
  .get("/room-units/:id", async (c) => {
@@ -73,7 +74,7 @@ export const hospitalityAccommodationRoutes = new Hono()
73
74
  return c.json({ data: row });
74
75
  })
75
76
  .patch("/room-units/:id", async (c) => {
76
- const row = await hospitalityService.updateRoomUnit(c.get("db"), c.req.param("id"), updateRoomUnitSchema.parse(await c.req.json()));
77
+ const row = await hospitalityService.updateRoomUnit(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomUnitSchema));
77
78
  if (!row)
78
79
  return c.json(notFound("Room unit"), 404);
79
80
  return c.json({ data: row });
@@ -85,12 +86,12 @@ export const hospitalityAccommodationRoutes = new Hono()
85
86
  return c.json({ success: true });
86
87
  })
87
88
  .get("/meal-plans", async (c) => {
88
- const query = mealPlanListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
89
+ const query = await parseQuery(c, mealPlanListQuerySchema);
89
90
  return c.json(await hospitalityService.listMealPlans(c.get("db"), query));
90
91
  })
91
92
  .post("/meal-plans", async (c) => {
92
93
  return c.json({
93
- data: await hospitalityService.createMealPlan(c.get("db"), insertMealPlanSchema.parse(await c.req.json())),
94
+ data: await hospitalityService.createMealPlan(c.get("db"), await parseJsonBody(c, insertMealPlanSchema)),
94
95
  }, 201);
95
96
  })
96
97
  .get("/meal-plans/:id", async (c) => {
@@ -100,7 +101,7 @@ export const hospitalityAccommodationRoutes = new Hono()
100
101
  return c.json({ data: row });
101
102
  })
102
103
  .patch("/meal-plans/:id", async (c) => {
103
- const row = await hospitalityService.updateMealPlan(c.get("db"), c.req.param("id"), updateMealPlanSchema.parse(await c.req.json()));
104
+ const row = await hospitalityService.updateMealPlan(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateMealPlanSchema));
104
105
  if (!row)
105
106
  return c.json(notFound("Meal plan"), 404);
106
107
  return c.json({ data: row });
@@ -112,12 +113,12 @@ export const hospitalityAccommodationRoutes = new Hono()
112
113
  return c.json({ success: true });
113
114
  })
114
115
  .get("/rate-plans", async (c) => {
115
- const query = ratePlanListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
116
+ const query = await parseQuery(c, ratePlanListQuerySchema);
116
117
  return c.json(await hospitalityService.listRatePlans(c.get("db"), query));
117
118
  })
118
119
  .post("/rate-plans", async (c) => {
119
120
  return c.json({
120
- data: await hospitalityService.createRatePlan(c.get("db"), insertRatePlanSchema.parse(await c.req.json())),
121
+ data: await hospitalityService.createRatePlan(c.get("db"), await parseJsonBody(c, insertRatePlanSchema)),
121
122
  }, 201);
122
123
  })
123
124
  .get("/rate-plans/:id", async (c) => {
@@ -127,7 +128,7 @@ export const hospitalityAccommodationRoutes = new Hono()
127
128
  return c.json({ data: row });
128
129
  })
129
130
  .patch("/rate-plans/:id", async (c) => {
130
- const row = await hospitalityService.updateRatePlan(c.get("db"), c.req.param("id"), updateRatePlanSchema.parse(await c.req.json()));
131
+ const row = await hospitalityService.updateRatePlan(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRatePlanSchema));
131
132
  if (!row)
132
133
  return c.json(notFound("Rate plan"), 404);
133
134
  return c.json({ data: row });
@@ -139,12 +140,12 @@ export const hospitalityAccommodationRoutes = new Hono()
139
140
  return c.json({ success: true });
140
141
  })
141
142
  .get("/rate-plan-room-types", async (c) => {
142
- const query = ratePlanRoomTypeListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
143
+ const query = await parseQuery(c, ratePlanRoomTypeListQuerySchema);
143
144
  return c.json(await hospitalityService.listRatePlanRoomTypes(c.get("db"), query));
144
145
  })
145
146
  .post("/rate-plan-room-types", async (c) => {
146
147
  return c.json({
147
- data: await hospitalityService.createRatePlanRoomType(c.get("db"), insertRatePlanRoomTypeSchema.parse(await c.req.json())),
148
+ data: await hospitalityService.createRatePlanRoomType(c.get("db"), await parseJsonBody(c, insertRatePlanRoomTypeSchema)),
148
149
  }, 201);
149
150
  })
150
151
  .get("/rate-plan-room-types/:id", async (c) => {
@@ -154,7 +155,7 @@ export const hospitalityAccommodationRoutes = new Hono()
154
155
  return c.json({ data: row });
155
156
  })
156
157
  .patch("/rate-plan-room-types/:id", async (c) => {
157
- const row = await hospitalityService.updateRatePlanRoomType(c.get("db"), c.req.param("id"), updateRatePlanRoomTypeSchema.parse(await c.req.json()));
158
+ const row = await hospitalityService.updateRatePlanRoomType(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRatePlanRoomTypeSchema));
158
159
  if (!row)
159
160
  return c.json(notFound("Rate plan room type"), 404);
160
161
  return c.json({ data: row });
@@ -166,12 +167,12 @@ export const hospitalityAccommodationRoutes = new Hono()
166
167
  return c.json({ success: true });
167
168
  })
168
169
  .get("/room-type-rates", async (c) => {
169
- const query = roomTypeRateListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
170
+ const query = await parseQuery(c, roomTypeRateListQuerySchema);
170
171
  return c.json(await hospitalityService.listRoomTypeRates(c.get("db"), query));
171
172
  })
172
173
  .post("/room-type-rates", async (c) => {
173
174
  return c.json({
174
- data: await hospitalityService.createRoomTypeRate(c.get("db"), insertRoomTypeRateSchema.parse(await c.req.json())),
175
+ data: await hospitalityService.createRoomTypeRate(c.get("db"), await parseJsonBody(c, insertRoomTypeRateSchema)),
175
176
  }, 201);
176
177
  })
177
178
  .get("/room-type-rates/:id", async (c) => {
@@ -181,7 +182,7 @@ export const hospitalityAccommodationRoutes = new Hono()
181
182
  return c.json({ data: row });
182
183
  })
183
184
  .patch("/room-type-rates/:id", async (c) => {
184
- const row = await hospitalityService.updateRoomTypeRate(c.get("db"), c.req.param("id"), updateRoomTypeRateSchema.parse(await c.req.json()));
185
+ const row = await hospitalityService.updateRoomTypeRate(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomTypeRateSchema));
185
186
  if (!row)
186
187
  return c.json(notFound("Room type rate"), 404);
187
188
  return c.json({ data: row });
@@ -34,8 +34,8 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
34
34
  input: {};
35
35
  output: {
36
36
  data: {
37
- id: string;
38
37
  date: string;
38
+ id: string;
39
39
  createdAt: string;
40
40
  updatedAt: string;
41
41
  notes: string | null;
@@ -195,8 +195,8 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
195
195
  input: {};
196
196
  output: {
197
197
  data: {
198
- id: string;
199
198
  date: string;
199
+ id: string;
200
200
  createdAt: string;
201
201
  updatedAt: string;
202
202
  notes: string | null;
@@ -354,14 +354,14 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
354
354
  input: {};
355
355
  output: {
356
356
  data: {
357
+ metadata: {
358
+ [x: string]: import("hono/utils/types").JSONValue;
359
+ } | null;
357
360
  id: string;
358
- status: "draft" | "confirmed" | "cancelled" | "held" | "released";
359
361
  createdAt: string;
360
362
  updatedAt: string;
363
+ status: "draft" | "confirmed" | "cancelled" | "held" | "released";
361
364
  notes: string | null;
362
- metadata: {
363
- [x: string]: import("hono/utils/types").JSONValue;
364
- } | null;
365
365
  quantity: number;
366
366
  propertyId: string;
367
367
  roomTypeId: string | null;
@@ -520,12 +520,12 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
520
520
  input: {};
521
521
  output: {
522
522
  data: {
523
- id: string;
524
- createdAt: string;
525
- notes: string | null;
526
523
  metadata: {
527
524
  [x: string]: import("hono/utils/types").JSONValue;
528
525
  } | null;
526
+ id: string;
527
+ createdAt: string;
528
+ notes: string | null;
529
529
  roomUnitId: string;
530
530
  statusCode: string;
531
531
  housekeepingStatus: string | null;
@@ -674,15 +674,15 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
674
674
  input: {};
675
675
  output: {
676
676
  data: {
677
+ metadata: {
678
+ [x: string]: import("hono/utils/types").JSONValue;
679
+ } | null;
677
680
  id: string;
678
- status: "in_progress" | "cancelled" | "open" | "resolved";
679
681
  createdAt: string;
680
682
  updatedAt: string;
683
+ status: "in_progress" | "cancelled" | "open" | "resolved";
681
684
  notes: string | null;
682
685
  reason: string | null;
683
- metadata: {
684
- [x: string]: import("hono/utils/types").JSONValue;
685
- } | null;
686
686
  propertyId: string;
687
687
  roomTypeId: string | null;
688
688
  roomUnitId: string | null;
@@ -840,15 +840,15 @@ export declare const hospitalityInventoryRoutes: import("hono/hono-base").HonoBa
840
840
  input: {};
841
841
  output: {
842
842
  data: {
843
+ metadata: {
844
+ [x: string]: import("hono/utils/types").JSONValue;
845
+ } | null;
843
846
  id: string;
844
- status: "in_progress" | "completed" | "cancelled" | "open";
845
- completedAt: string | null;
846
847
  createdAt: string;
847
848
  updatedAt: string;
849
+ status: "in_progress" | "completed" | "cancelled" | "open";
848
850
  notes: string | null;
849
- metadata: {
850
- [x: string]: import("hono/utils/types").JSONValue;
851
- } | null;
851
+ completedAt: string | null;
852
852
  propertyId: string;
853
853
  roomUnitId: string;
854
854
  stayBookingItemId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-inventory.d.ts","sourceRoot":"","sources":["../src/routes-inventory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAwB7C,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAkNnC,CAAA"}
@@ -1,15 +1,16 @@
1
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { notFound } from "./routes-shared.js";
3
4
  import { hospitalityService } from "./service.js";
4
5
  import { housekeepingTaskListQuerySchema, insertHousekeepingTaskSchema, insertMaintenanceBlockSchema, insertRatePlanInventoryOverrideSchema, insertRoomBlockSchema, insertRoomInventorySchema, insertRoomUnitStatusEventSchema, maintenanceBlockListQuerySchema, ratePlanInventoryOverrideListQuerySchema, roomBlockListQuerySchema, roomInventoryListQuerySchema, roomUnitStatusEventListQuerySchema, updateHousekeepingTaskSchema, updateMaintenanceBlockSchema, updateRatePlanInventoryOverrideSchema, updateRoomBlockSchema, updateRoomInventorySchema, updateRoomUnitStatusEventSchema, } from "./validation.js";
5
6
  export const hospitalityInventoryRoutes = new Hono()
6
7
  .get("/room-inventory", async (c) => {
7
- const query = roomInventoryListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
8
+ const query = await parseQuery(c, roomInventoryListQuerySchema);
8
9
  return c.json(await hospitalityService.listRoomInventory(c.get("db"), query));
9
10
  })
10
11
  .post("/room-inventory", async (c) => {
11
12
  return c.json({
12
- data: await hospitalityService.createRoomInventory(c.get("db"), insertRoomInventorySchema.parse(await c.req.json())),
13
+ data: await hospitalityService.createRoomInventory(c.get("db"), await parseJsonBody(c, insertRoomInventorySchema)),
13
14
  }, 201);
14
15
  })
15
16
  .get("/room-inventory/:id", async (c) => {
@@ -19,7 +20,7 @@ export const hospitalityInventoryRoutes = new Hono()
19
20
  return c.json({ data: row });
20
21
  })
21
22
  .patch("/room-inventory/:id", async (c) => {
22
- const row = await hospitalityService.updateRoomInventory(c.get("db"), c.req.param("id"), updateRoomInventorySchema.parse(await c.req.json()));
23
+ const row = await hospitalityService.updateRoomInventory(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomInventorySchema));
23
24
  if (!row)
24
25
  return c.json(notFound("Room inventory"), 404);
25
26
  return c.json({ data: row });
@@ -31,12 +32,12 @@ export const hospitalityInventoryRoutes = new Hono()
31
32
  return c.json({ success: true });
32
33
  })
33
34
  .get("/rate-plan-inventory-overrides", async (c) => {
34
- const query = ratePlanInventoryOverrideListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
35
+ const query = await parseQuery(c, ratePlanInventoryOverrideListQuerySchema);
35
36
  return c.json(await hospitalityService.listRatePlanInventoryOverrides(c.get("db"), query));
36
37
  })
37
38
  .post("/rate-plan-inventory-overrides", async (c) => {
38
39
  return c.json({
39
- data: await hospitalityService.createRatePlanInventoryOverride(c.get("db"), insertRatePlanInventoryOverrideSchema.parse(await c.req.json())),
40
+ data: await hospitalityService.createRatePlanInventoryOverride(c.get("db"), await parseJsonBody(c, insertRatePlanInventoryOverrideSchema)),
40
41
  }, 201);
41
42
  })
42
43
  .get("/rate-plan-inventory-overrides/:id", async (c) => {
@@ -46,7 +47,7 @@ export const hospitalityInventoryRoutes = new Hono()
46
47
  return c.json({ data: row });
47
48
  })
48
49
  .patch("/rate-plan-inventory-overrides/:id", async (c) => {
49
- const row = await hospitalityService.updateRatePlanInventoryOverride(c.get("db"), c.req.param("id"), updateRatePlanInventoryOverrideSchema.parse(await c.req.json()));
50
+ const row = await hospitalityService.updateRatePlanInventoryOverride(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRatePlanInventoryOverrideSchema));
50
51
  if (!row)
51
52
  return c.json(notFound("Rate plan inventory override"), 404);
52
53
  return c.json({ data: row });
@@ -58,11 +59,11 @@ export const hospitalityInventoryRoutes = new Hono()
58
59
  return c.json({ success: true });
59
60
  })
60
61
  .get("/room-blocks", async (c) => {
61
- const query = roomBlockListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
62
+ const query = await parseQuery(c, roomBlockListQuerySchema);
62
63
  return c.json(await hospitalityService.listRoomBlocks(c.get("db"), query));
63
64
  })
64
65
  .post("/room-blocks", async (c) => c.json({
65
- data: await hospitalityService.createRoomBlock(c.get("db"), insertRoomBlockSchema.parse(await c.req.json())),
66
+ data: await hospitalityService.createRoomBlock(c.get("db"), await parseJsonBody(c, insertRoomBlockSchema)),
66
67
  }, 201))
67
68
  .get("/room-blocks/:id", async (c) => {
68
69
  const row = await hospitalityService.getRoomBlockById(c.get("db"), c.req.param("id"));
@@ -71,7 +72,7 @@ export const hospitalityInventoryRoutes = new Hono()
71
72
  return c.json({ data: row });
72
73
  })
73
74
  .patch("/room-blocks/:id", async (c) => {
74
- const row = await hospitalityService.updateRoomBlock(c.get("db"), c.req.param("id"), updateRoomBlockSchema.parse(await c.req.json()));
75
+ const row = await hospitalityService.updateRoomBlock(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomBlockSchema));
75
76
  if (!row)
76
77
  return c.json(notFound("Room block"), 404);
77
78
  return c.json({ data: row });
@@ -83,11 +84,11 @@ export const hospitalityInventoryRoutes = new Hono()
83
84
  return c.json({ success: true });
84
85
  })
85
86
  .get("/room-unit-status-events", async (c) => {
86
- const query = roomUnitStatusEventListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
87
+ const query = await parseQuery(c, roomUnitStatusEventListQuerySchema);
87
88
  return c.json(await hospitalityService.listRoomUnitStatusEvents(c.get("db"), query));
88
89
  })
89
90
  .post("/room-unit-status-events", async (c) => c.json({
90
- data: await hospitalityService.createRoomUnitStatusEvent(c.get("db"), insertRoomUnitStatusEventSchema.parse(await c.req.json())),
91
+ data: await hospitalityService.createRoomUnitStatusEvent(c.get("db"), await parseJsonBody(c, insertRoomUnitStatusEventSchema)),
91
92
  }, 201))
92
93
  .get("/room-unit-status-events/:id", async (c) => {
93
94
  const row = await hospitalityService.getRoomUnitStatusEventById(c.get("db"), c.req.param("id"));
@@ -96,7 +97,7 @@ export const hospitalityInventoryRoutes = new Hono()
96
97
  return c.json({ data: row });
97
98
  })
98
99
  .patch("/room-unit-status-events/:id", async (c) => {
99
- const row = await hospitalityService.updateRoomUnitStatusEvent(c.get("db"), c.req.param("id"), updateRoomUnitStatusEventSchema.parse(await c.req.json()));
100
+ const row = await hospitalityService.updateRoomUnitStatusEvent(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateRoomUnitStatusEventSchema));
100
101
  if (!row)
101
102
  return c.json(notFound("Room unit status event"), 404);
102
103
  return c.json({ data: row });
@@ -108,11 +109,11 @@ export const hospitalityInventoryRoutes = new Hono()
108
109
  return c.json({ success: true });
109
110
  })
110
111
  .get("/maintenance-blocks", async (c) => {
111
- const query = maintenanceBlockListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
112
+ const query = await parseQuery(c, maintenanceBlockListQuerySchema);
112
113
  return c.json(await hospitalityService.listMaintenanceBlocks(c.get("db"), query));
113
114
  })
114
115
  .post("/maintenance-blocks", async (c) => c.json({
115
- data: await hospitalityService.createMaintenanceBlock(c.get("db"), insertMaintenanceBlockSchema.parse(await c.req.json())),
116
+ data: await hospitalityService.createMaintenanceBlock(c.get("db"), await parseJsonBody(c, insertMaintenanceBlockSchema)),
116
117
  }, 201))
117
118
  .get("/maintenance-blocks/:id", async (c) => {
118
119
  const row = await hospitalityService.getMaintenanceBlockById(c.get("db"), c.req.param("id"));
@@ -121,7 +122,7 @@ export const hospitalityInventoryRoutes = new Hono()
121
122
  return c.json({ data: row });
122
123
  })
123
124
  .patch("/maintenance-blocks/:id", async (c) => {
124
- const row = await hospitalityService.updateMaintenanceBlock(c.get("db"), c.req.param("id"), updateMaintenanceBlockSchema.parse(await c.req.json()));
125
+ const row = await hospitalityService.updateMaintenanceBlock(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateMaintenanceBlockSchema));
125
126
  if (!row)
126
127
  return c.json(notFound("Maintenance block"), 404);
127
128
  return c.json({ data: row });
@@ -133,11 +134,11 @@ export const hospitalityInventoryRoutes = new Hono()
133
134
  return c.json({ success: true });
134
135
  })
135
136
  .get("/housekeeping-tasks", async (c) => {
136
- const query = housekeepingTaskListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
137
+ const query = await parseQuery(c, housekeepingTaskListQuerySchema);
137
138
  return c.json(await hospitalityService.listHousekeepingTasks(c.get("db"), query));
138
139
  })
139
140
  .post("/housekeeping-tasks", async (c) => c.json({
140
- data: await hospitalityService.createHousekeepingTask(c.get("db"), insertHousekeepingTaskSchema.parse(await c.req.json())),
141
+ data: await hospitalityService.createHousekeepingTask(c.get("db"), await parseJsonBody(c, insertHousekeepingTaskSchema)),
141
142
  }, 201))
142
143
  .get("/housekeeping-tasks/:id", async (c) => {
143
144
  const row = await hospitalityService.getHousekeepingTaskById(c.get("db"), c.req.param("id"));
@@ -146,7 +147,7 @@ export const hospitalityInventoryRoutes = new Hono()
146
147
  return c.json({ data: row });
147
148
  })
148
149
  .patch("/housekeeping-tasks/:id", async (c) => {
149
- const row = await hospitalityService.updateHousekeepingTask(c.get("db"), c.req.param("id"), updateHousekeepingTaskSchema.parse(await c.req.json()));
150
+ const row = await hospitalityService.updateHousekeepingTask(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateHousekeepingTaskSchema));
150
151
  if (!row)
151
152
  return c.json(notFound("Housekeeping task"), 404);
152
153
  return c.json({ data: row });