@voyantjs/transactions 0.2.0 → 0.3.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/routes-offers.d.ts +885 -0
- package/dist/routes-offers.d.ts.map +1 -0
- package/dist/routes-offers.js +161 -0
- package/dist/routes-orders.d.ts +1056 -0
- package/dist/routes-orders.d.ts.map +1 -0
- package/dist/routes-orders.js +180 -0
- package/dist/routes-shared.d.ts +103 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +97 -0
- package/dist/routes.d.ts +3 -1979
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +5 -604
- package/dist/schema-audit.d.ts +216 -0
- package/dist/schema-audit.d.ts.map +1 -0
- package/dist/schema-audit.js +22 -0
- package/dist/schema-offers.d.ts +1301 -0
- package/dist/schema-offers.d.ts.map +1 -0
- package/dist/schema-offers.js +120 -0
- package/dist/schema-orders.d.ts +1582 -0
- package/dist/schema-orders.d.ts.map +1 -0
- package/dist/schema-orders.js +149 -0
- package/dist/schema-relations.d.ts +42 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +56 -0
- package/dist/schema-shared.d.ts +12 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +84 -0
- package/dist/schema.d.ts +5 -3148
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +5 -420
- package/dist/service-offers.d.ts +447 -0
- package/dist/service-offers.d.ts.map +1 -0
- package/dist/service-offers.js +262 -0
- package/dist/service-orders.d.ts +443 -0
- package/dist/service-orders.d.ts.map +1 -0
- package/dist/service-orders.js +278 -0
- package/dist/service-shared.d.ts +86 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +49 -0
- package/dist/service.d.ts +48 -927
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +48 -595
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-or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G,OAAO,UAAU,CAAC,YAAY,CAAA;AACzD,MAAM,MAAM,oBAAoB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAA;AAC5E,MAAM,MAAM,uBAAuB,GAAG,OAAO,qBAAqB,CAAC,YAAY,CAAA;AAC/E,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AACtD,MAAM,MAAM,YAAY,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
2
|
+
import { boolean, date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
3
|
+
import { offerItems, offers } from "./schema-offers";
|
|
4
|
+
import { orderStatusEnum, orderTermAcceptanceStatusEnum, orderTermTypeEnum, transactionItemParticipantRoleEnum, transactionItemStatusEnum, transactionItemTypeEnum, transactionParticipantTypeEnum, transactionTravelerCategoryEnum, } from "./schema-shared";
|
|
5
|
+
export const orders = pgTable("orders", {
|
|
6
|
+
id: typeId("orders"),
|
|
7
|
+
orderNumber: text("order_number").notNull().unique(),
|
|
8
|
+
offerId: typeIdRef("offer_id").references(() => offers.id, { onDelete: "set null" }),
|
|
9
|
+
title: text("title").notNull(),
|
|
10
|
+
status: orderStatusEnum("status").notNull().default("draft"),
|
|
11
|
+
personId: text("person_id"),
|
|
12
|
+
organizationId: text("organization_id"),
|
|
13
|
+
opportunityId: text("opportunity_id"),
|
|
14
|
+
quoteId: text("quote_id"),
|
|
15
|
+
marketId: text("market_id"),
|
|
16
|
+
sourceChannelId: text("source_channel_id"),
|
|
17
|
+
currency: text("currency").notNull(),
|
|
18
|
+
baseCurrency: text("base_currency"),
|
|
19
|
+
fxRateSetId: text("fx_rate_set_id"),
|
|
20
|
+
subtotalAmountCents: integer("subtotal_amount_cents").notNull().default(0),
|
|
21
|
+
taxAmountCents: integer("tax_amount_cents").notNull().default(0),
|
|
22
|
+
feeAmountCents: integer("fee_amount_cents").notNull().default(0),
|
|
23
|
+
totalAmountCents: integer("total_amount_cents").notNull().default(0),
|
|
24
|
+
costAmountCents: integer("cost_amount_cents").notNull().default(0),
|
|
25
|
+
orderedAt: timestamp("ordered_at", { withTimezone: true }),
|
|
26
|
+
confirmedAt: timestamp("confirmed_at", { withTimezone: true }),
|
|
27
|
+
cancelledAt: timestamp("cancelled_at", { withTimezone: true }),
|
|
28
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
29
|
+
notes: text("notes"),
|
|
30
|
+
metadata: jsonb("metadata"),
|
|
31
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
32
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
33
|
+
}, (table) => [
|
|
34
|
+
index("idx_orders_offer").on(table.offerId),
|
|
35
|
+
index("idx_orders_status").on(table.status),
|
|
36
|
+
index("idx_orders_person").on(table.personId),
|
|
37
|
+
index("idx_orders_organization").on(table.organizationId),
|
|
38
|
+
index("idx_orders_opportunity").on(table.opportunityId),
|
|
39
|
+
index("idx_orders_quote").on(table.quoteId),
|
|
40
|
+
index("idx_orders_market").on(table.marketId),
|
|
41
|
+
index("idx_orders_channel").on(table.sourceChannelId),
|
|
42
|
+
index("idx_orders_fx_rate_set").on(table.fxRateSetId),
|
|
43
|
+
]);
|
|
44
|
+
export const orderParticipants = pgTable("order_participants", {
|
|
45
|
+
id: typeId("order_participants"),
|
|
46
|
+
orderId: typeIdRef("order_id")
|
|
47
|
+
.notNull()
|
|
48
|
+
.references(() => orders.id, { onDelete: "cascade" }),
|
|
49
|
+
personId: text("person_id"),
|
|
50
|
+
participantType: transactionParticipantTypeEnum("participant_type")
|
|
51
|
+
.notNull()
|
|
52
|
+
.default("traveler"),
|
|
53
|
+
travelerCategory: transactionTravelerCategoryEnum("traveler_category"),
|
|
54
|
+
firstName: text("first_name").notNull(),
|
|
55
|
+
lastName: text("last_name").notNull(),
|
|
56
|
+
email: text("email"),
|
|
57
|
+
phone: text("phone"),
|
|
58
|
+
preferredLanguage: text("preferred_language"),
|
|
59
|
+
identityEncrypted: jsonb("identity_encrypted").$type(),
|
|
60
|
+
isPrimary: boolean("is_primary").notNull().default(false),
|
|
61
|
+
notes: text("notes"),
|
|
62
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
63
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
64
|
+
}, (table) => [
|
|
65
|
+
index("idx_order_participants_order").on(table.orderId),
|
|
66
|
+
index("idx_order_participants_person").on(table.personId),
|
|
67
|
+
index("idx_order_participants_type").on(table.participantType),
|
|
68
|
+
]);
|
|
69
|
+
export const orderItems = pgTable("order_items", {
|
|
70
|
+
id: typeId("order_items"),
|
|
71
|
+
orderId: typeIdRef("order_id")
|
|
72
|
+
.notNull()
|
|
73
|
+
.references(() => orders.id, { onDelete: "cascade" }),
|
|
74
|
+
offerItemId: typeIdRef("offer_item_id").references(() => offerItems.id, {
|
|
75
|
+
onDelete: "set null",
|
|
76
|
+
}),
|
|
77
|
+
productId: text("product_id"),
|
|
78
|
+
optionId: text("option_id"),
|
|
79
|
+
unitId: text("unit_id"),
|
|
80
|
+
slotId: text("slot_id"),
|
|
81
|
+
title: text("title").notNull(),
|
|
82
|
+
description: text("description"),
|
|
83
|
+
itemType: transactionItemTypeEnum("item_type").notNull().default("unit"),
|
|
84
|
+
status: transactionItemStatusEnum("status").notNull().default("draft"),
|
|
85
|
+
serviceDate: date("service_date"),
|
|
86
|
+
startsAt: timestamp("starts_at", { withTimezone: true }),
|
|
87
|
+
endsAt: timestamp("ends_at", { withTimezone: true }),
|
|
88
|
+
quantity: integer("quantity").notNull().default(1),
|
|
89
|
+
sellCurrency: text("sell_currency").notNull(),
|
|
90
|
+
unitSellAmountCents: integer("unit_sell_amount_cents"),
|
|
91
|
+
totalSellAmountCents: integer("total_sell_amount_cents"),
|
|
92
|
+
taxAmountCents: integer("tax_amount_cents"),
|
|
93
|
+
feeAmountCents: integer("fee_amount_cents"),
|
|
94
|
+
costCurrency: text("cost_currency"),
|
|
95
|
+
unitCostAmountCents: integer("unit_cost_amount_cents"),
|
|
96
|
+
totalCostAmountCents: integer("total_cost_amount_cents"),
|
|
97
|
+
notes: text("notes"),
|
|
98
|
+
metadata: jsonb("metadata"),
|
|
99
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
100
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
101
|
+
}, (table) => [
|
|
102
|
+
index("idx_order_items_order").on(table.orderId),
|
|
103
|
+
index("idx_order_items_offer_item").on(table.offerItemId),
|
|
104
|
+
index("idx_order_items_product").on(table.productId),
|
|
105
|
+
index("idx_order_items_option").on(table.optionId),
|
|
106
|
+
index("idx_order_items_unit").on(table.unitId),
|
|
107
|
+
index("idx_order_items_slot").on(table.slotId),
|
|
108
|
+
index("idx_order_items_status").on(table.status),
|
|
109
|
+
]);
|
|
110
|
+
export const orderItemParticipants = pgTable("order_item_participants", {
|
|
111
|
+
id: typeId("order_item_participants"),
|
|
112
|
+
orderItemId: typeIdRef("order_item_id")
|
|
113
|
+
.notNull()
|
|
114
|
+
.references(() => orderItems.id, { onDelete: "cascade" }),
|
|
115
|
+
participantId: typeIdRef("participant_id")
|
|
116
|
+
.notNull()
|
|
117
|
+
.references(() => orderParticipants.id, { onDelete: "cascade" }),
|
|
118
|
+
role: transactionItemParticipantRoleEnum("role").notNull().default("traveler"),
|
|
119
|
+
isPrimary: boolean("is_primary").notNull().default(false),
|
|
120
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
121
|
+
}, (table) => [
|
|
122
|
+
index("idx_order_item_participants_item").on(table.orderItemId),
|
|
123
|
+
index("idx_order_item_participants_participant").on(table.participantId),
|
|
124
|
+
uniqueIndex("uidx_order_item_participants").on(table.orderItemId, table.participantId),
|
|
125
|
+
]);
|
|
126
|
+
export const orderTerms = pgTable("order_terms", {
|
|
127
|
+
id: typeId("order_terms"),
|
|
128
|
+
offerId: typeIdRef("offer_id").references(() => offers.id, { onDelete: "cascade" }),
|
|
129
|
+
orderId: typeIdRef("order_id").references(() => orders.id, { onDelete: "cascade" }),
|
|
130
|
+
termType: orderTermTypeEnum("term_type").notNull().default("terms_and_conditions"),
|
|
131
|
+
title: text("title").notNull(),
|
|
132
|
+
body: text("body").notNull(),
|
|
133
|
+
language: text("language"),
|
|
134
|
+
required: boolean("required").notNull().default(true),
|
|
135
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
136
|
+
acceptanceStatus: orderTermAcceptanceStatusEnum("acceptance_status")
|
|
137
|
+
.notNull()
|
|
138
|
+
.default("pending"),
|
|
139
|
+
acceptedAt: timestamp("accepted_at", { withTimezone: true }),
|
|
140
|
+
acceptedBy: text("accepted_by"),
|
|
141
|
+
metadata: jsonb("metadata"),
|
|
142
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
143
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
144
|
+
}, (table) => [
|
|
145
|
+
index("idx_order_terms_offer").on(table.offerId),
|
|
146
|
+
index("idx_order_terms_order").on(table.orderId),
|
|
147
|
+
index("idx_order_terms_type").on(table.termType),
|
|
148
|
+
index("idx_order_terms_acceptance").on(table.acceptanceStatus),
|
|
149
|
+
]);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const offersRelations: import("drizzle-orm").Relations<"offers", {
|
|
2
|
+
participants: import("drizzle-orm").Many<"offer_participants">;
|
|
3
|
+
items: import("drizzle-orm").Many<"offer_items">;
|
|
4
|
+
orders: import("drizzle-orm").Many<"orders">;
|
|
5
|
+
terms: import("drizzle-orm").Many<"order_terms">;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const offerParticipantsRelations: import("drizzle-orm").Relations<"offer_participants", {
|
|
8
|
+
offer: import("drizzle-orm").One<"offers", true>;
|
|
9
|
+
itemLinks: import("drizzle-orm").Many<"offer_item_participants">;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const offerItemsRelations: import("drizzle-orm").Relations<"offer_items", {
|
|
12
|
+
offer: import("drizzle-orm").One<"offers", true>;
|
|
13
|
+
participants: import("drizzle-orm").Many<"offer_item_participants">;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const offerItemParticipantsRelations: import("drizzle-orm").Relations<"offer_item_participants", {
|
|
16
|
+
offerItem: import("drizzle-orm").One<"offer_items", true>;
|
|
17
|
+
participant: import("drizzle-orm").One<"offer_participants", true>;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const ordersRelations: import("drizzle-orm").Relations<"orders", {
|
|
20
|
+
offer: import("drizzle-orm").One<"offers", false>;
|
|
21
|
+
participants: import("drizzle-orm").Many<"order_participants">;
|
|
22
|
+
items: import("drizzle-orm").Many<"order_items">;
|
|
23
|
+
terms: import("drizzle-orm").Many<"order_terms">;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const orderParticipantsRelations: import("drizzle-orm").Relations<"order_participants", {
|
|
26
|
+
order: import("drizzle-orm").One<"orders", true>;
|
|
27
|
+
itemLinks: import("drizzle-orm").Many<"order_item_participants">;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const orderItemsRelations: import("drizzle-orm").Relations<"order_items", {
|
|
30
|
+
order: import("drizzle-orm").One<"orders", true>;
|
|
31
|
+
offerItem: import("drizzle-orm").One<"offer_items", false>;
|
|
32
|
+
participants: import("drizzle-orm").Many<"order_item_participants">;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const orderItemParticipantsRelations: import("drizzle-orm").Relations<"order_item_participants", {
|
|
35
|
+
orderItem: import("drizzle-orm").One<"order_items", true>;
|
|
36
|
+
participant: import("drizzle-orm").One<"order_participants", true>;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const orderTermsRelations: import("drizzle-orm").Relations<"order_terms", {
|
|
39
|
+
offer: import("drizzle-orm").One<"offers", false>;
|
|
40
|
+
order: import("drizzle-orm").One<"orders", false>;
|
|
41
|
+
}>;
|
|
42
|
+
//# 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":"AAWA,eAAO,MAAM,eAAe;;;;;EAKzB,CAAA;AAEH,eAAO,MAAM,0BAA0B;;;EAGpC,CAAA;AAEH,eAAO,MAAM,mBAAmB;;;EAG7B,CAAA;AAEH,eAAO,MAAM,8BAA8B;;;EASxC,CAAA;AAEH,eAAO,MAAM,eAAe;;;;;EAKzB,CAAA;AAEH,eAAO,MAAM,0BAA0B;;;EAGpC,CAAA;AAEH,eAAO,MAAM,mBAAmB;;;;EAI7B,CAAA;AAEH,eAAO,MAAM,8BAA8B;;;EASxC,CAAA;AAEH,eAAO,MAAM,mBAAmB;;;EAG7B,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { relations } from "drizzle-orm";
|
|
2
|
+
import { offerItemParticipants, offerItems, offerParticipants, offers } from "./schema-offers";
|
|
3
|
+
import { orderItemParticipants, orderItems, orderParticipants, orders, orderTerms, } from "./schema-orders";
|
|
4
|
+
export const offersRelations = relations(offers, ({ many }) => ({
|
|
5
|
+
participants: many(offerParticipants),
|
|
6
|
+
items: many(offerItems),
|
|
7
|
+
orders: many(orders),
|
|
8
|
+
terms: many(orderTerms),
|
|
9
|
+
}));
|
|
10
|
+
export const offerParticipantsRelations = relations(offerParticipants, ({ one, many }) => ({
|
|
11
|
+
offer: one(offers, { fields: [offerParticipants.offerId], references: [offers.id] }),
|
|
12
|
+
itemLinks: many(offerItemParticipants),
|
|
13
|
+
}));
|
|
14
|
+
export const offerItemsRelations = relations(offerItems, ({ one, many }) => ({
|
|
15
|
+
offer: one(offers, { fields: [offerItems.offerId], references: [offers.id] }),
|
|
16
|
+
participants: many(offerItemParticipants),
|
|
17
|
+
}));
|
|
18
|
+
export const offerItemParticipantsRelations = relations(offerItemParticipants, ({ one }) => ({
|
|
19
|
+
offerItem: one(offerItems, {
|
|
20
|
+
fields: [offerItemParticipants.offerItemId],
|
|
21
|
+
references: [offerItems.id],
|
|
22
|
+
}),
|
|
23
|
+
participant: one(offerParticipants, {
|
|
24
|
+
fields: [offerItemParticipants.participantId],
|
|
25
|
+
references: [offerParticipants.id],
|
|
26
|
+
}),
|
|
27
|
+
}));
|
|
28
|
+
export const ordersRelations = relations(orders, ({ one, many }) => ({
|
|
29
|
+
offer: one(offers, { fields: [orders.offerId], references: [offers.id] }),
|
|
30
|
+
participants: many(orderParticipants),
|
|
31
|
+
items: many(orderItems),
|
|
32
|
+
terms: many(orderTerms),
|
|
33
|
+
}));
|
|
34
|
+
export const orderParticipantsRelations = relations(orderParticipants, ({ one, many }) => ({
|
|
35
|
+
order: one(orders, { fields: [orderParticipants.orderId], references: [orders.id] }),
|
|
36
|
+
itemLinks: many(orderItemParticipants),
|
|
37
|
+
}));
|
|
38
|
+
export const orderItemsRelations = relations(orderItems, ({ one, many }) => ({
|
|
39
|
+
order: one(orders, { fields: [orderItems.orderId], references: [orders.id] }),
|
|
40
|
+
offerItem: one(offerItems, { fields: [orderItems.offerItemId], references: [offerItems.id] }),
|
|
41
|
+
participants: many(orderItemParticipants),
|
|
42
|
+
}));
|
|
43
|
+
export const orderItemParticipantsRelations = relations(orderItemParticipants, ({ one }) => ({
|
|
44
|
+
orderItem: one(orderItems, {
|
|
45
|
+
fields: [orderItemParticipants.orderItemId],
|
|
46
|
+
references: [orderItems.id],
|
|
47
|
+
}),
|
|
48
|
+
participant: one(orderParticipants, {
|
|
49
|
+
fields: [orderItemParticipants.participantId],
|
|
50
|
+
references: [orderParticipants.id],
|
|
51
|
+
}),
|
|
52
|
+
}));
|
|
53
|
+
export const orderTermsRelations = relations(orderTerms, ({ one }) => ({
|
|
54
|
+
offer: one(offers, { fields: [orderTerms.offerId], references: [offers.id] }),
|
|
55
|
+
order: one(orders, { fields: [orderTerms.orderId], references: [orders.id] }),
|
|
56
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const offerStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "published", "sent", "accepted", "expired", "withdrawn", "converted"]>;
|
|
2
|
+
export declare const orderStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "pending", "confirmed", "fulfilled", "cancelled", "expired"]>;
|
|
3
|
+
export declare const transactionParticipantTypeEnum: import("drizzle-orm/pg-core").PgEnum<["traveler", "booker", "contact", "occupant", "staff", "other"]>;
|
|
4
|
+
export declare const transactionTravelerCategoryEnum: import("drizzle-orm/pg-core").PgEnum<["adult", "child", "infant", "senior", "other"]>;
|
|
5
|
+
export declare const transactionItemTypeEnum: import("drizzle-orm/pg-core").PgEnum<["unit", "service", "extra", "fee", "tax", "discount", "adjustment", "accommodation", "transport", "other"]>;
|
|
6
|
+
export declare const transactionItemStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "priced", "confirmed", "cancelled", "fulfilled"]>;
|
|
7
|
+
export declare const transactionItemParticipantRoleEnum: import("drizzle-orm/pg-core").PgEnum<["traveler", "occupant", "primary_contact", "beneficiary", "service_assignee", "other"]>;
|
|
8
|
+
export declare const transactionPiiAccessActionEnum: import("drizzle-orm/pg-core").PgEnum<["read", "update", "delete"]>;
|
|
9
|
+
export declare const transactionPiiAccessOutcomeEnum: import("drizzle-orm/pg-core").PgEnum<["allowed", "denied"]>;
|
|
10
|
+
export declare const orderTermTypeEnum: import("drizzle-orm/pg-core").PgEnum<["terms_and_conditions", "cancellation", "guarantee", "payment", "pricing", "commission", "other"]>;
|
|
11
|
+
export declare const orderTermAcceptanceStatusEnum: import("drizzle-orm/pg-core").PgEnum<["not_required", "pending", "accepted", "declined"]>;
|
|
12
|
+
//# sourceMappingURL=schema-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-shared.d.ts","sourceRoot":"","sources":["../src/schema-shared.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,uHAQ1B,CAAA;AAEF,eAAO,MAAM,eAAe,8GAO1B,CAAA;AAEF,eAAO,MAAM,8BAA8B,uGAOzC,CAAA;AAEF,eAAO,MAAM,+BAA+B,uFAM1C,CAAA;AAEF,eAAO,MAAM,uBAAuB,mJAWlC,CAAA;AAEF,eAAO,MAAM,yBAAyB,kGAMpC,CAAA;AAEF,eAAO,MAAM,kCAAkC,+HAO7C,CAAA;AAEF,eAAO,MAAM,8BAA8B,oEAIzC,CAAA;AAEF,eAAO,MAAM,+BAA+B,6DAG1C,CAAA;AAEF,eAAO,MAAM,iBAAiB,0IAQ5B,CAAA;AAEF,eAAO,MAAM,6BAA6B,2FAKxC,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { pgEnum } from "drizzle-orm/pg-core";
|
|
2
|
+
export const offerStatusEnum = pgEnum("offer_status", [
|
|
3
|
+
"draft",
|
|
4
|
+
"published",
|
|
5
|
+
"sent",
|
|
6
|
+
"accepted",
|
|
7
|
+
"expired",
|
|
8
|
+
"withdrawn",
|
|
9
|
+
"converted",
|
|
10
|
+
]);
|
|
11
|
+
export const orderStatusEnum = pgEnum("order_status", [
|
|
12
|
+
"draft",
|
|
13
|
+
"pending",
|
|
14
|
+
"confirmed",
|
|
15
|
+
"fulfilled",
|
|
16
|
+
"cancelled",
|
|
17
|
+
"expired",
|
|
18
|
+
]);
|
|
19
|
+
export const transactionParticipantTypeEnum = pgEnum("transaction_participant_type", [
|
|
20
|
+
"traveler",
|
|
21
|
+
"booker",
|
|
22
|
+
"contact",
|
|
23
|
+
"occupant",
|
|
24
|
+
"staff",
|
|
25
|
+
"other",
|
|
26
|
+
]);
|
|
27
|
+
export const transactionTravelerCategoryEnum = pgEnum("transaction_traveler_category", [
|
|
28
|
+
"adult",
|
|
29
|
+
"child",
|
|
30
|
+
"infant",
|
|
31
|
+
"senior",
|
|
32
|
+
"other",
|
|
33
|
+
]);
|
|
34
|
+
export const transactionItemTypeEnum = pgEnum("transaction_item_type", [
|
|
35
|
+
"unit",
|
|
36
|
+
"service",
|
|
37
|
+
"extra",
|
|
38
|
+
"fee",
|
|
39
|
+
"tax",
|
|
40
|
+
"discount",
|
|
41
|
+
"adjustment",
|
|
42
|
+
"accommodation",
|
|
43
|
+
"transport",
|
|
44
|
+
"other",
|
|
45
|
+
]);
|
|
46
|
+
export const transactionItemStatusEnum = pgEnum("transaction_item_status", [
|
|
47
|
+
"draft",
|
|
48
|
+
"priced",
|
|
49
|
+
"confirmed",
|
|
50
|
+
"cancelled",
|
|
51
|
+
"fulfilled",
|
|
52
|
+
]);
|
|
53
|
+
export const transactionItemParticipantRoleEnum = pgEnum("transaction_item_participant_role", [
|
|
54
|
+
"traveler",
|
|
55
|
+
"occupant",
|
|
56
|
+
"primary_contact",
|
|
57
|
+
"beneficiary",
|
|
58
|
+
"service_assignee",
|
|
59
|
+
"other",
|
|
60
|
+
]);
|
|
61
|
+
export const transactionPiiAccessActionEnum = pgEnum("transaction_pii_access_action", [
|
|
62
|
+
"read",
|
|
63
|
+
"update",
|
|
64
|
+
"delete",
|
|
65
|
+
]);
|
|
66
|
+
export const transactionPiiAccessOutcomeEnum = pgEnum("transaction_pii_access_outcome", [
|
|
67
|
+
"allowed",
|
|
68
|
+
"denied",
|
|
69
|
+
]);
|
|
70
|
+
export const orderTermTypeEnum = pgEnum("order_term_type", [
|
|
71
|
+
"terms_and_conditions",
|
|
72
|
+
"cancellation",
|
|
73
|
+
"guarantee",
|
|
74
|
+
"payment",
|
|
75
|
+
"pricing",
|
|
76
|
+
"commission",
|
|
77
|
+
"other",
|
|
78
|
+
]);
|
|
79
|
+
export const orderTermAcceptanceStatusEnum = pgEnum("order_term_acceptance_status", [
|
|
80
|
+
"not_required",
|
|
81
|
+
"pending",
|
|
82
|
+
"accepted",
|
|
83
|
+
"declined",
|
|
84
|
+
]);
|