@voyantjs/products 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/routes-public.d.ts +167 -12
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +13 -1
- package/dist/routes.d.ts +669 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +117 -1
- package/dist/schema-itinerary.d.ts +51 -0
- package/dist/schema-itinerary.d.ts.map +1 -1
- package/dist/schema-itinerary.js +3 -0
- package/dist/schema-relations.d.ts +14 -0
- package/dist/schema-relations.d.ts.map +1 -1
- package/dist/schema-relations.js +28 -1
- package/dist/schema-taxonomy.d.ts +435 -0
- package/dist/schema-taxonomy.d.ts.map +1 -1
- package/dist/schema-taxonomy.js +47 -0
- package/dist/service-catalog.d.ts +237 -0
- package/dist/service-catalog.d.ts.map +1 -0
- package/dist/service-catalog.js +478 -0
- package/dist/service-public.d.ts +136 -12
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +146 -260
- package/dist/service.d.ts +292 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +388 -2
- package/dist/tasks/brochure-printers.d.ts +29 -0
- package/dist/tasks/brochure-printers.d.ts.map +1 -0
- package/dist/tasks/brochure-printers.js +94 -0
- package/dist/tasks/brochure-templates.d.ts +36 -0
- package/dist/tasks/brochure-templates.d.ts.map +1 -0
- package/dist/tasks/brochure-templates.js +98 -0
- package/dist/tasks/brochures.d.ts +42 -0
- package/dist/tasks/brochures.d.ts.map +1 -0
- package/dist/tasks/brochures.js +69 -0
- package/dist/tasks/index.d.ts +3 -0
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +3 -0
- package/dist/validation-catalog.d.ts +388 -0
- package/dist/validation-catalog.d.ts.map +1 -0
- package/dist/validation-catalog.js +54 -0
- package/dist/validation-content.d.ts +109 -0
- package/dist/validation-content.d.ts.map +1 -1
- package/dist/validation-content.js +63 -1
- package/dist/validation-public.d.ts +208 -19
- package/dist/validation-public.d.ts.map +1 -1
- package/dist/validation-public.js +39 -2
- package/dist/validation-shared.d.ts +6 -0
- package/dist/validation-shared.d.ts.map +1 -1
- package/dist/validation-shared.js +1 -0
- package/package.json +6 -4
package/dist/routes.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AA6EjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAMD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA6+CtB,CAAA;AAEJ,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { productsService } from "./service.js";
|
|
3
|
-
import { insertDaySchema, insertDayServiceSchema, insertOptionUnitSchema, insertOptionUnitTranslationSchema, insertProductActivationSettingSchema, insertProductCapabilitySchema, insertProductCategorySchema, insertProductDeliveryFormatSchema, insertProductFaqSchema, insertProductFeatureSchema, insertProductLocationSchema, insertProductMediaSchema, insertProductNoteSchema, insertProductOptionSchema, insertProductOptionTranslationSchema, insertProductSchema, insertProductTagSchema, insertProductTicketSettingSchema, insertProductTranslationSchema, insertProductTypeSchema, insertProductVisibilitySettingSchema, insertVersionSchema, optionUnitListQuerySchema, optionUnitTranslationListQuerySchema, productActivationSettingListQuerySchema, productCapabilityListQuerySchema, productCategoryListQuerySchema, productDeliveryFormatListQuerySchema, productFaqListQuerySchema, productFeatureListQuerySchema, productListQuerySchema, productLocationListQuerySchema, productMediaListQuerySchema, productOptionListQuerySchema, productOptionTranslationListQuerySchema, productTagListQuerySchema, productTicketSettingListQuerySchema, productTranslationListQuerySchema, productTypeListQuerySchema, productVisibilitySettingListQuerySchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateOptionUnitSchema, updateOptionUnitTranslationSchema, updateProductActivationSettingSchema, updateProductCapabilitySchema, updateProductCategorySchema, updateProductDeliveryFormatSchema, updateProductFaqSchema, updateProductFeatureSchema, updateProductLocationSchema, updateProductMediaSchema, updateProductOptionSchema, updateProductOptionTranslationSchema, updateProductSchema, updateProductTagSchema, updateProductTicketSettingSchema, updateProductTranslationSchema, updateProductTypeSchema, updateProductVisibilitySettingSchema, } from "./validation.js";
|
|
3
|
+
import { destinationListQuerySchema, destinationTranslationListQuerySchema, insertDaySchema, insertDayServiceSchema, insertDestinationSchema, insertDestinationTranslationSchema, insertOptionUnitSchema, insertOptionUnitTranslationSchema, insertProductActivationSettingSchema, insertProductCapabilitySchema, insertProductCategorySchema, insertProductDeliveryFormatSchema, insertProductDestinationSchema, insertProductFaqSchema, insertProductFeatureSchema, insertProductLocationSchema, insertProductMediaSchema, insertProductNoteSchema, insertProductOptionSchema, insertProductOptionTranslationSchema, insertProductSchema, insertProductTagSchema, insertProductTicketSettingSchema, insertProductTranslationSchema, insertProductTypeSchema, insertProductVisibilitySettingSchema, insertVersionSchema, optionUnitListQuerySchema, optionUnitTranslationListQuerySchema, productActivationSettingListQuerySchema, productCapabilityListQuerySchema, productCategoryListQuerySchema, productDeliveryFormatListQuerySchema, productDestinationListQuerySchema, productFaqListQuerySchema, productFeatureListQuerySchema, productListQuerySchema, productLocationListQuerySchema, productMediaListQuerySchema, productOptionListQuerySchema, productOptionTranslationListQuerySchema, productTagListQuerySchema, productTicketSettingListQuerySchema, productTranslationListQuerySchema, productTypeListQuerySchema, productVisibilitySettingListQuerySchema, reorderProductMediaSchema, updateDaySchema, updateDayServiceSchema, updateDestinationSchema, updateDestinationTranslationSchema, updateOptionUnitSchema, updateOptionUnitTranslationSchema, updateProductActivationSettingSchema, updateProductCapabilitySchema, updateProductCategorySchema, updateProductDeliveryFormatSchema, updateProductFaqSchema, updateProductFeatureSchema, updateProductLocationSchema, updateProductMediaSchema, updateProductOptionSchema, updateProductOptionTranslationSchema, updateProductSchema, updateProductTagSchema, updateProductTicketSettingSchema, updateProductTranslationSchema, updateProductTypeSchema, updateProductVisibilitySettingSchema, upsertProductBrochureSchema, } from "./validation.js";
|
|
4
4
|
// ==========================================================================
|
|
5
5
|
// Products — method-chained routes for Hono RPC type inference
|
|
6
6
|
// ==========================================================================
|
|
@@ -274,6 +274,78 @@ export const productRoutes = new Hono()
|
|
|
274
274
|
return c.json({ error: "Product location not found" }, 404);
|
|
275
275
|
}
|
|
276
276
|
return c.json({ success: true }, 200);
|
|
277
|
+
})
|
|
278
|
+
.get("/destinations", async (c) => {
|
|
279
|
+
const query = destinationListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
|
|
280
|
+
return c.json(await productsService.listDestinations(c.get("db"), query));
|
|
281
|
+
})
|
|
282
|
+
.get("/destinations/:id", async (c) => {
|
|
283
|
+
const row = await productsService.getDestinationById(c.get("db"), c.req.param("id"));
|
|
284
|
+
if (!row) {
|
|
285
|
+
return c.json({ error: "Destination not found" }, 404);
|
|
286
|
+
}
|
|
287
|
+
return c.json({ data: row });
|
|
288
|
+
})
|
|
289
|
+
.post("/destinations", async (c) => {
|
|
290
|
+
const row = await productsService.createDestination(c.get("db"), insertDestinationSchema.parse(await c.req.json()));
|
|
291
|
+
return c.json({ data: row }, 201);
|
|
292
|
+
})
|
|
293
|
+
.patch("/destinations/:id", async (c) => {
|
|
294
|
+
const row = await productsService.updateDestination(c.get("db"), c.req.param("id"), updateDestinationSchema.parse(await c.req.json()));
|
|
295
|
+
if (!row) {
|
|
296
|
+
return c.json({ error: "Destination not found" }, 404);
|
|
297
|
+
}
|
|
298
|
+
return c.json({ data: row });
|
|
299
|
+
})
|
|
300
|
+
.delete("/destinations/:id", async (c) => {
|
|
301
|
+
const row = await productsService.deleteDestination(c.get("db"), c.req.param("id"));
|
|
302
|
+
if (!row) {
|
|
303
|
+
return c.json({ error: "Destination not found" }, 404);
|
|
304
|
+
}
|
|
305
|
+
return c.json({ success: true }, 200);
|
|
306
|
+
})
|
|
307
|
+
.get("/destination-translations", async (c) => {
|
|
308
|
+
const query = destinationTranslationListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
|
|
309
|
+
return c.json(await productsService.listDestinationTranslations(c.get("db"), query));
|
|
310
|
+
})
|
|
311
|
+
.post("/destinations/:id/translations", async (c) => {
|
|
312
|
+
const row = await productsService.upsertDestinationTranslation(c.get("db"), c.req.param("id"), insertDestinationTranslationSchema.parse(await c.req.json()));
|
|
313
|
+
if (!row) {
|
|
314
|
+
return c.json({ error: "Destination not found" }, 404);
|
|
315
|
+
}
|
|
316
|
+
return c.json({ data: row }, 201);
|
|
317
|
+
})
|
|
318
|
+
.patch("/destination-translations/:id", async (c) => {
|
|
319
|
+
const row = await productsService.updateDestinationTranslation(c.get("db"), c.req.param("id"), updateDestinationTranslationSchema.parse(await c.req.json()));
|
|
320
|
+
if (!row) {
|
|
321
|
+
return c.json({ error: "Destination translation not found" }, 404);
|
|
322
|
+
}
|
|
323
|
+
return c.json({ data: row });
|
|
324
|
+
})
|
|
325
|
+
.delete("/destination-translations/:id", async (c) => {
|
|
326
|
+
const row = await productsService.deleteDestinationTranslation(c.get("db"), c.req.param("id"));
|
|
327
|
+
if (!row) {
|
|
328
|
+
return c.json({ error: "Destination translation not found" }, 404);
|
|
329
|
+
}
|
|
330
|
+
return c.json({ success: true }, 200);
|
|
331
|
+
})
|
|
332
|
+
.get("/destination-links", async (c) => {
|
|
333
|
+
const query = productDestinationListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
|
|
334
|
+
return c.json(await productsService.listProductDestinations(c.get("db"), query));
|
|
335
|
+
})
|
|
336
|
+
.post("/:id/destinations", async (c) => {
|
|
337
|
+
const row = await productsService.assignProductDestination(c.get("db"), c.req.param("id"), insertProductDestinationSchema.parse(await c.req.json()));
|
|
338
|
+
if (!row) {
|
|
339
|
+
return c.json({ error: "Product or destination not found" }, 404);
|
|
340
|
+
}
|
|
341
|
+
return c.json({ data: row }, 201);
|
|
342
|
+
})
|
|
343
|
+
.delete("/:id/destinations/:destinationId", async (c) => {
|
|
344
|
+
const row = await productsService.removeProductDestination(c.get("db"), c.req.param("id"), c.req.param("destinationId"));
|
|
345
|
+
if (!row) {
|
|
346
|
+
return c.json({ error: "Product destination link not found" }, 404);
|
|
347
|
+
}
|
|
348
|
+
return c.json({ success: true }, 200);
|
|
277
349
|
})
|
|
278
350
|
// ==========================================================================
|
|
279
351
|
// Options
|
|
@@ -591,6 +663,50 @@ export const productRoutes = new Hono()
|
|
|
591
663
|
return c.json({ error: "Media not found" }, 404);
|
|
592
664
|
}
|
|
593
665
|
return c.json({ data: row });
|
|
666
|
+
})
|
|
667
|
+
// GET /:id/brochure — Get canonical brochure for product
|
|
668
|
+
.get("/:id/brochure", async (c) => {
|
|
669
|
+
const row = await productsService.getBrochure(c.get("db"), c.req.param("id"));
|
|
670
|
+
if (!row) {
|
|
671
|
+
return c.json({ error: "Product brochure not found" }, 404);
|
|
672
|
+
}
|
|
673
|
+
return c.json({ data: row });
|
|
674
|
+
})
|
|
675
|
+
// GET /:id/brochure/versions — List brochure history for product
|
|
676
|
+
.get("/:id/brochure/versions", async (c) => {
|
|
677
|
+
return c.json({ data: await productsService.listBrochures(c.get("db"), c.req.param("id")) });
|
|
678
|
+
})
|
|
679
|
+
// PUT /:id/brochure — Upsert canonical brochure for product
|
|
680
|
+
.put("/:id/brochure", async (c) => {
|
|
681
|
+
const row = await productsService.upsertBrochure(c.get("db"), c.req.param("id"), upsertProductBrochureSchema.parse(await c.req.json()));
|
|
682
|
+
if (!row) {
|
|
683
|
+
return c.json({ error: "Product not found" }, 404);
|
|
684
|
+
}
|
|
685
|
+
return c.json({ data: row }, 201);
|
|
686
|
+
})
|
|
687
|
+
// DELETE /:id/brochure — Delete canonical brochure for product
|
|
688
|
+
.delete("/:id/brochure", async (c) => {
|
|
689
|
+
const row = await productsService.deleteBrochure(c.get("db"), c.req.param("id"));
|
|
690
|
+
if (!row) {
|
|
691
|
+
return c.json({ error: "Product brochure not found" }, 404);
|
|
692
|
+
}
|
|
693
|
+
return c.json({ data: row });
|
|
694
|
+
})
|
|
695
|
+
// POST /:id/brochure/versions/:brochureId/set-current — Promote brochure version
|
|
696
|
+
.post("/:id/brochure/versions/:brochureId/set-current", async (c) => {
|
|
697
|
+
const row = await productsService.setCurrentBrochure(c.get("db"), c.req.param("id"), c.req.param("brochureId"));
|
|
698
|
+
if (!row) {
|
|
699
|
+
return c.json({ error: "Product brochure version not found" }, 404);
|
|
700
|
+
}
|
|
701
|
+
return c.json({ data: row });
|
|
702
|
+
})
|
|
703
|
+
// DELETE /:id/brochure/versions/:brochureId — Delete brochure version
|
|
704
|
+
.delete("/:id/brochure/versions/:brochureId", async (c) => {
|
|
705
|
+
const row = await productsService.deleteBrochureVersion(c.get("db"), c.req.param("id"), c.req.param("brochureId"));
|
|
706
|
+
if (!row) {
|
|
707
|
+
return c.json({ error: "Product brochure version not found" }, 404);
|
|
708
|
+
}
|
|
709
|
+
return c.json({ data: row });
|
|
594
710
|
})
|
|
595
711
|
// GET /:id — Get single product
|
|
596
712
|
.get("/:id", async (c) => {
|
|
@@ -786,6 +786,57 @@ export declare const productMedia: import("drizzle-orm/pg-core").PgTableWithColu
|
|
|
786
786
|
identity: undefined;
|
|
787
787
|
generated: undefined;
|
|
788
788
|
}, {}, {}>;
|
|
789
|
+
isBrochure: import("drizzle-orm/pg-core").PgColumn<{
|
|
790
|
+
name: "is_brochure";
|
|
791
|
+
tableName: "product_media";
|
|
792
|
+
dataType: "boolean";
|
|
793
|
+
columnType: "PgBoolean";
|
|
794
|
+
data: boolean;
|
|
795
|
+
driverParam: boolean;
|
|
796
|
+
notNull: true;
|
|
797
|
+
hasDefault: true;
|
|
798
|
+
isPrimaryKey: false;
|
|
799
|
+
isAutoincrement: false;
|
|
800
|
+
hasRuntimeDefault: false;
|
|
801
|
+
enumValues: undefined;
|
|
802
|
+
baseColumn: never;
|
|
803
|
+
identity: undefined;
|
|
804
|
+
generated: undefined;
|
|
805
|
+
}, {}, {}>;
|
|
806
|
+
isBrochureCurrent: import("drizzle-orm/pg-core").PgColumn<{
|
|
807
|
+
name: "is_brochure_current";
|
|
808
|
+
tableName: "product_media";
|
|
809
|
+
dataType: "boolean";
|
|
810
|
+
columnType: "PgBoolean";
|
|
811
|
+
data: boolean;
|
|
812
|
+
driverParam: boolean;
|
|
813
|
+
notNull: true;
|
|
814
|
+
hasDefault: true;
|
|
815
|
+
isPrimaryKey: false;
|
|
816
|
+
isAutoincrement: false;
|
|
817
|
+
hasRuntimeDefault: false;
|
|
818
|
+
enumValues: undefined;
|
|
819
|
+
baseColumn: never;
|
|
820
|
+
identity: undefined;
|
|
821
|
+
generated: undefined;
|
|
822
|
+
}, {}, {}>;
|
|
823
|
+
brochureVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
824
|
+
name: "brochure_version";
|
|
825
|
+
tableName: "product_media";
|
|
826
|
+
dataType: "number";
|
|
827
|
+
columnType: "PgInteger";
|
|
828
|
+
data: number;
|
|
829
|
+
driverParam: string | number;
|
|
830
|
+
notNull: false;
|
|
831
|
+
hasDefault: false;
|
|
832
|
+
isPrimaryKey: false;
|
|
833
|
+
isAutoincrement: false;
|
|
834
|
+
hasRuntimeDefault: false;
|
|
835
|
+
enumValues: undefined;
|
|
836
|
+
baseColumn: never;
|
|
837
|
+
identity: undefined;
|
|
838
|
+
generated: undefined;
|
|
839
|
+
}, {}, {}>;
|
|
789
840
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
790
841
|
name: "created_at";
|
|
791
842
|
tableName: "product_media";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-itinerary.d.ts","sourceRoot":"","sources":["../src/schema-itinerary.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAevB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,WAAW,CAAC,YAAY,CAAA;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,WAAW,CAAC,YAAY,CAAA;AAE3D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB9B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAA;AACtE,MAAM,MAAM,oBAAoB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAA;AAEzE,eAAO,MAAM,eAAe;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GAAG,OAAO,YAAY,CAAC,YAAY,CAAA"}
|
package/dist/schema-itinerary.js
CHANGED
|
@@ -68,6 +68,9 @@ export const productMedia = pgTable("product_media", {
|
|
|
68
68
|
altText: text("alt_text"),
|
|
69
69
|
sortOrder: integer("sort_order").notNull().default(0),
|
|
70
70
|
isCover: boolean("is_cover").notNull().default(false),
|
|
71
|
+
isBrochure: boolean("is_brochure").notNull().default(false),
|
|
72
|
+
isBrochureCurrent: boolean("is_brochure_current").notNull().default(false),
|
|
73
|
+
brochureVersion: integer("brochure_version"),
|
|
71
74
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
72
75
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
73
76
|
}, (table) => [
|
|
@@ -15,6 +15,7 @@ export declare const productsRelations: import("drizzle-orm").Relations<"product
|
|
|
15
15
|
notes: import("drizzle-orm").Many<"product_notes">;
|
|
16
16
|
media: import("drizzle-orm").Many<"product_media">;
|
|
17
17
|
categoryLinks: import("drizzle-orm").Many<"product_category_products">;
|
|
18
|
+
destinationLinks: import("drizzle-orm").Many<"product_destinations">;
|
|
18
19
|
tagLinks: import("drizzle-orm").Many<"product_tag_products">;
|
|
19
20
|
}>;
|
|
20
21
|
export declare const productOptionsRelations: import("drizzle-orm").Relations<"product_options", {
|
|
@@ -80,6 +81,15 @@ export declare const productMediaRelations: import("drizzle-orm").Relations<"pro
|
|
|
80
81
|
export declare const productTypesRelations: import("drizzle-orm").Relations<"product_types", {
|
|
81
82
|
products: import("drizzle-orm").Many<"products">;
|
|
82
83
|
}>;
|
|
84
|
+
export declare const destinationsRelations: import("drizzle-orm").Relations<"destinations", {
|
|
85
|
+
parent: import("drizzle-orm").One<"destinations", false>;
|
|
86
|
+
children: import("drizzle-orm").Many<"destinations">;
|
|
87
|
+
translations: import("drizzle-orm").Many<"destination_translations">;
|
|
88
|
+
productLinks: import("drizzle-orm").Many<"product_destinations">;
|
|
89
|
+
}>;
|
|
90
|
+
export declare const destinationTranslationsRelations: import("drizzle-orm").Relations<"destination_translations", {
|
|
91
|
+
destination: import("drizzle-orm").One<"destinations", true>;
|
|
92
|
+
}>;
|
|
83
93
|
export declare const productCategoriesRelations: import("drizzle-orm").Relations<"product_categories", {
|
|
84
94
|
parent: import("drizzle-orm").One<"product_categories", false>;
|
|
85
95
|
children: import("drizzle-orm").Many<"product_categories">;
|
|
@@ -96,4 +106,8 @@ export declare const productTagProductsRelations: import("drizzle-orm").Relation
|
|
|
96
106
|
product: import("drizzle-orm").One<"products", true>;
|
|
97
107
|
tag: import("drizzle-orm").One<"product_tags", true>;
|
|
98
108
|
}>;
|
|
109
|
+
export declare const productDestinationsRelations: import("drizzle-orm").Relations<"product_destinations", {
|
|
110
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
111
|
+
destination: import("drizzle-orm").One<"destinations", true>;
|
|
112
|
+
}>;
|
|
99
113
|
//# sourceMappingURL=schema-relations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;EAsB3B,CAAA;AAEH,eAAO,MAAM,uBAAuB;;;;EAIjC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;;EAG9B,CAAA;AAEH,eAAO,MAAM,kCAAkC;;EAQ9C,CAAA;AAED,eAAO,MAAM,8BAA8B;;EAKxC,CAAA;AAEH,eAAO,MAAM,kCAAkC;;EAQ9C,CAAA;AAED,eAAO,MAAM,4BAA4B;;EAKtC,CAAA;AAEH,eAAO,MAAM,+BAA+B;;EAKzC,CAAA;AAEH,eAAO,MAAM,wBAAwB;;EAKlC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;EAK9B,CAAA;AAEH,eAAO,MAAM,yBAAyB;;EAKnC,CAAA;AAEH,eAAO,MAAM,4BAA4B;;EAKtC,CAAA;AAEH,eAAO,MAAM,kCAAkC;;EAQ9C,CAAA;AAED,eAAO,MAAM,+BAA+B;;EAKzC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;;;EAI9B,CAAA;AAEH,eAAO,MAAM,2BAA2B;;EAErC,CAAA;AAEH,eAAO,MAAM,wBAAwB;;EAElC,CAAA;AAEH,eAAO,MAAM,qBAAqB;;EAE/B,CAAA;AAEH,eAAO,MAAM,qBAAqB;;;EAG/B,CAAA;AAEH,eAAO,MAAM,qBAAqB;;EAE/B,CAAA;AAEH,eAAO,MAAM,qBAAqB;;;;;EAS/B,CAAA;AAEH,eAAO,MAAM,gCAAgC;;EAK1C,CAAA;AAEH,eAAO,MAAM,0BAA0B;;;;EAQpC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;EAE9B,CAAA;AAEH,eAAO,MAAM,gCAAgC;;;EAS1C,CAAA;AAEH,eAAO,MAAM,2BAA2B;;;EASrC,CAAA;AAEH,eAAO,MAAM,4BAA4B;;;EAStC,CAAA"}
|
package/dist/schema-relations.js
CHANGED
|
@@ -2,7 +2,7 @@ import { relations } from "drizzle-orm";
|
|
|
2
2
|
import { optionUnits, productOptions, products } from "./schema-core";
|
|
3
3
|
import { productDayServices, productDays, productMedia, productNotes, productVersions, } from "./schema-itinerary";
|
|
4
4
|
import { optionUnitTranslations, productActivationSettings, productCapabilities, productDeliveryFormats, productFaqs, productFeatures, productLocations, productOptionTranslations, productTicketSettings, productTranslations, productVisibilitySettings, } from "./schema-settings";
|
|
5
|
-
import { productCategories, productCategoryProducts, productTagProducts, productTags, productTypes, } from "./schema-taxonomy";
|
|
5
|
+
import { destinations, destinationTranslations, productCategories, productCategoryProducts, productDestinations, productTagProducts, productTags, productTypes, } from "./schema-taxonomy";
|
|
6
6
|
export const productsRelations = relations(products, ({ one, many }) => ({
|
|
7
7
|
productType: one(productTypes, {
|
|
8
8
|
fields: [products.productTypeId],
|
|
@@ -23,6 +23,7 @@ export const productsRelations = relations(products, ({ one, many }) => ({
|
|
|
23
23
|
notes: many(productNotes),
|
|
24
24
|
media: many(productMedia),
|
|
25
25
|
categoryLinks: many(productCategoryProducts),
|
|
26
|
+
destinationLinks: many(productDestinations),
|
|
26
27
|
tagLinks: many(productTagProducts),
|
|
27
28
|
}));
|
|
28
29
|
export const productOptionsRelations = relations(productOptions, ({ one, many }) => ({
|
|
@@ -121,6 +122,22 @@ export const productMediaRelations = relations(productMedia, ({ one }) => ({
|
|
|
121
122
|
export const productTypesRelations = relations(productTypes, ({ many }) => ({
|
|
122
123
|
products: many(products),
|
|
123
124
|
}));
|
|
125
|
+
export const destinationsRelations = relations(destinations, ({ one, many }) => ({
|
|
126
|
+
parent: one(destinations, {
|
|
127
|
+
fields: [destinations.parentId],
|
|
128
|
+
references: [destinations.id],
|
|
129
|
+
relationName: "destinationParentChild",
|
|
130
|
+
}),
|
|
131
|
+
children: many(destinations, { relationName: "destinationParentChild" }),
|
|
132
|
+
translations: many(destinationTranslations),
|
|
133
|
+
productLinks: many(productDestinations),
|
|
134
|
+
}));
|
|
135
|
+
export const destinationTranslationsRelations = relations(destinationTranslations, ({ one }) => ({
|
|
136
|
+
destination: one(destinations, {
|
|
137
|
+
fields: [destinationTranslations.destinationId],
|
|
138
|
+
references: [destinations.id],
|
|
139
|
+
}),
|
|
140
|
+
}));
|
|
124
141
|
export const productCategoriesRelations = relations(productCategories, ({ one, many }) => ({
|
|
125
142
|
parent: one(productCategories, {
|
|
126
143
|
fields: [productCategories.parentId],
|
|
@@ -153,3 +170,13 @@ export const productTagProductsRelations = relations(productTagProducts, ({ one
|
|
|
153
170
|
references: [productTags.id],
|
|
154
171
|
}),
|
|
155
172
|
}));
|
|
173
|
+
export const productDestinationsRelations = relations(productDestinations, ({ one }) => ({
|
|
174
|
+
product: one(products, {
|
|
175
|
+
fields: [productDestinations.productId],
|
|
176
|
+
references: [products.id],
|
|
177
|
+
}),
|
|
178
|
+
destination: one(destinations, {
|
|
179
|
+
fields: [productDestinations.destinationId],
|
|
180
|
+
references: [destinations.id],
|
|
181
|
+
}),
|
|
182
|
+
}));
|