@voyantjs/booking-requirements 0.5.0 → 0.6.2

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.
@@ -33,15 +33,15 @@ export declare const publicBookingRequirementsRoutes: import("hono/hono-base").H
33
33
  requiresPassport: boolean;
34
34
  requiresNationality: boolean;
35
35
  requiresDateOfBirth: boolean;
36
- requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
36
+ requiredFields: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
37
37
  fieldsByScope: {
38
- booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
39
- lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
40
- participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
41
- booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
38
+ booking: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
39
+ lead_traveler: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
40
+ participant: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
41
+ booker: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
42
42
  };
43
43
  requirements: {
44
- fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
44
+ fieldKey: "nationality" | "date_of_birth" | "passport_number" | "passport_expiry";
45
45
  scope: "booking" | "lead_traveler" | "participant" | "booker";
46
46
  isRequired: boolean;
47
47
  perParticipant: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAmB3C,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,OAAO,+BAA+B,CAAA"}
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAiB3C,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,OAAO,+BAA+B,CAAA"}
@@ -1,8 +1,9 @@
1
+ import { parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { bookingRequirementsService } from "./service.js";
3
4
  import { publicTransportRequirementsQuerySchema } from "./validation.js";
4
5
  export const publicBookingRequirementsRoutes = new Hono().get("/products/:productId/transport-requirements", async (c) => {
5
- const query = publicTransportRequirementsQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
6
+ const query = await parseQuery(c, publicTransportRequirementsQuerySchema);
6
7
  const result = await bookingRequirementsService.getPublicTransportRequirements(c.get("db"), c.req.param("productId"), query);
7
8
  if (!result) {
8
9
  return c.json({ error: "Product not found" }, 404);
package/dist/routes.d.ts CHANGED
@@ -14,7 +14,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
14
14
  id: string;
15
15
  productId: string;
16
16
  optionId: string | null;
17
- fieldKey: "first_name" | "last_name" | "email" | "phone" | "date_of_birth" | "nationality" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address" | "other";
17
+ fieldKey: "email" | "other" | "nationality" | "first_name" | "last_name" | "phone" | "date_of_birth" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address";
18
18
  scope: "booking" | "lead_traveler" | "participant" | "booker";
19
19
  isRequired: boolean;
20
20
  perParticipant: boolean;
@@ -39,17 +39,17 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
39
39
  output: {
40
40
  data: {
41
41
  id: string;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ scope: "booking" | "lead_traveler" | "participant" | "booker";
45
+ notes: string | null;
42
46
  productId: string;
43
47
  optionId: string | null;
44
- fieldKey: "first_name" | "last_name" | "email" | "phone" | "date_of_birth" | "nationality" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address" | "other";
45
- scope: "booking" | "lead_traveler" | "participant" | "booker";
48
+ fieldKey: "email" | "other" | "nationality" | "first_name" | "last_name" | "phone" | "date_of_birth" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address";
46
49
  isRequired: boolean;
47
50
  perParticipant: boolean;
48
51
  active: boolean;
49
52
  sortOrder: number;
50
- notes: string | null;
51
- createdAt: string;
52
- updatedAt: string;
53
53
  } | null;
54
54
  };
55
55
  outputFormat: "json";
@@ -80,7 +80,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
80
80
  id: string;
81
81
  productId: string;
82
82
  optionId: string | null;
83
- fieldKey: "first_name" | "last_name" | "email" | "phone" | "date_of_birth" | "nationality" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address" | "other";
83
+ fieldKey: "email" | "other" | "nationality" | "first_name" | "last_name" | "phone" | "date_of_birth" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address";
84
84
  scope: "booking" | "lead_traveler" | "participant" | "booker";
85
85
  isRequired: boolean;
86
86
  perParticipant: boolean;
@@ -119,7 +119,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
119
119
  id: string;
120
120
  productId: string;
121
121
  optionId: string | null;
122
- fieldKey: "first_name" | "last_name" | "email" | "phone" | "date_of_birth" | "nationality" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address" | "other";
122
+ fieldKey: "email" | "other" | "nationality" | "first_name" | "last_name" | "phone" | "date_of_birth" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address";
123
123
  scope: "booking" | "lead_traveler" | "participant" | "booker";
124
124
  isRequired: boolean;
125
125
  perParticipant: boolean;
@@ -171,8 +171,8 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
171
171
  code: string | null;
172
172
  label: string;
173
173
  description: string | null;
174
- target: "booking" | "lead_traveler" | "participant" | "booker" | "extra" | "service";
175
- fieldType: "number" | "boolean" | "email" | "phone" | "other" | "text" | "textarea" | "date" | "datetime" | "single_select" | "multi_select" | "file" | "country";
174
+ target: "service" | "booking" | "lead_traveler" | "participant" | "booker" | "extra";
175
+ fieldType: "number" | "boolean" | "date" | "email" | "other" | "file" | "text" | "phone" | "textarea" | "datetime" | "single_select" | "multi_select" | "country";
176
176
  placeholder: string | null;
177
177
  helpText: string | null;
178
178
  isRequired: boolean;
@@ -198,23 +198,23 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
198
198
  input: {};
199
199
  output: {
200
200
  data: {
201
+ metadata: {
202
+ [x: string]: import("hono/utils/types").JSONValue;
203
+ } | null;
201
204
  id: string;
205
+ createdAt: string;
206
+ updatedAt: string;
207
+ description: string | null;
208
+ code: string | null;
202
209
  productId: string;
203
210
  isRequired: boolean;
204
211
  active: boolean;
205
212
  sortOrder: number;
206
- createdAt: string;
207
- updatedAt: string;
208
- code: string | null;
209
213
  label: string;
210
- description: string | null;
211
- target: "booking" | "lead_traveler" | "participant" | "booker" | "extra" | "service";
212
- fieldType: "number" | "boolean" | "email" | "phone" | "other" | "text" | "textarea" | "date" | "datetime" | "single_select" | "multi_select" | "file" | "country";
214
+ target: "service" | "booking" | "lead_traveler" | "participant" | "booker" | "extra";
215
+ fieldType: "number" | "boolean" | "date" | "email" | "other" | "file" | "text" | "phone" | "textarea" | "datetime" | "single_select" | "multi_select" | "country";
213
216
  placeholder: string | null;
214
217
  helpText: string | null;
215
- metadata: {
216
- [x: string]: import("hono/utils/types").JSONValue;
217
- } | null;
218
218
  } | null;
219
219
  };
220
220
  outputFormat: "json";
@@ -247,8 +247,8 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
247
247
  code: string | null;
248
248
  label: string;
249
249
  description: string | null;
250
- target: "booking" | "lead_traveler" | "participant" | "booker" | "extra" | "service";
251
- fieldType: "number" | "boolean" | "email" | "phone" | "other" | "text" | "textarea" | "date" | "datetime" | "single_select" | "multi_select" | "file" | "country";
250
+ target: "service" | "booking" | "lead_traveler" | "participant" | "booker" | "extra";
251
+ fieldType: "number" | "boolean" | "date" | "email" | "other" | "file" | "text" | "phone" | "textarea" | "datetime" | "single_select" | "multi_select" | "country";
252
252
  placeholder: string | null;
253
253
  helpText: string | null;
254
254
  isRequired: boolean;
@@ -291,8 +291,8 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
291
291
  code: string | null;
292
292
  label: string;
293
293
  description: string | null;
294
- target: "booking" | "lead_traveler" | "participant" | "booker" | "extra" | "service";
295
- fieldType: "number" | "boolean" | "email" | "phone" | "other" | "text" | "textarea" | "date" | "datetime" | "single_select" | "multi_select" | "file" | "country";
294
+ target: "service" | "booking" | "lead_traveler" | "participant" | "booker" | "extra";
295
+ fieldType: "number" | "boolean" | "date" | "email" | "other" | "file" | "text" | "phone" | "textarea" | "datetime" | "single_select" | "multi_select" | "country";
296
296
  placeholder: string | null;
297
297
  helpText: string | null;
298
298
  isRequired: boolean;
@@ -366,12 +366,12 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
366
366
  output: {
367
367
  data: {
368
368
  id: string;
369
+ createdAt: string;
370
+ updatedAt: string;
371
+ notes: string | null;
369
372
  optionId: string;
370
373
  active: boolean;
371
374
  sortOrder: number;
372
- notes: string | null;
373
- createdAt: string;
374
- updatedAt: string;
375
375
  productBookingQuestionId: string;
376
376
  isRequiredOverride: boolean | null;
377
377
  } | null;
@@ -510,10 +510,10 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
510
510
  data: {
511
511
  value: string;
512
512
  id: string;
513
- active: boolean;
514
- sortOrder: number;
515
513
  createdAt: string;
516
514
  updatedAt: string;
515
+ active: boolean;
516
+ sortOrder: number;
517
517
  label: string;
518
518
  productBookingQuestionId: string;
519
519
  isDefault: boolean;
@@ -630,7 +630,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
630
630
  id: string;
631
631
  productBookingQuestionId: string;
632
632
  unitId: string;
633
- triggerMode: "required" | "optional" | "hidden";
633
+ triggerMode: "optional" | "required" | "hidden";
634
634
  minQuantity: number | null;
635
635
  active: boolean;
636
636
  createdAt: string;
@@ -651,12 +651,12 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
651
651
  output: {
652
652
  data: {
653
653
  id: string;
654
- active: boolean;
655
654
  createdAt: string;
656
655
  updatedAt: string;
656
+ active: boolean;
657
657
  productBookingQuestionId: string;
658
658
  unitId: string;
659
- triggerMode: "required" | "optional" | "hidden";
659
+ triggerMode: "optional" | "required" | "hidden";
660
660
  minQuantity: number | null;
661
661
  } | null;
662
662
  };
@@ -688,7 +688,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
688
688
  id: string;
689
689
  productBookingQuestionId: string;
690
690
  unitId: string;
691
- triggerMode: "required" | "optional" | "hidden";
691
+ triggerMode: "optional" | "required" | "hidden";
692
692
  minQuantity: number | null;
693
693
  active: boolean;
694
694
  createdAt: string;
@@ -723,7 +723,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
723
723
  id: string;
724
724
  productBookingQuestionId: string;
725
725
  unitId: string;
726
- triggerMode: "required" | "optional" | "hidden";
726
+ triggerMode: "optional" | "required" | "hidden";
727
727
  minQuantity: number | null;
728
728
  active: boolean;
729
729
  createdAt: string;
@@ -769,7 +769,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
769
769
  id: string;
770
770
  productBookingQuestionId: string;
771
771
  optionId: string;
772
- triggerMode: "required" | "optional" | "hidden";
772
+ triggerMode: "optional" | "required" | "hidden";
773
773
  active: boolean;
774
774
  createdAt: string;
775
775
  updatedAt: string;
@@ -789,12 +789,12 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
789
789
  output: {
790
790
  data: {
791
791
  id: string;
792
- optionId: string;
793
- active: boolean;
794
792
  createdAt: string;
795
793
  updatedAt: string;
794
+ optionId: string;
795
+ active: boolean;
796
796
  productBookingQuestionId: string;
797
- triggerMode: "required" | "optional" | "hidden";
797
+ triggerMode: "optional" | "required" | "hidden";
798
798
  } | null;
799
799
  };
800
800
  outputFormat: "json";
@@ -825,7 +825,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
825
825
  id: string;
826
826
  productBookingQuestionId: string;
827
827
  optionId: string;
828
- triggerMode: "required" | "optional" | "hidden";
828
+ triggerMode: "optional" | "required" | "hidden";
829
829
  active: boolean;
830
830
  createdAt: string;
831
831
  updatedAt: string;
@@ -859,7 +859,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
859
859
  id: string;
860
860
  productBookingQuestionId: string;
861
861
  optionId: string;
862
- triggerMode: "required" | "optional" | "hidden";
862
+ triggerMode: "optional" | "required" | "hidden";
863
863
  active: boolean;
864
864
  createdAt: string;
865
865
  updatedAt: string;
@@ -905,7 +905,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
905
905
  productBookingQuestionId: string;
906
906
  productExtraId: string | null;
907
907
  optionExtraConfigId: string | null;
908
- triggerMode: "required" | "optional" | "hidden";
908
+ triggerMode: "optional" | "required" | "hidden";
909
909
  minQuantity: number | null;
910
910
  active: boolean;
911
911
  createdAt: string;
@@ -926,11 +926,11 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
926
926
  output: {
927
927
  data: {
928
928
  id: string;
929
- active: boolean;
930
929
  createdAt: string;
931
930
  updatedAt: string;
931
+ active: boolean;
932
932
  productBookingQuestionId: string;
933
- triggerMode: "required" | "optional" | "hidden";
933
+ triggerMode: "optional" | "required" | "hidden";
934
934
  minQuantity: number | null;
935
935
  productExtraId: string | null;
936
936
  optionExtraConfigId: string | null;
@@ -965,7 +965,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
965
965
  productBookingQuestionId: string;
966
966
  productExtraId: string | null;
967
967
  optionExtraConfigId: string | null;
968
- triggerMode: "required" | "optional" | "hidden";
968
+ triggerMode: "optional" | "required" | "hidden";
969
969
  minQuantity: number | null;
970
970
  active: boolean;
971
971
  createdAt: string;
@@ -1001,7 +1001,7 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
1001
1001
  productBookingQuestionId: string;
1002
1002
  productExtraId: string | null;
1003
1003
  optionExtraConfigId: string | null;
1004
- triggerMode: "required" | "optional" | "hidden";
1004
+ triggerMode: "optional" | "required" | "hidden";
1005
1005
  minQuantity: number | null;
1006
1006
  active: boolean;
1007
1007
  createdAt: string;
@@ -1075,9 +1075,9 @@ export declare const bookingRequirementsRoutes: import("hono/hono-base").HonoBas
1075
1075
  output: {
1076
1076
  data: {
1077
1077
  id: string;
1078
- notes: string | null;
1079
1078
  createdAt: string;
1080
1079
  updatedAt: string;
1080
+ notes: string | null;
1081
1081
  target: "booking" | "participant" | "extra";
1082
1082
  productBookingQuestionId: string;
1083
1083
  bookingId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AA+BjE,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAqUlC,CAAA;AAEJ,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA"}
package/dist/routes.js CHANGED
@@ -1,14 +1,15 @@
1
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { bookingRequirementsService } from "./service.js";
3
4
  import { bookingAnswerListQuerySchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionUnitTriggerListQuerySchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema, } from "./validation.js";
4
5
  export const bookingRequirementsRoutes = new Hono()
5
6
  .get("/contact-requirements", async (c) => {
6
- const query = productContactRequirementListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
7
+ const query = parseQuery(c, productContactRequirementListQuerySchema);
7
8
  return c.json(await bookingRequirementsService.listProductContactRequirements(c.get("db"), query));
8
9
  })
9
10
  .post("/contact-requirements", async (c) => {
10
11
  return c.json({
11
- data: await bookingRequirementsService.createProductContactRequirement(c.get("db"), insertProductContactRequirementSchema.parse(await c.req.json())),
12
+ data: await bookingRequirementsService.createProductContactRequirement(c.get("db"), await parseJsonBody(c, insertProductContactRequirementSchema)),
12
13
  }, 201);
13
14
  })
14
15
  .get("/contact-requirements/:id", async (c) => {
@@ -18,7 +19,7 @@ export const bookingRequirementsRoutes = new Hono()
18
19
  return c.json({ data: row });
19
20
  })
20
21
  .patch("/contact-requirements/:id", async (c) => {
21
- const row = await bookingRequirementsService.updateProductContactRequirement(c.get("db"), c.req.param("id"), updateProductContactRequirementSchema.parse(await c.req.json()));
22
+ const row = await bookingRequirementsService.updateProductContactRequirement(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateProductContactRequirementSchema));
22
23
  if (!row)
23
24
  return c.json({ error: "Product contact requirement not found" }, 404);
24
25
  return c.json({ data: row });
@@ -30,12 +31,12 @@ export const bookingRequirementsRoutes = new Hono()
30
31
  return c.json({ success: true });
31
32
  })
32
33
  .get("/questions", async (c) => {
33
- const query = productBookingQuestionListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
34
+ const query = parseQuery(c, productBookingQuestionListQuerySchema);
34
35
  return c.json(await bookingRequirementsService.listProductBookingQuestions(c.get("db"), query));
35
36
  })
36
37
  .post("/questions", async (c) => {
37
38
  return c.json({
38
- data: await bookingRequirementsService.createProductBookingQuestion(c.get("db"), insertProductBookingQuestionSchema.parse(await c.req.json())),
39
+ data: await bookingRequirementsService.createProductBookingQuestion(c.get("db"), await parseJsonBody(c, insertProductBookingQuestionSchema)),
39
40
  }, 201);
40
41
  })
41
42
  .get("/questions/:id", async (c) => {
@@ -45,7 +46,7 @@ export const bookingRequirementsRoutes = new Hono()
45
46
  return c.json({ data: row });
46
47
  })
47
48
  .patch("/questions/:id", async (c) => {
48
- const row = await bookingRequirementsService.updateProductBookingQuestion(c.get("db"), c.req.param("id"), updateProductBookingQuestionSchema.parse(await c.req.json()));
49
+ const row = await bookingRequirementsService.updateProductBookingQuestion(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateProductBookingQuestionSchema));
49
50
  if (!row)
50
51
  return c.json({ error: "Product booking question not found" }, 404);
51
52
  return c.json({ data: row });
@@ -57,12 +58,12 @@ export const bookingRequirementsRoutes = new Hono()
57
58
  return c.json({ success: true });
58
59
  })
59
60
  .get("/option-questions", async (c) => {
60
- const query = optionBookingQuestionListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
61
+ const query = parseQuery(c, optionBookingQuestionListQuerySchema);
61
62
  return c.json(await bookingRequirementsService.listOptionBookingQuestions(c.get("db"), query));
62
63
  })
63
64
  .post("/option-questions", async (c) => {
64
65
  return c.json({
65
- data: await bookingRequirementsService.createOptionBookingQuestion(c.get("db"), insertOptionBookingQuestionSchema.parse(await c.req.json())),
66
+ data: await bookingRequirementsService.createOptionBookingQuestion(c.get("db"), await parseJsonBody(c, insertOptionBookingQuestionSchema)),
66
67
  }, 201);
67
68
  })
68
69
  .get("/option-questions/:id", async (c) => {
@@ -72,7 +73,7 @@ export const bookingRequirementsRoutes = new Hono()
72
73
  return c.json({ data: row });
73
74
  })
74
75
  .patch("/option-questions/:id", async (c) => {
75
- const row = await bookingRequirementsService.updateOptionBookingQuestion(c.get("db"), c.req.param("id"), updateOptionBookingQuestionSchema.parse(await c.req.json()));
76
+ const row = await bookingRequirementsService.updateOptionBookingQuestion(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionBookingQuestionSchema));
76
77
  if (!row)
77
78
  return c.json({ error: "Option booking question not found" }, 404);
78
79
  return c.json({ data: row });
@@ -84,12 +85,12 @@ export const bookingRequirementsRoutes = new Hono()
84
85
  return c.json({ success: true });
85
86
  })
86
87
  .get("/question-options", async (c) => {
87
- const query = bookingQuestionOptionListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
88
+ const query = parseQuery(c, bookingQuestionOptionListQuerySchema);
88
89
  return c.json(await bookingRequirementsService.listBookingQuestionOptions(c.get("db"), query));
89
90
  })
90
91
  .post("/question-options", async (c) => {
91
92
  return c.json({
92
- data: await bookingRequirementsService.createBookingQuestionOption(c.get("db"), insertBookingQuestionOptionSchema.parse(await c.req.json())),
93
+ data: await bookingRequirementsService.createBookingQuestionOption(c.get("db"), await parseJsonBody(c, insertBookingQuestionOptionSchema)),
93
94
  }, 201);
94
95
  })
95
96
  .get("/question-options/:id", async (c) => {
@@ -99,7 +100,7 @@ export const bookingRequirementsRoutes = new Hono()
99
100
  return c.json({ data: row });
100
101
  })
101
102
  .patch("/question-options/:id", async (c) => {
102
- const row = await bookingRequirementsService.updateBookingQuestionOption(c.get("db"), c.req.param("id"), updateBookingQuestionOptionSchema.parse(await c.req.json()));
103
+ const row = await bookingRequirementsService.updateBookingQuestionOption(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingQuestionOptionSchema));
103
104
  if (!row)
104
105
  return c.json({ error: "Booking question option not found" }, 404);
105
106
  return c.json({ data: row });
@@ -111,12 +112,12 @@ export const bookingRequirementsRoutes = new Hono()
111
112
  return c.json({ success: true });
112
113
  })
113
114
  .get("/unit-triggers", async (c) => {
114
- const query = bookingQuestionUnitTriggerListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
115
+ const query = parseQuery(c, bookingQuestionUnitTriggerListQuerySchema);
115
116
  return c.json(await bookingRequirementsService.listBookingQuestionUnitTriggers(c.get("db"), query));
116
117
  })
117
118
  .post("/unit-triggers", async (c) => {
118
119
  return c.json({
119
- data: await bookingRequirementsService.createBookingQuestionUnitTrigger(c.get("db"), insertBookingQuestionUnitTriggerSchema.parse(await c.req.json())),
120
+ data: await bookingRequirementsService.createBookingQuestionUnitTrigger(c.get("db"), await parseJsonBody(c, insertBookingQuestionUnitTriggerSchema)),
120
121
  }, 201);
121
122
  })
122
123
  .get("/unit-triggers/:id", async (c) => {
@@ -126,7 +127,7 @@ export const bookingRequirementsRoutes = new Hono()
126
127
  return c.json({ data: row });
127
128
  })
128
129
  .patch("/unit-triggers/:id", async (c) => {
129
- const row = await bookingRequirementsService.updateBookingQuestionUnitTrigger(c.get("db"), c.req.param("id"), updateBookingQuestionUnitTriggerSchema.parse(await c.req.json()));
130
+ const row = await bookingRequirementsService.updateBookingQuestionUnitTrigger(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingQuestionUnitTriggerSchema));
130
131
  if (!row)
131
132
  return c.json({ error: "Booking question unit trigger not found" }, 404);
132
133
  return c.json({ data: row });
@@ -138,12 +139,12 @@ export const bookingRequirementsRoutes = new Hono()
138
139
  return c.json({ success: true });
139
140
  })
140
141
  .get("/option-triggers", async (c) => {
141
- const query = bookingQuestionOptionTriggerListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
142
+ const query = parseQuery(c, bookingQuestionOptionTriggerListQuerySchema);
142
143
  return c.json(await bookingRequirementsService.listBookingQuestionOptionTriggers(c.get("db"), query));
143
144
  })
144
145
  .post("/option-triggers", async (c) => {
145
146
  return c.json({
146
- data: await bookingRequirementsService.createBookingQuestionOptionTrigger(c.get("db"), insertBookingQuestionOptionTriggerSchema.parse(await c.req.json())),
147
+ data: await bookingRequirementsService.createBookingQuestionOptionTrigger(c.get("db"), await parseJsonBody(c, insertBookingQuestionOptionTriggerSchema)),
147
148
  }, 201);
148
149
  })
149
150
  .get("/option-triggers/:id", async (c) => {
@@ -153,7 +154,7 @@ export const bookingRequirementsRoutes = new Hono()
153
154
  return c.json({ data: row });
154
155
  })
155
156
  .patch("/option-triggers/:id", async (c) => {
156
- const row = await bookingRequirementsService.updateBookingQuestionOptionTrigger(c.get("db"), c.req.param("id"), updateBookingQuestionOptionTriggerSchema.parse(await c.req.json()));
157
+ const row = await bookingRequirementsService.updateBookingQuestionOptionTrigger(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingQuestionOptionTriggerSchema));
157
158
  if (!row)
158
159
  return c.json({ error: "Booking question option trigger not found" }, 404);
159
160
  return c.json({ data: row });
@@ -165,12 +166,12 @@ export const bookingRequirementsRoutes = new Hono()
165
166
  return c.json({ success: true });
166
167
  })
167
168
  .get("/extra-triggers", async (c) => {
168
- const query = bookingQuestionExtraTriggerListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
169
+ const query = parseQuery(c, bookingQuestionExtraTriggerListQuerySchema);
169
170
  return c.json(await bookingRequirementsService.listBookingQuestionExtraTriggers(c.get("db"), query));
170
171
  })
171
172
  .post("/extra-triggers", async (c) => {
172
173
  return c.json({
173
- data: await bookingRequirementsService.createBookingQuestionExtraTrigger(c.get("db"), insertBookingQuestionExtraTriggerSchema.parse(await c.req.json())),
174
+ data: await bookingRequirementsService.createBookingQuestionExtraTrigger(c.get("db"), await parseJsonBody(c, insertBookingQuestionExtraTriggerSchema)),
174
175
  }, 201);
175
176
  })
176
177
  .get("/extra-triggers/:id", async (c) => {
@@ -180,7 +181,7 @@ export const bookingRequirementsRoutes = new Hono()
180
181
  return c.json({ data: row });
181
182
  })
182
183
  .patch("/extra-triggers/:id", async (c) => {
183
- const row = await bookingRequirementsService.updateBookingQuestionExtraTrigger(c.get("db"), c.req.param("id"), updateBookingQuestionExtraTriggerSchema.parse(await c.req.json()));
184
+ const row = await bookingRequirementsService.updateBookingQuestionExtraTrigger(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingQuestionExtraTriggerSchema));
184
185
  if (!row)
185
186
  return c.json({ error: "Booking question extra trigger not found" }, 404);
186
187
  return c.json({ data: row });
@@ -192,12 +193,12 @@ export const bookingRequirementsRoutes = new Hono()
192
193
  return c.json({ success: true });
193
194
  })
194
195
  .get("/answers", async (c) => {
195
- const query = bookingAnswerListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
196
+ const query = parseQuery(c, bookingAnswerListQuerySchema);
196
197
  return c.json(await bookingRequirementsService.listBookingAnswers(c.get("db"), query));
197
198
  })
198
199
  .post("/answers", async (c) => {
199
200
  return c.json({
200
- data: await bookingRequirementsService.createBookingAnswer(c.get("db"), insertBookingAnswerSchema.parse(await c.req.json())),
201
+ data: await bookingRequirementsService.createBookingAnswer(c.get("db"), await parseJsonBody(c, insertBookingAnswerSchema)),
201
202
  }, 201);
202
203
  })
203
204
  .get("/answers/:id", async (c) => {
@@ -207,7 +208,7 @@ export const bookingRequirementsRoutes = new Hono()
207
208
  return c.json({ data: row });
208
209
  })
209
210
  .patch("/answers/:id", async (c) => {
210
- const row = await bookingRequirementsService.updateBookingAnswer(c.get("db"), c.req.param("id"), updateBookingAnswerSchema.parse(await c.req.json()));
211
+ const row = await bookingRequirementsService.updateBookingAnswer(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingAnswerSchema));
211
212
  if (!row)
212
213
  return c.json({ error: "Booking answer not found" }, 404);
213
214
  return c.json({ data: row });
package/dist/schema.d.ts CHANGED
@@ -64,7 +64,7 @@ export declare const productContactRequirements: import("drizzle-orm/pg-core").P
64
64
  tableName: "product_contact_requirements";
65
65
  dataType: "string";
66
66
  columnType: "PgEnumColumn";
67
- data: "first_name" | "last_name" | "email" | "phone" | "date_of_birth" | "nationality" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address" | "other";
67
+ data: "email" | "other" | "nationality" | "first_name" | "last_name" | "phone" | "date_of_birth" | "passport_number" | "passport_expiry" | "dietary_requirements" | "accessibility_needs" | "special_requests" | "address";
68
68
  driverParam: string;
69
69
  notNull: true;
70
70
  hasDefault: false;
@@ -309,7 +309,7 @@ export declare const productBookingQuestions: import("drizzle-orm/pg-core").PgTa
309
309
  tableName: "product_booking_questions";
310
310
  dataType: "string";
311
311
  columnType: "PgEnumColumn";
312
- data: "booking" | "lead_traveler" | "participant" | "booker" | "extra" | "service";
312
+ data: "service" | "booking" | "lead_traveler" | "participant" | "booker" | "extra";
313
313
  driverParam: string;
314
314
  notNull: true;
315
315
  hasDefault: true;
@@ -326,7 +326,7 @@ export declare const productBookingQuestions: import("drizzle-orm/pg-core").PgTa
326
326
  tableName: "product_booking_questions";
327
327
  dataType: "string";
328
328
  columnType: "PgEnumColumn";
329
- data: "number" | "boolean" | "email" | "phone" | "other" | "text" | "textarea" | "date" | "datetime" | "single_select" | "multi_select" | "file" | "country";
329
+ data: "number" | "boolean" | "date" | "email" | "other" | "file" | "text" | "phone" | "textarea" | "datetime" | "single_select" | "multi_select" | "country";
330
330
  driverParam: string;
331
331
  notNull: true;
332
332
  hasDefault: true;
@@ -859,7 +859,7 @@ export declare const bookingQuestionUnitTriggers: import("drizzle-orm/pg-core").
859
859
  tableName: "booking_question_unit_triggers";
860
860
  dataType: "string";
861
861
  columnType: "PgEnumColumn";
862
- data: "required" | "optional" | "hidden";
862
+ data: "optional" | "required" | "hidden";
863
863
  driverParam: string;
864
864
  notNull: true;
865
865
  hasDefault: true;
@@ -1002,7 +1002,7 @@ export declare const bookingQuestionOptionTriggers: import("drizzle-orm/pg-core"
1002
1002
  tableName: "booking_question_option_triggers";
1003
1003
  dataType: "string";
1004
1004
  columnType: "PgEnumColumn";
1005
- data: "required" | "optional" | "hidden";
1005
+ data: "optional" | "required" | "hidden";
1006
1006
  driverParam: string;
1007
1007
  notNull: true;
1008
1008
  hasDefault: true;
@@ -1145,7 +1145,7 @@ export declare const bookingQuestionExtraTriggers: import("drizzle-orm/pg-core")
1145
1145
  tableName: "booking_question_extra_triggers";
1146
1146
  dataType: "string";
1147
1147
  columnType: "PgEnumColumn";
1148
- data: "required" | "optional" | "hidden";
1148
+ data: "optional" | "required" | "hidden";
1149
1149
  driverParam: string;
1150
1150
  notNull: true;
1151
1151
  hasDefault: true;
@@ -37,9 +37,9 @@ export declare function getBookingAnswerById(db: PostgresJsDatabase, id: string)
37
37
  } | null>;
38
38
  export declare function createBookingAnswer(db: PostgresJsDatabase, data: CreateBookingAnswerInput): Promise<{
39
39
  id: string;
40
- notes: string | null;
41
40
  createdAt: Date;
42
41
  updatedAt: Date;
42
+ notes: string | null;
43
43
  target: "booking" | "participant" | "extra";
44
44
  productBookingQuestionId: string;
45
45
  bookingId: string;
@@ -10,12 +10,12 @@ export declare function getPublicTransportRequirements(db: PostgresJsDatabase, p
10
10
  requiresPassport: boolean;
11
11
  requiresNationality: boolean;
12
12
  requiresDateOfBirth: boolean;
13
- requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
13
+ requiredFields: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
14
14
  fieldsByScope: {
15
- booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
16
- lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
17
- participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
18
- booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
15
+ booking: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
16
+ lead_traveler: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
17
+ participant: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
18
+ booker: ("nationality" | "date_of_birth" | "passport_number" | "passport_expiry")[];
19
19
  };
20
20
  requirements: {
21
21
  fieldKey: TransportFieldKey;