@voyantjs/pricing 0.5.0 → 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.
@@ -11,7 +11,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
11
11
  unitId: string | null;
12
12
  code: string | null;
13
13
  name: string;
14
- categoryType: "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle" | "service" | "other";
14
+ categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
15
15
  seatOccupancy: number;
16
16
  groupSize: number | null;
17
17
  isAgeQualified: boolean;
@@ -40,19 +40,19 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
40
40
  input: {};
41
41
  output: {
42
42
  data: {
43
- id: string;
44
- name: string;
45
- code: string | null;
46
- active: boolean;
47
43
  metadata: {
48
44
  [x: string]: import("hono/utils/types").JSONValue;
49
45
  } | null;
46
+ id: string;
47
+ name: string;
50
48
  createdAt: string;
51
49
  updatedAt: string;
50
+ code: string | null;
51
+ active: boolean;
52
52
  productId: string | null;
53
53
  optionId: string | null;
54
54
  unitId: string | null;
55
- categoryType: "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle" | "service" | "other";
55
+ categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
56
56
  seatOccupancy: number;
57
57
  groupSize: number | null;
58
58
  isAgeQualified: boolean;
@@ -93,7 +93,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
93
93
  unitId: string | null;
94
94
  code: string | null;
95
95
  name: string;
96
- categoryType: "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle" | "service" | "other";
96
+ categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
97
97
  seatOccupancy: number;
98
98
  groupSize: number | null;
99
99
  isAgeQualified: boolean;
@@ -140,7 +140,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
140
140
  unitId: string | null;
141
141
  code: string | null;
142
142
  name: string;
143
- categoryType: "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle" | "service" | "other";
143
+ categoryType: "service" | "other" | "adult" | "child" | "infant" | "senior" | "group" | "room" | "vehicle";
144
144
  seatOccupancy: number;
145
145
  groupSize: number | null;
146
146
  isAgeQualified: boolean;
@@ -218,10 +218,10 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
218
218
  output: {
219
219
  data: {
220
220
  id: string;
221
- active: boolean;
222
- notes: string | null;
223
221
  createdAt: string;
224
222
  updatedAt: string;
223
+ notes: string | null;
224
+ active: boolean;
225
225
  pricingCategoryId: string;
226
226
  masterPricingCategoryId: string;
227
227
  dependencyType: "requires" | "limits_per_master" | "limits_sum" | "excludes";
@@ -342,7 +342,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
342
342
  id: string;
343
343
  code: string | null;
344
344
  name: string;
345
- policyType: "simple" | "advanced" | "non_refundable" | "custom";
345
+ policyType: "custom" | "simple" | "advanced" | "non_refundable";
346
346
  simpleCutoffHours: number | null;
347
347
  isDefault: boolean;
348
348
  active: boolean;
@@ -367,18 +367,18 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
367
367
  input: {};
368
368
  output: {
369
369
  data: {
370
- id: string;
371
- name: string;
372
- code: string | null;
373
- isDefault: boolean;
374
- active: boolean;
375
- notes: string | null;
376
370
  metadata: {
377
371
  [x: string]: import("hono/utils/types").JSONValue;
378
372
  } | null;
373
+ id: string;
374
+ name: string;
379
375
  createdAt: string;
380
376
  updatedAt: string;
381
- policyType: "simple" | "advanced" | "non_refundable" | "custom";
377
+ notes: string | null;
378
+ code: string | null;
379
+ isDefault: boolean;
380
+ active: boolean;
381
+ policyType: "custom" | "simple" | "advanced" | "non_refundable";
382
382
  simpleCutoffHours: number | null;
383
383
  } | null;
384
384
  };
@@ -410,7 +410,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
410
410
  id: string;
411
411
  code: string | null;
412
412
  name: string;
413
- policyType: "simple" | "advanced" | "non_refundable" | "custom";
413
+ policyType: "custom" | "simple" | "advanced" | "non_refundable";
414
414
  simpleCutoffHours: number | null;
415
415
  isDefault: boolean;
416
416
  active: boolean;
@@ -450,7 +450,7 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
450
450
  id: string;
451
451
  code: string | null;
452
452
  name: string;
453
- policyType: "simple" | "advanced" | "non_refundable" | "custom";
453
+ policyType: "custom" | "simple" | "advanced" | "non_refundable";
454
454
  simpleCutoffHours: number | null;
455
455
  isDefault: boolean;
456
456
  active: boolean;
@@ -525,10 +525,10 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
525
525
  output: {
526
526
  data: {
527
527
  id: string;
528
- active: boolean;
529
- notes: string | null;
530
528
  createdAt: string;
531
529
  updatedAt: string;
530
+ notes: string | null;
531
+ active: boolean;
532
532
  sortOrder: number;
533
533
  cancellationPolicyId: string;
534
534
  cutoffMinutesBefore: number | null;
@@ -677,19 +677,19 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
677
677
  input: {};
678
678
  output: {
679
679
  data: {
680
+ metadata: {
681
+ [x: string]: import("hono/utils/types").JSONValue;
682
+ } | null;
680
683
  id: string;
681
684
  name: string;
685
+ createdAt: string;
686
+ updatedAt: string;
687
+ notes: string | null;
682
688
  code: string;
683
689
  currencyCode: string | null;
684
690
  catalogType: "internal" | "other" | "public" | "contract" | "net" | "gross" | "promo";
685
691
  isDefault: boolean;
686
692
  active: boolean;
687
- notes: string | null;
688
- metadata: {
689
- [x: string]: import("hono/utils/types").JSONValue;
690
- } | null;
691
- createdAt: string;
692
- updatedAt: string;
693
693
  } | null;
694
694
  };
695
695
  outputFormat: "json";
@@ -840,19 +840,19 @@ export declare const pricingCoreRoutes: import("hono/hono-base").HonoBase<Env, {
840
840
  input: {};
841
841
  output: {
842
842
  data: {
843
- id: string;
844
- name: string;
845
- code: string | null;
846
- active: boolean;
847
- notes: string | null;
848
843
  metadata: {
849
844
  [x: string]: import("hono/utils/types").JSONValue;
850
845
  } | null;
846
+ id: string;
847
+ name: string;
851
848
  createdAt: string;
852
849
  updatedAt: string;
850
+ notes: string | null;
851
+ timezone: string | null;
852
+ code: string | null;
853
+ active: boolean;
853
854
  priceCatalogId: string;
854
855
  recurrenceRule: string;
855
- timezone: string | null;
856
856
  validFrom: string | null;
857
857
  validTo: string | null;
858
858
  weekdays: string[] | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-core.d.ts","sourceRoot":"","sources":["../src/routes-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAuBvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAqN1B,CAAA"}
@@ -1,98 +1,99 @@
1
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { notFound } from "./routes-shared.js";
3
4
  import { pricingService } from "./service.js";
4
5
  import { cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, priceCatalogListQuerySchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema, } from "./validation.js";
5
6
  export const pricingCoreRoutes = new Hono()
6
- .get("/pricing-categories", async (c) => c.json(await pricingService.listPricingCategories(c.get("db"), pricingCategoryListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
7
+ .get("/pricing-categories", async (c) => c.json(await pricingService.listPricingCategories(c.get("db"), await parseQuery(c, pricingCategoryListQuerySchema))))
7
8
  .post("/pricing-categories", async (c) => c.json({
8
- data: await pricingService.createPricingCategory(c.get("db"), insertPricingCategorySchema.parse(await c.req.json())),
9
+ data: await pricingService.createPricingCategory(c.get("db"), await parseJsonBody(c, insertPricingCategorySchema)),
9
10
  }, 201))
10
11
  .get("/pricing-categories/:id", async (c) => {
11
12
  const row = await pricingService.getPricingCategoryById(c.get("db"), c.req.param("id"));
12
13
  return row ? c.json({ data: row }) : notFound(c, "Pricing category not found");
13
14
  })
14
15
  .patch("/pricing-categories/:id", async (c) => {
15
- const row = await pricingService.updatePricingCategory(c.get("db"), c.req.param("id"), updatePricingCategorySchema.parse(await c.req.json()));
16
+ const row = await pricingService.updatePricingCategory(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePricingCategorySchema));
16
17
  return row ? c.json({ data: row }) : notFound(c, "Pricing category not found");
17
18
  })
18
19
  .delete("/pricing-categories/:id", async (c) => {
19
20
  const row = await pricingService.deletePricingCategory(c.get("db"), c.req.param("id"));
20
21
  return row ? c.json({ success: true }) : notFound(c, "Pricing category not found");
21
22
  })
22
- .get("/pricing-category-dependencies", async (c) => c.json(await pricingService.listPricingCategoryDependencies(c.get("db"), pricingCategoryDependencyListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
23
+ .get("/pricing-category-dependencies", async (c) => c.json(await pricingService.listPricingCategoryDependencies(c.get("db"), await parseQuery(c, pricingCategoryDependencyListQuerySchema))))
23
24
  .post("/pricing-category-dependencies", async (c) => c.json({
24
- data: await pricingService.createPricingCategoryDependency(c.get("db"), insertPricingCategoryDependencySchema.parse(await c.req.json())),
25
+ data: await pricingService.createPricingCategoryDependency(c.get("db"), await parseJsonBody(c, insertPricingCategoryDependencySchema)),
25
26
  }, 201))
26
27
  .get("/pricing-category-dependencies/:id", async (c) => {
27
28
  const row = await pricingService.getPricingCategoryDependencyById(c.get("db"), c.req.param("id"));
28
29
  return row ? c.json({ data: row }) : notFound(c, "Pricing category dependency not found");
29
30
  })
30
31
  .patch("/pricing-category-dependencies/:id", async (c) => {
31
- const row = await pricingService.updatePricingCategoryDependency(c.get("db"), c.req.param("id"), updatePricingCategoryDependencySchema.parse(await c.req.json()));
32
+ const row = await pricingService.updatePricingCategoryDependency(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePricingCategoryDependencySchema));
32
33
  return row ? c.json({ data: row }) : notFound(c, "Pricing category dependency not found");
33
34
  })
34
35
  .delete("/pricing-category-dependencies/:id", async (c) => {
35
36
  const row = await pricingService.deletePricingCategoryDependency(c.get("db"), c.req.param("id"));
36
37
  return row ? c.json({ success: true }) : notFound(c, "Pricing category dependency not found");
37
38
  })
38
- .get("/cancellation-policies", async (c) => c.json(await pricingService.listCancellationPolicies(c.get("db"), cancellationPolicyListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
39
+ .get("/cancellation-policies", async (c) => c.json(await pricingService.listCancellationPolicies(c.get("db"), await parseQuery(c, cancellationPolicyListQuerySchema))))
39
40
  .post("/cancellation-policies", async (c) => c.json({
40
- data: await pricingService.createCancellationPolicy(c.get("db"), insertCancellationPolicySchema.parse(await c.req.json())),
41
+ data: await pricingService.createCancellationPolicy(c.get("db"), await parseJsonBody(c, insertCancellationPolicySchema)),
41
42
  }, 201))
42
43
  .get("/cancellation-policies/:id", async (c) => {
43
44
  const row = await pricingService.getCancellationPolicyById(c.get("db"), c.req.param("id"));
44
45
  return row ? c.json({ data: row }) : notFound(c, "Cancellation policy not found");
45
46
  })
46
47
  .patch("/cancellation-policies/:id", async (c) => {
47
- const row = await pricingService.updateCancellationPolicy(c.get("db"), c.req.param("id"), updateCancellationPolicySchema.parse(await c.req.json()));
48
+ const row = await pricingService.updateCancellationPolicy(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCancellationPolicySchema));
48
49
  return row ? c.json({ data: row }) : notFound(c, "Cancellation policy not found");
49
50
  })
50
51
  .delete("/cancellation-policies/:id", async (c) => {
51
52
  const row = await pricingService.deleteCancellationPolicy(c.get("db"), c.req.param("id"));
52
53
  return row ? c.json({ success: true }) : notFound(c, "Cancellation policy not found");
53
54
  })
54
- .get("/cancellation-policy-rules", async (c) => c.json(await pricingService.listCancellationPolicyRules(c.get("db"), cancellationPolicyRuleListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
55
+ .get("/cancellation-policy-rules", async (c) => c.json(await pricingService.listCancellationPolicyRules(c.get("db"), await parseQuery(c, cancellationPolicyRuleListQuerySchema))))
55
56
  .post("/cancellation-policy-rules", async (c) => c.json({
56
- data: await pricingService.createCancellationPolicyRule(c.get("db"), insertCancellationPolicyRuleSchema.parse(await c.req.json())),
57
+ data: await pricingService.createCancellationPolicyRule(c.get("db"), await parseJsonBody(c, insertCancellationPolicyRuleSchema)),
57
58
  }, 201))
58
59
  .get("/cancellation-policy-rules/:id", async (c) => {
59
60
  const row = await pricingService.getCancellationPolicyRuleById(c.get("db"), c.req.param("id"));
60
61
  return row ? c.json({ data: row }) : notFound(c, "Cancellation policy rule not found");
61
62
  })
62
63
  .patch("/cancellation-policy-rules/:id", async (c) => {
63
- const row = await pricingService.updateCancellationPolicyRule(c.get("db"), c.req.param("id"), updateCancellationPolicyRuleSchema.parse(await c.req.json()));
64
+ const row = await pricingService.updateCancellationPolicyRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCancellationPolicyRuleSchema));
64
65
  return row ? c.json({ data: row }) : notFound(c, "Cancellation policy rule not found");
65
66
  })
66
67
  .delete("/cancellation-policy-rules/:id", async (c) => {
67
68
  const row = await pricingService.deleteCancellationPolicyRule(c.get("db"), c.req.param("id"));
68
69
  return row ? c.json({ success: true }) : notFound(c, "Cancellation policy rule not found");
69
70
  })
70
- .get("/price-catalogs", async (c) => c.json(await pricingService.listPriceCatalogs(c.get("db"), priceCatalogListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
71
+ .get("/price-catalogs", async (c) => c.json(await pricingService.listPriceCatalogs(c.get("db"), await parseQuery(c, priceCatalogListQuerySchema))))
71
72
  .post("/price-catalogs", async (c) => c.json({
72
- data: await pricingService.createPriceCatalog(c.get("db"), insertPriceCatalogSchema.parse(await c.req.json())),
73
+ data: await pricingService.createPriceCatalog(c.get("db"), await parseJsonBody(c, insertPriceCatalogSchema)),
73
74
  }, 201))
74
75
  .get("/price-catalogs/:id", async (c) => {
75
76
  const row = await pricingService.getPriceCatalogById(c.get("db"), c.req.param("id"));
76
77
  return row ? c.json({ data: row }) : notFound(c, "Price catalog not found");
77
78
  })
78
79
  .patch("/price-catalogs/:id", async (c) => {
79
- const row = await pricingService.updatePriceCatalog(c.get("db"), c.req.param("id"), updatePriceCatalogSchema.parse(await c.req.json()));
80
+ const row = await pricingService.updatePriceCatalog(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePriceCatalogSchema));
80
81
  return row ? c.json({ data: row }) : notFound(c, "Price catalog not found");
81
82
  })
82
83
  .delete("/price-catalogs/:id", async (c) => {
83
84
  const row = await pricingService.deletePriceCatalog(c.get("db"), c.req.param("id"));
84
85
  return row ? c.json({ success: true }) : notFound(c, "Price catalog not found");
85
86
  })
86
- .get("/price-schedules", async (c) => c.json(await pricingService.listPriceSchedules(c.get("db"), priceScheduleListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)))))
87
+ .get("/price-schedules", async (c) => c.json(await pricingService.listPriceSchedules(c.get("db"), await parseQuery(c, priceScheduleListQuerySchema))))
87
88
  .post("/price-schedules", async (c) => c.json({
88
- data: await pricingService.createPriceSchedule(c.get("db"), insertPriceScheduleSchema.parse(await c.req.json())),
89
+ data: await pricingService.createPriceSchedule(c.get("db"), await parseJsonBody(c, insertPriceScheduleSchema)),
89
90
  }, 201))
90
91
  .get("/price-schedules/:id", async (c) => {
91
92
  const row = await pricingService.getPriceScheduleById(c.get("db"), c.req.param("id"));
92
93
  return row ? c.json({ data: row }) : notFound(c, "Price schedule not found");
93
94
  })
94
95
  .patch("/price-schedules/:id", async (c) => {
95
- const row = await pricingService.updatePriceSchedule(c.get("db"), c.req.param("id"), updatePriceScheduleSchema.parse(await c.req.json()));
96
+ const row = await pricingService.updatePriceSchedule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePriceScheduleSchema));
96
97
  return row ? c.json({ data: row }) : notFound(c, "Price schedule not found");
97
98
  })
98
99
  .delete("/price-schedules/:id", async (c) => {
@@ -33,7 +33,7 @@ export declare const publicPricingRoutes: import("hono/hono-base").HonoBase<Env,
33
33
  description: string | null;
34
34
  status: "active" | "draft" | "archived";
35
35
  isDefault: boolean;
36
- bookingMode: "other" | "date" | "open" | "date_time" | "stay" | "transfer" | "itinerary";
36
+ bookingMode: "date" | "other" | "open" | "date_time" | "stay" | "transfer" | "itinerary";
37
37
  capacityMode: "on_request" | "free_sale" | "limited";
38
38
  pricingRules: {
39
39
  id: string;
@@ -49,7 +49,7 @@ export declare const publicPricingRoutes: import("hono/hono-base").HonoBase<Env,
49
49
  id: string;
50
50
  unitId: string;
51
51
  unitName: string;
52
- unitType: "group" | "room" | "vehicle" | "service" | "other" | "person";
52
+ unitType: "service" | "other" | "group" | "room" | "vehicle" | "person";
53
53
  pricingMode: "per_person" | "per_booking" | "free" | "on_request" | "per_unit" | "included";
54
54
  sellAmountCents: number | null;
55
55
  minQuantity: number | null;
@@ -69,7 +69,7 @@ export declare const publicPricingRoutes: import("hono/hono-base").HonoBase<Env,
69
69
  startTimeId: string;
70
70
  label: string | null;
71
71
  startTimeLocal: string;
72
- ruleMode: "included" | "excluded" | "override" | "adjustment";
72
+ ruleMode: "override" | "included" | "excluded" | "adjustment";
73
73
  adjustmentType: "fixed" | "percentage" | null;
74
74
  sellAdjustmentCents: number | null;
75
75
  adjustmentBasisPoints: number | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAOvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAoB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAOvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAkB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
@@ -1,13 +1,14 @@
1
+ import { parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { notFound } from "./routes-shared.js";
3
4
  import { publicPricingService } from "./service-public.js";
4
5
  import { publicAvailabilitySnapshotQuerySchema, publicProductPricingQuerySchema, } from "./validation-public.js";
5
6
  export const publicPricingRoutes = new Hono()
6
7
  .get("/products/:productId/pricing", async (c) => {
7
- const snapshot = await publicPricingService.getProductPricingSnapshot(c.get("db"), c.req.param("productId"), publicProductPricingQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)));
8
+ const snapshot = await publicPricingService.getProductPricingSnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicProductPricingQuerySchema));
8
9
  return snapshot ? c.json({ data: snapshot }) : notFound(c, "Public pricing snapshot not found");
9
10
  })
10
11
  .get("/products/:productId/availability", async (c) => {
11
- const snapshot = await publicPricingService.getAvailabilitySnapshot(c.get("db"), c.req.param("productId"), publicAvailabilitySnapshotQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)));
12
+ const snapshot = await publicPricingService.getAvailabilitySnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicAvailabilitySnapshotQuerySchema));
12
13
  return snapshot ? c.json(snapshot) : notFound(c, "Public availability snapshot not found");
13
14
  });
@@ -43,23 +43,23 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
43
43
  input: {};
44
44
  output: {
45
45
  data: {
46
- id: string;
47
- name: string;
48
- code: string | null;
49
- isDefault: boolean;
50
- active: boolean;
51
- notes: string | null;
52
46
  metadata: {
53
47
  [x: string]: import("hono/utils/types").JSONValue;
54
48
  } | null;
49
+ id: string;
50
+ name: string;
55
51
  createdAt: string;
56
52
  updatedAt: string;
53
+ notes: string | null;
54
+ description: string | null;
55
+ code: string | null;
56
+ isDefault: boolean;
57
+ active: boolean;
57
58
  priceCatalogId: string;
58
59
  productId: string;
59
60
  optionId: string;
60
61
  cancellationPolicyId: string | null;
61
62
  priceScheduleId: string | null;
62
- description: string | null;
63
63
  pricingMode: "per_person" | "per_booking" | "starting_from" | "free" | "on_request";
64
64
  baseSellAmountCents: number | null;
65
65
  baseCostAmountCents: number | null;
@@ -237,14 +237,14 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
237
237
  input: {};
238
238
  output: {
239
239
  data: {
240
- id: string;
241
- active: boolean;
242
- notes: string | null;
243
240
  metadata: {
244
241
  [x: string]: import("hono/utils/types").JSONValue;
245
242
  } | null;
243
+ id: string;
246
244
  createdAt: string;
247
245
  updatedAt: string;
246
+ notes: string | null;
247
+ active: boolean;
248
248
  optionId: string;
249
249
  unitId: string;
250
250
  sortOrder: number;
@@ -387,7 +387,7 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
387
387
  optionPriceRuleId: string;
388
388
  optionId: string;
389
389
  startTimeId: string;
390
- ruleMode: "included" | "excluded" | "override" | "adjustment";
390
+ ruleMode: "override" | "included" | "excluded" | "adjustment";
391
391
  adjustmentType: "fixed" | "percentage" | null;
392
392
  sellAdjustmentCents: number | null;
393
393
  costAdjustmentCents: number | null;
@@ -412,14 +412,14 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
412
412
  output: {
413
413
  data: {
414
414
  id: string;
415
- active: boolean;
416
- notes: string | null;
417
415
  createdAt: string;
418
416
  updatedAt: string;
417
+ notes: string | null;
418
+ active: boolean;
419
419
  optionId: string;
420
420
  optionPriceRuleId: string;
421
421
  startTimeId: string;
422
- ruleMode: "included" | "excluded" | "override" | "adjustment";
422
+ ruleMode: "override" | "included" | "excluded" | "adjustment";
423
423
  adjustmentType: "fixed" | "percentage" | null;
424
424
  sellAdjustmentCents: number | null;
425
425
  costAdjustmentCents: number | null;
@@ -455,7 +455,7 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
455
455
  optionPriceRuleId: string;
456
456
  optionId: string;
457
457
  startTimeId: string;
458
- ruleMode: "included" | "excluded" | "override" | "adjustment";
458
+ ruleMode: "override" | "included" | "excluded" | "adjustment";
459
459
  adjustmentType: "fixed" | "percentage" | null;
460
460
  sellAdjustmentCents: number | null;
461
461
  costAdjustmentCents: number | null;
@@ -495,7 +495,7 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
495
495
  optionPriceRuleId: string;
496
496
  optionId: string;
497
497
  startTimeId: string;
498
- ruleMode: "included" | "excluded" | "override" | "adjustment";
498
+ ruleMode: "override" | "included" | "excluded" | "adjustment";
499
499
  adjustmentType: "fixed" | "percentage" | null;
500
500
  sellAdjustmentCents: number | null;
501
501
  costAdjustmentCents: number | null;
@@ -568,9 +568,9 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
568
568
  output: {
569
569
  data: {
570
570
  id: string;
571
- active: boolean;
572
571
  createdAt: string;
573
572
  updatedAt: string;
573
+ active: boolean;
574
574
  sortOrder: number;
575
575
  sellAmountCents: number | null;
576
576
  costAmountCents: number | null;
@@ -717,10 +717,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
717
717
  output: {
718
718
  data: {
719
719
  id: string;
720
- active: boolean;
721
- notes: string | null;
722
720
  createdAt: string;
723
721
  updatedAt: string;
722
+ notes: string | null;
723
+ active: boolean;
724
724
  optionId: string;
725
725
  sortOrder: number;
726
726
  pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
@@ -874,10 +874,10 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
874
874
  output: {
875
875
  data: {
876
876
  id: string;
877
- active: boolean;
878
- notes: string | null;
879
877
  createdAt: string;
880
878
  updatedAt: string;
879
+ notes: string | null;
880
+ active: boolean;
881
881
  optionId: string;
882
882
  sortOrder: number;
883
883
  pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
@@ -1038,14 +1038,14 @@ export declare const pricingRuleRoutes: import("hono/hono-base").HonoBase<Env, {
1038
1038
  input: {};
1039
1039
  output: {
1040
1040
  data: {
1041
- id: string;
1042
- active: boolean;
1043
- notes: string | null;
1044
1041
  metadata: {
1045
1042
  [x: string]: import("hono/utils/types").JSONValue;
1046
1043
  } | null;
1044
+ id: string;
1047
1045
  createdAt: string;
1048
1046
  updatedAt: string;
1047
+ notes: string | null;
1048
+ active: boolean;
1049
1049
  optionId: string;
1050
1050
  sortOrder: number;
1051
1051
  pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
@@ -1 +1 @@
1
- {"version":3,"file":"routes-rules.d.ts","sourceRoot":"","sources":["../src/routes-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AA0BvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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