@voyantjs/products 0.1.1 → 0.3.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.
- package/dist/routes.d.ts +4 -4
- package/dist/schema-core.d.ts +897 -0
- package/dist/schema-core.d.ts.map +1 -0
- package/dist/schema-core.js +77 -0
- package/dist/schema-itinerary.d.ts +828 -0
- package/dist/schema-itinerary.d.ts.map +1 -0
- package/dist/schema-itinerary.js +77 -0
- package/dist/schema-relations.d.ts +99 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +155 -0
- package/dist/schema-settings.d.ts +1749 -0
- package/dist/schema-settings.d.ts.map +1 -0
- package/dist/schema-settings.js +175 -0
- package/dist/schema-shared.d.ts +15 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +91 -0
- package/dist/schema-taxonomy.d.ts +573 -0
- package/dist/schema-taxonomy.d.ts.map +1 -0
- package/dist/schema-taxonomy.js +65 -0
- package/dist/schema.d.ts +6 -4155
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -653
- package/dist/service.d.ts +4 -4
- package/dist/validation-config.d.ts +233 -0
- package/dist/validation-config.d.ts.map +1 -0
- package/dist/validation-config.js +73 -0
- package/dist/validation-content.d.ts +358 -0
- package/dist/validation-content.d.ts.map +1 -0
- package/dist/validation-content.js +177 -0
- package/dist/validation-core.d.ts +268 -0
- package/dist/validation-core.d.ts.map +1 -0
- package/dist/validation-core.js +91 -0
- package/dist/validation-shared.d.ts +103 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +86 -0
- package/dist/validation.d.ts +4 -854
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +4 -433
- package/package.json +4 -4
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,YAAY,CAAA;AAChE,MAAM,MAAM,iBAAiB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAA;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYxB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA;AAE7D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA;AAC3D,MAAM,MAAM,eAAe,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
2
|
+
import { boolean, index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
|
+
import { products } from "./schema-core";
|
|
4
|
+
import { productMediaTypeEnum, serviceTypeEnum } from "./schema-shared";
|
|
5
|
+
export const productDays = pgTable("product_days", {
|
|
6
|
+
id: typeId("product_days"),
|
|
7
|
+
productId: typeIdRef("product_id")
|
|
8
|
+
.notNull()
|
|
9
|
+
.references(() => products.id, { onDelete: "cascade" }),
|
|
10
|
+
dayNumber: integer("day_number").notNull(),
|
|
11
|
+
title: text("title"),
|
|
12
|
+
description: text("description"),
|
|
13
|
+
location: text("location"),
|
|
14
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
15
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
16
|
+
}, (table) => [index("idx_product_days_product").on(table.productId)]);
|
|
17
|
+
export const productDayServices = pgTable("product_day_services", {
|
|
18
|
+
id: typeId("product_day_services"),
|
|
19
|
+
dayId: typeIdRef("day_id")
|
|
20
|
+
.notNull()
|
|
21
|
+
.references(() => productDays.id, { onDelete: "cascade" }),
|
|
22
|
+
supplierServiceId: text("supplier_service_id"),
|
|
23
|
+
serviceType: serviceTypeEnum("service_type").notNull(),
|
|
24
|
+
name: text("name").notNull(),
|
|
25
|
+
description: text("description"),
|
|
26
|
+
costCurrency: text("cost_currency").notNull(),
|
|
27
|
+
costAmountCents: integer("cost_amount_cents").notNull(),
|
|
28
|
+
quantity: integer("quantity").notNull().default(1),
|
|
29
|
+
sortOrder: integer("sort_order"),
|
|
30
|
+
notes: text("notes"),
|
|
31
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
32
|
+
}, (table) => [
|
|
33
|
+
index("idx_product_day_services_day").on(table.dayId),
|
|
34
|
+
index("idx_product_day_services_supplier_service").on(table.supplierServiceId),
|
|
35
|
+
]);
|
|
36
|
+
export const productVersions = pgTable("product_versions", {
|
|
37
|
+
id: typeId("product_versions"),
|
|
38
|
+
productId: typeIdRef("product_id")
|
|
39
|
+
.notNull()
|
|
40
|
+
.references(() => products.id, { onDelete: "cascade" }),
|
|
41
|
+
versionNumber: integer("version_number").notNull(),
|
|
42
|
+
snapshot: jsonb("snapshot").notNull(),
|
|
43
|
+
authorId: text("author_id").notNull(),
|
|
44
|
+
notes: text("notes"),
|
|
45
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
46
|
+
}, (table) => [index("idx_product_versions_product").on(table.productId)]);
|
|
47
|
+
export const productNotes = pgTable("product_notes", {
|
|
48
|
+
id: typeId("product_notes"),
|
|
49
|
+
productId: typeIdRef("product_id")
|
|
50
|
+
.notNull()
|
|
51
|
+
.references(() => products.id, { onDelete: "cascade" }),
|
|
52
|
+
authorId: text("author_id").notNull(),
|
|
53
|
+
content: text("content").notNull(),
|
|
54
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
55
|
+
}, (table) => [index("idx_product_notes_product").on(table.productId)]);
|
|
56
|
+
export const productMedia = pgTable("product_media", {
|
|
57
|
+
id: typeId("product_media"),
|
|
58
|
+
productId: typeIdRef("product_id")
|
|
59
|
+
.notNull()
|
|
60
|
+
.references(() => products.id, { onDelete: "cascade" }),
|
|
61
|
+
dayId: typeIdRef("day_id").references(() => productDays.id, { onDelete: "cascade" }),
|
|
62
|
+
mediaType: productMediaTypeEnum("media_type").notNull(),
|
|
63
|
+
name: text("name").notNull(),
|
|
64
|
+
url: text("url").notNull(),
|
|
65
|
+
storageKey: text("storage_key"),
|
|
66
|
+
mimeType: text("mime_type"),
|
|
67
|
+
fileSize: integer("file_size"),
|
|
68
|
+
altText: text("alt_text"),
|
|
69
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
70
|
+
isCover: boolean("is_cover").notNull().default(false),
|
|
71
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
72
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
73
|
+
}, (table) => [
|
|
74
|
+
index("idx_product_media_product").on(table.productId),
|
|
75
|
+
index("idx_product_media_day").on(table.dayId),
|
|
76
|
+
index("idx_product_media_product_day").on(table.productId, table.dayId),
|
|
77
|
+
]);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const productsRelations: import("drizzle-orm").Relations<"products", {
|
|
2
|
+
productType: import("drizzle-orm").One<"product_types", false>;
|
|
3
|
+
activationSettings: import("drizzle-orm").Many<"product_activation_settings">;
|
|
4
|
+
ticketSettings: import("drizzle-orm").Many<"product_ticket_settings">;
|
|
5
|
+
visibilitySettings: import("drizzle-orm").Many<"product_visibility_settings">;
|
|
6
|
+
capabilities: import("drizzle-orm").Many<"product_capabilities">;
|
|
7
|
+
deliveryFormats: import("drizzle-orm").Many<"product_delivery_formats">;
|
|
8
|
+
features: import("drizzle-orm").Many<"product_features">;
|
|
9
|
+
faqs: import("drizzle-orm").Many<"product_faqs">;
|
|
10
|
+
locations: import("drizzle-orm").Many<"product_locations">;
|
|
11
|
+
options: import("drizzle-orm").Many<"product_options">;
|
|
12
|
+
translations: import("drizzle-orm").Many<"product_translations">;
|
|
13
|
+
days: import("drizzle-orm").Many<"product_days">;
|
|
14
|
+
versions: import("drizzle-orm").Many<"product_versions">;
|
|
15
|
+
notes: import("drizzle-orm").Many<"product_notes">;
|
|
16
|
+
media: import("drizzle-orm").Many<"product_media">;
|
|
17
|
+
categoryLinks: import("drizzle-orm").Many<"product_category_products">;
|
|
18
|
+
tagLinks: import("drizzle-orm").Many<"product_tag_products">;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const productOptionsRelations: import("drizzle-orm").Relations<"product_options", {
|
|
21
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
22
|
+
translations: import("drizzle-orm").Many<"product_option_translations">;
|
|
23
|
+
units: import("drizzle-orm").Many<"option_units">;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const optionUnitsRelations: import("drizzle-orm").Relations<"option_units", {
|
|
26
|
+
option: import("drizzle-orm").One<"product_options", true>;
|
|
27
|
+
translations: import("drizzle-orm").Many<"option_unit_translations">;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const productActivationSettingsRelations: import("drizzle-orm").Relations<"product_activation_settings", {
|
|
30
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const productTicketSettingsRelations: import("drizzle-orm").Relations<"product_ticket_settings", {
|
|
33
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const productVisibilitySettingsRelations: import("drizzle-orm").Relations<"product_visibility_settings", {
|
|
36
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const productCapabilitiesRelations: import("drizzle-orm").Relations<"product_capabilities", {
|
|
39
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const productDeliveryFormatsRelations: import("drizzle-orm").Relations<"product_delivery_formats", {
|
|
42
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const productFeaturesRelations: import("drizzle-orm").Relations<"product_features", {
|
|
45
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const productFaqsRelations: import("drizzle-orm").Relations<"product_faqs", {
|
|
48
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const productLocationsRelations: import("drizzle-orm").Relations<"product_locations", {
|
|
51
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const productTranslationsRelations: import("drizzle-orm").Relations<"product_translations", {
|
|
54
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const productOptionTranslationsRelations: import("drizzle-orm").Relations<"product_option_translations", {
|
|
57
|
+
option: import("drizzle-orm").One<"product_options", true>;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const optionUnitTranslationsRelations: import("drizzle-orm").Relations<"option_unit_translations", {
|
|
60
|
+
unit: import("drizzle-orm").One<"option_units", true>;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const productDaysRelations: import("drizzle-orm").Relations<"product_days", {
|
|
63
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
64
|
+
services: import("drizzle-orm").Many<"product_day_services">;
|
|
65
|
+
media: import("drizzle-orm").Many<"product_media">;
|
|
66
|
+
}>;
|
|
67
|
+
export declare const productDayServicesRelations: import("drizzle-orm").Relations<"product_day_services", {
|
|
68
|
+
day: import("drizzle-orm").One<"product_days", true>;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const productVersionsRelations: import("drizzle-orm").Relations<"product_versions", {
|
|
71
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const productNotesRelations: import("drizzle-orm").Relations<"product_notes", {
|
|
74
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const productMediaRelations: import("drizzle-orm").Relations<"product_media", {
|
|
77
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
78
|
+
day: import("drizzle-orm").One<"product_days", false>;
|
|
79
|
+
}>;
|
|
80
|
+
export declare const productTypesRelations: import("drizzle-orm").Relations<"product_types", {
|
|
81
|
+
products: import("drizzle-orm").Many<"products">;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const productCategoriesRelations: import("drizzle-orm").Relations<"product_categories", {
|
|
84
|
+
parent: import("drizzle-orm").One<"product_categories", false>;
|
|
85
|
+
children: import("drizzle-orm").Many<"product_categories">;
|
|
86
|
+
productLinks: import("drizzle-orm").Many<"product_category_products">;
|
|
87
|
+
}>;
|
|
88
|
+
export declare const productTagsRelations: import("drizzle-orm").Relations<"product_tags", {
|
|
89
|
+
productLinks: import("drizzle-orm").Many<"product_tag_products">;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const productCategoryProductsRelations: import("drizzle-orm").Relations<"product_category_products", {
|
|
92
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
93
|
+
category: import("drizzle-orm").One<"product_categories", true>;
|
|
94
|
+
}>;
|
|
95
|
+
export declare const productTagProductsRelations: import("drizzle-orm").Relations<"product_tag_products", {
|
|
96
|
+
product: import("drizzle-orm").One<"products", true>;
|
|
97
|
+
tag: import("drizzle-orm").One<"product_tags", true>;
|
|
98
|
+
}>;
|
|
99
|
+
//# sourceMappingURL=schema-relations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-relations.d.ts","sourceRoot":"","sources":["../src/schema-relations.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAqB3B,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,0BAA0B;;;;EAQpC,CAAA;AAEH,eAAO,MAAM,oBAAoB;;EAE9B,CAAA;AAEH,eAAO,MAAM,gCAAgC;;;EAS1C,CAAA;AAEH,eAAO,MAAM,2BAA2B;;;EASrC,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { relations } from "drizzle-orm";
|
|
2
|
+
import { optionUnits, productOptions, products } from "./schema-core";
|
|
3
|
+
import { productDayServices, productDays, productMedia, productNotes, productVersions, } from "./schema-itinerary";
|
|
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";
|
|
6
|
+
export const productsRelations = relations(products, ({ one, many }) => ({
|
|
7
|
+
productType: one(productTypes, {
|
|
8
|
+
fields: [products.productTypeId],
|
|
9
|
+
references: [productTypes.id],
|
|
10
|
+
}),
|
|
11
|
+
activationSettings: many(productActivationSettings),
|
|
12
|
+
ticketSettings: many(productTicketSettings),
|
|
13
|
+
visibilitySettings: many(productVisibilitySettings),
|
|
14
|
+
capabilities: many(productCapabilities),
|
|
15
|
+
deliveryFormats: many(productDeliveryFormats),
|
|
16
|
+
features: many(productFeatures),
|
|
17
|
+
faqs: many(productFaqs),
|
|
18
|
+
locations: many(productLocations),
|
|
19
|
+
options: many(productOptions),
|
|
20
|
+
translations: many(productTranslations),
|
|
21
|
+
days: many(productDays),
|
|
22
|
+
versions: many(productVersions),
|
|
23
|
+
notes: many(productNotes),
|
|
24
|
+
media: many(productMedia),
|
|
25
|
+
categoryLinks: many(productCategoryProducts),
|
|
26
|
+
tagLinks: many(productTagProducts),
|
|
27
|
+
}));
|
|
28
|
+
export const productOptionsRelations = relations(productOptions, ({ one, many }) => ({
|
|
29
|
+
product: one(products, { fields: [productOptions.productId], references: [products.id] }),
|
|
30
|
+
translations: many(productOptionTranslations),
|
|
31
|
+
units: many(optionUnits),
|
|
32
|
+
}));
|
|
33
|
+
export const optionUnitsRelations = relations(optionUnits, ({ one, many }) => ({
|
|
34
|
+
option: one(productOptions, { fields: [optionUnits.optionId], references: [productOptions.id] }),
|
|
35
|
+
translations: many(optionUnitTranslations),
|
|
36
|
+
}));
|
|
37
|
+
export const productActivationSettingsRelations = relations(productActivationSettings, ({ one }) => ({
|
|
38
|
+
product: one(products, {
|
|
39
|
+
fields: [productActivationSettings.productId],
|
|
40
|
+
references: [products.id],
|
|
41
|
+
}),
|
|
42
|
+
}));
|
|
43
|
+
export const productTicketSettingsRelations = relations(productTicketSettings, ({ one }) => ({
|
|
44
|
+
product: one(products, {
|
|
45
|
+
fields: [productTicketSettings.productId],
|
|
46
|
+
references: [products.id],
|
|
47
|
+
}),
|
|
48
|
+
}));
|
|
49
|
+
export const productVisibilitySettingsRelations = relations(productVisibilitySettings, ({ one }) => ({
|
|
50
|
+
product: one(products, {
|
|
51
|
+
fields: [productVisibilitySettings.productId],
|
|
52
|
+
references: [products.id],
|
|
53
|
+
}),
|
|
54
|
+
}));
|
|
55
|
+
export const productCapabilitiesRelations = relations(productCapabilities, ({ one }) => ({
|
|
56
|
+
product: one(products, {
|
|
57
|
+
fields: [productCapabilities.productId],
|
|
58
|
+
references: [products.id],
|
|
59
|
+
}),
|
|
60
|
+
}));
|
|
61
|
+
export const productDeliveryFormatsRelations = relations(productDeliveryFormats, ({ one }) => ({
|
|
62
|
+
product: one(products, {
|
|
63
|
+
fields: [productDeliveryFormats.productId],
|
|
64
|
+
references: [products.id],
|
|
65
|
+
}),
|
|
66
|
+
}));
|
|
67
|
+
export const productFeaturesRelations = relations(productFeatures, ({ one }) => ({
|
|
68
|
+
product: one(products, {
|
|
69
|
+
fields: [productFeatures.productId],
|
|
70
|
+
references: [products.id],
|
|
71
|
+
}),
|
|
72
|
+
}));
|
|
73
|
+
export const productFaqsRelations = relations(productFaqs, ({ one }) => ({
|
|
74
|
+
product: one(products, {
|
|
75
|
+
fields: [productFaqs.productId],
|
|
76
|
+
references: [products.id],
|
|
77
|
+
}),
|
|
78
|
+
}));
|
|
79
|
+
export const productLocationsRelations = relations(productLocations, ({ one }) => ({
|
|
80
|
+
product: one(products, {
|
|
81
|
+
fields: [productLocations.productId],
|
|
82
|
+
references: [products.id],
|
|
83
|
+
}),
|
|
84
|
+
}));
|
|
85
|
+
export const productTranslationsRelations = relations(productTranslations, ({ one }) => ({
|
|
86
|
+
product: one(products, {
|
|
87
|
+
fields: [productTranslations.productId],
|
|
88
|
+
references: [products.id],
|
|
89
|
+
}),
|
|
90
|
+
}));
|
|
91
|
+
export const productOptionTranslationsRelations = relations(productOptionTranslations, ({ one }) => ({
|
|
92
|
+
option: one(productOptions, {
|
|
93
|
+
fields: [productOptionTranslations.optionId],
|
|
94
|
+
references: [productOptions.id],
|
|
95
|
+
}),
|
|
96
|
+
}));
|
|
97
|
+
export const optionUnitTranslationsRelations = relations(optionUnitTranslations, ({ one }) => ({
|
|
98
|
+
unit: one(optionUnits, {
|
|
99
|
+
fields: [optionUnitTranslations.unitId],
|
|
100
|
+
references: [optionUnits.id],
|
|
101
|
+
}),
|
|
102
|
+
}));
|
|
103
|
+
export const productDaysRelations = relations(productDays, ({ one, many }) => ({
|
|
104
|
+
product: one(products, { fields: [productDays.productId], references: [products.id] }),
|
|
105
|
+
services: many(productDayServices),
|
|
106
|
+
media: many(productMedia),
|
|
107
|
+
}));
|
|
108
|
+
export const productDayServicesRelations = relations(productDayServices, ({ one }) => ({
|
|
109
|
+
day: one(productDays, { fields: [productDayServices.dayId], references: [productDays.id] }),
|
|
110
|
+
}));
|
|
111
|
+
export const productVersionsRelations = relations(productVersions, ({ one }) => ({
|
|
112
|
+
product: one(products, { fields: [productVersions.productId], references: [products.id] }),
|
|
113
|
+
}));
|
|
114
|
+
export const productNotesRelations = relations(productNotes, ({ one }) => ({
|
|
115
|
+
product: one(products, { fields: [productNotes.productId], references: [products.id] }),
|
|
116
|
+
}));
|
|
117
|
+
export const productMediaRelations = relations(productMedia, ({ one }) => ({
|
|
118
|
+
product: one(products, { fields: [productMedia.productId], references: [products.id] }),
|
|
119
|
+
day: one(productDays, { fields: [productMedia.dayId], references: [productDays.id] }),
|
|
120
|
+
}));
|
|
121
|
+
export const productTypesRelations = relations(productTypes, ({ many }) => ({
|
|
122
|
+
products: many(products),
|
|
123
|
+
}));
|
|
124
|
+
export const productCategoriesRelations = relations(productCategories, ({ one, many }) => ({
|
|
125
|
+
parent: one(productCategories, {
|
|
126
|
+
fields: [productCategories.parentId],
|
|
127
|
+
references: [productCategories.id],
|
|
128
|
+
relationName: "parentChild",
|
|
129
|
+
}),
|
|
130
|
+
children: many(productCategories, { relationName: "parentChild" }),
|
|
131
|
+
productLinks: many(productCategoryProducts),
|
|
132
|
+
}));
|
|
133
|
+
export const productTagsRelations = relations(productTags, ({ many }) => ({
|
|
134
|
+
productLinks: many(productTagProducts),
|
|
135
|
+
}));
|
|
136
|
+
export const productCategoryProductsRelations = relations(productCategoryProducts, ({ one }) => ({
|
|
137
|
+
product: one(products, {
|
|
138
|
+
fields: [productCategoryProducts.productId],
|
|
139
|
+
references: [products.id],
|
|
140
|
+
}),
|
|
141
|
+
category: one(productCategories, {
|
|
142
|
+
fields: [productCategoryProducts.categoryId],
|
|
143
|
+
references: [productCategories.id],
|
|
144
|
+
}),
|
|
145
|
+
}));
|
|
146
|
+
export const productTagProductsRelations = relations(productTagProducts, ({ one }) => ({
|
|
147
|
+
product: one(products, {
|
|
148
|
+
fields: [productTagProducts.productId],
|
|
149
|
+
references: [products.id],
|
|
150
|
+
}),
|
|
151
|
+
tag: one(productTags, {
|
|
152
|
+
fields: [productTagProducts.tagId],
|
|
153
|
+
references: [productTags.id],
|
|
154
|
+
}),
|
|
155
|
+
}));
|