@voyantjs/products 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.
@@ -242,11 +242,11 @@ export declare const bookingProductExtensionService: {
242
242
  updatedAt: Date;
243
243
  } | null>;
244
244
  upsertBookingDetails(db: PostgresJsDatabase, bookingId: string, data: z.infer<typeof bookingProductDetailSchema>): Promise<{
245
+ createdAt: Date;
246
+ updatedAt: Date;
245
247
  bookingId: string;
246
248
  productId: string | null;
247
249
  optionId: string | null;
248
- createdAt: Date;
249
- updatedAt: Date;
250
250
  } | null>;
251
251
  removeBookingDetails(db: PostgresJsDatabase, bookingId: string): Promise<{
252
252
  bookingId: string;
@@ -261,10 +261,10 @@ export declare const bookingProductExtensionService: {
261
261
  updatedAt: Date;
262
262
  } | null>;
263
263
  upsertItemDetails(db: PostgresJsDatabase, bookingItemId: string, data: z.infer<typeof bookingItemProductDetailSchema>): Promise<{
264
- productId: string | null;
265
- optionId: string | null;
266
264
  createdAt: Date;
267
265
  updatedAt: Date;
266
+ productId: string | null;
267
+ optionId: string | null;
268
268
  bookingItemId: string;
269
269
  unitId: string | null;
270
270
  supplierServiceId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"booking-extension.d.ts","sourceRoot":"","sources":["../src/booking-extension.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUjC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAA;AAC5E,MAAM,MAAM,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;;;;;EAUjC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAA;AAC5E,MAAM,MAAM,uBAAuB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAA;AAE/E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBrC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AAIvF,QAAA,MAAM,0BAA0B;;;iBAG9B,CAAA;AAEF,QAAA,MAAM,8BAA8B;;;;;iBAKlC,CAAA;AAIF,eAAO,MAAM,8BAA8B;0BACb,kBAAkB,aAAa,MAAM;;;;;;;6BAU3D,kBAAkB,aACX,MAAM,QACX,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;;;;;;;6BAqBnB,kBAAkB,aAAa,MAAM;;;uBAQ3C,kBAAkB,iBAAiB,MAAM;;;;;;;;;0BAU5D,kBAAkB,iBACP,MAAM,QACf,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC;;;;;;;;;0BAyB1B,kBAAkB,iBAAiB,MAAM;;;CAOtE,CAAA;AAoFD,eAAO,MAAM,wBAAwB,EAAE,aAGtC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { parseJsonBody } from "@voyantjs/hono";
1
2
  import { eq } from "drizzle-orm";
2
3
  import { index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3
4
  import { Hono } from "hono";
@@ -119,7 +120,7 @@ const bookingProductExtensionRoutes = new Hono()
119
120
  return c.json({ data: row });
120
121
  })
121
122
  .put("/:bookingId/product-details", async (c) => {
122
- const data = bookingProductDetailSchema.parse(await c.req.json());
123
+ const data = await parseJsonBody(c, bookingProductDetailSchema);
123
124
  const row = await bookingProductExtensionService.upsertBookingDetails(c.get("db"), c.req.param("bookingId"), data);
124
125
  return c.json({ data: row });
125
126
  })
@@ -138,7 +139,7 @@ const bookingProductExtensionRoutes = new Hono()
138
139
  return c.json({ data: row });
139
140
  })
140
141
  .put("/:bookingId/items/:itemId/product-details", async (c) => {
141
- const data = bookingItemProductDetailSchema.parse(await c.req.json());
142
+ const data = await parseJsonBody(c, bookingItemProductDetailSchema);
142
143
  const row = await bookingProductExtensionService.upsertItemDetails(c.get("db"), c.req.param("itemId"), data);
143
144
  return c.json({ data: row });
144
145
  })
@@ -59,7 +59,7 @@ export declare const publicProductRoutes: import("hono/hono-base").HonoBase<Env,
59
59
  }[];
60
60
  locations: {
61
61
  id: string;
62
- locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
62
+ locationType: "start" | "other" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
63
63
  title: string;
64
64
  address: string | null;
65
65
  city: string | null;
@@ -170,7 +170,7 @@ export declare const publicProductRoutes: import("hono/hono-base").HonoBase<Env,
170
170
  }[];
171
171
  locations: {
172
172
  id: string;
173
- locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
173
+ locationType: "start" | "other" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
174
174
  title: string;
175
175
  address: string | null;
176
176
  city: string | null;
@@ -271,7 +271,7 @@ export declare const publicProductRoutes: import("hono/hono-base").HonoBase<Env,
271
271
  }[];
272
272
  locations: {
273
273
  id: string;
274
- locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
274
+ locationType: "start" | "other" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
275
275
  title: string;
276
276
  address: string | null;
277
277
  city: string | null;
@@ -431,7 +431,7 @@ export declare const publicProductRoutes: import("hono/hono-base").HonoBase<Env,
431
431
  }[];
432
432
  locations: {
433
433
  id: string;
434
- locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
434
+ locationType: "start" | "other" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
435
435
  title: string;
436
436
  address: string | null;
437
437
  city: string | null;
@@ -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;AAYjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwE5B,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":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAYjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0D5B,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 { publicProductsService } from "./service-public.js";
3
4
  import { publicCatalogCategoryListQuerySchema, publicCatalogDestinationListQuerySchema, publicCatalogProductListQuerySchema, publicCatalogProductLookupBySlugQuerySchema, publicCatalogTagListQuerySchema, } from "./validation-public.js";
4
5
  export const publicProductRoutes = new Hono()
5
6
  .get("/", async (c) => {
6
- const query = publicCatalogProductListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
7
+ const query = await parseQuery(c, publicCatalogProductListQuerySchema);
7
8
  return c.json(await publicProductsService.listCatalogProducts(c.get("db"), query));
8
9
  })
9
10
  .get("/slug/:slug", async (c) => {
10
- const query = publicCatalogProductLookupBySlugQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
11
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
11
12
  const row = await publicProductsService.getCatalogProductBySlug(c.get("db"), c.req.param("slug"), query);
12
13
  if (!row) {
13
14
  return c.json({ error: "Catalog product not found" }, 404);
@@ -15,19 +16,19 @@ export const publicProductRoutes = new Hono()
15
16
  return c.json({ data: row });
16
17
  })
17
18
  .get("/categories", async (c) => {
18
- const query = publicCatalogCategoryListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
19
+ const query = await parseQuery(c, publicCatalogCategoryListQuerySchema);
19
20
  return c.json(await publicProductsService.listCatalogCategories(c.get("db"), query));
20
21
  })
21
22
  .get("/tags", async (c) => {
22
- const query = publicCatalogTagListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
23
+ const query = await parseQuery(c, publicCatalogTagListQuerySchema);
23
24
  return c.json(await publicProductsService.listCatalogTags(c.get("db"), query));
24
25
  })
25
26
  .get("/destinations", async (c) => {
26
- const query = publicCatalogDestinationListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
27
+ const query = await parseQuery(c, publicCatalogDestinationListQuerySchema);
27
28
  return c.json(await publicProductsService.listCatalogDestinations(c.get("db"), query));
28
29
  })
29
30
  .get("/:id", async (c) => {
30
- const query = publicCatalogProductLookupBySlugQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
31
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
31
32
  const row = await publicProductsService.getCatalogProductById(c.get("db"), c.req.param("id"), query);
32
33
  if (!row) {
33
34
  return c.json({ error: "Catalog product not found" }, 404);
@@ -35,7 +36,7 @@ export const publicProductRoutes = new Hono()
35
36
  return c.json({ data: row });
36
37
  })
37
38
  .get("/:id/brochure", async (c) => {
38
- const query = publicCatalogProductLookupBySlugQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
39
+ const query = await parseQuery(c, publicCatalogProductLookupBySlugQuerySchema);
39
40
  const row = await publicProductsService.getCatalogProductBrochure(c.get("db"), c.req.param("id"), query);
40
41
  if (!row) {
41
42
  return c.json({ error: "Catalog product brochure not found" }, 404);