@voyantjs/bookings 0.2.0 → 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/schema-core.d.ts +1229 -0
- package/dist/schema-core.d.ts.map +1 -0
- package/dist/schema-core.js +81 -0
- package/dist/schema-items.d.ts +1278 -0
- package/dist/schema-items.d.ts.map +1 -0
- package/dist/schema-items.js +130 -0
- package/dist/schema-operations.d.ts +600 -0
- package/dist/schema-operations.d.ts.map +1 -0
- package/dist/schema-operations.js +61 -0
- package/dist/schema-relations.d.ts +58 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +95 -0
- package/dist/schema-shared.d.ts +19 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +137 -0
- package/dist/schema.d.ts +5 -3179
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +5 -509
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-core.d.ts","sourceRoot":"","sources":["../src/schema-core.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsB,CAAA;AACpD,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AACjD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AACvD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA;AACzE,MAAM,MAAM,sBAAsB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
2
|
+
import { boolean, date, index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
|
+
import { bookingParticipantTypeEnum, bookingPiiAccessActionEnum, bookingPiiAccessOutcomeEnum, bookingSourceTypeEnum, bookingStatusEnum, bookingTravelerCategoryEnum, } from "./schema-shared";
|
|
4
|
+
export const bookings = pgTable("bookings", {
|
|
5
|
+
id: typeId("bookings"),
|
|
6
|
+
bookingNumber: text("booking_number").notNull().unique(),
|
|
7
|
+
status: bookingStatusEnum("status").notNull().default("draft"),
|
|
8
|
+
personId: text("person_id"),
|
|
9
|
+
organizationId: text("organization_id"),
|
|
10
|
+
sourceType: bookingSourceTypeEnum("source_type").notNull().default("manual"),
|
|
11
|
+
externalBookingRef: text("external_booking_ref"),
|
|
12
|
+
communicationLanguage: text("communication_language"),
|
|
13
|
+
sellCurrency: text("sell_currency").notNull(),
|
|
14
|
+
baseCurrency: text("base_currency"),
|
|
15
|
+
sellAmountCents: integer("sell_amount_cents"),
|
|
16
|
+
baseSellAmountCents: integer("base_sell_amount_cents"),
|
|
17
|
+
costAmountCents: integer("cost_amount_cents"),
|
|
18
|
+
baseCostAmountCents: integer("base_cost_amount_cents"),
|
|
19
|
+
marginPercent: integer("margin_percent"),
|
|
20
|
+
startDate: date("start_date"),
|
|
21
|
+
endDate: date("end_date"),
|
|
22
|
+
pax: integer("pax"),
|
|
23
|
+
internalNotes: text("internal_notes"),
|
|
24
|
+
holdExpiresAt: timestamp("hold_expires_at", { withTimezone: true }),
|
|
25
|
+
confirmedAt: timestamp("confirmed_at", { withTimezone: true }),
|
|
26
|
+
expiredAt: timestamp("expired_at", { withTimezone: true }),
|
|
27
|
+
cancelledAt: timestamp("cancelled_at", { withTimezone: true }),
|
|
28
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
29
|
+
redeemedAt: timestamp("redeemed_at", { withTimezone: true }),
|
|
30
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
31
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
32
|
+
}, (table) => [
|
|
33
|
+
index("idx_bookings_status").on(table.status),
|
|
34
|
+
index("idx_bookings_person").on(table.personId),
|
|
35
|
+
index("idx_bookings_organization").on(table.organizationId),
|
|
36
|
+
index("idx_bookings_source_type").on(table.sourceType),
|
|
37
|
+
index("idx_bookings_number").on(table.bookingNumber),
|
|
38
|
+
]);
|
|
39
|
+
export const bookingParticipants = pgTable("booking_participants", {
|
|
40
|
+
id: typeId("booking_participants"),
|
|
41
|
+
bookingId: typeIdRef("booking_id")
|
|
42
|
+
.notNull()
|
|
43
|
+
.references(() => bookings.id, { onDelete: "cascade" }),
|
|
44
|
+
personId: text("person_id"),
|
|
45
|
+
participantType: bookingParticipantTypeEnum("participant_type").notNull().default("traveler"),
|
|
46
|
+
travelerCategory: bookingTravelerCategoryEnum("traveler_category"),
|
|
47
|
+
firstName: text("first_name").notNull(),
|
|
48
|
+
lastName: text("last_name").notNull(),
|
|
49
|
+
email: text("email"),
|
|
50
|
+
phone: text("phone"),
|
|
51
|
+
preferredLanguage: text("preferred_language"),
|
|
52
|
+
accessibilityNeeds: text("accessibility_needs"),
|
|
53
|
+
specialRequests: text("special_requests"),
|
|
54
|
+
isPrimary: boolean("is_primary").notNull().default(false),
|
|
55
|
+
notes: text("notes"),
|
|
56
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
57
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
58
|
+
}, (table) => [
|
|
59
|
+
index("idx_booking_participants_booking").on(table.bookingId),
|
|
60
|
+
index("idx_booking_participants_type").on(table.participantType),
|
|
61
|
+
index("idx_booking_participants_person").on(table.personId),
|
|
62
|
+
]);
|
|
63
|
+
export const bookingPiiAccessLog = pgTable("booking_pii_access_log", {
|
|
64
|
+
id: typeId("booking_pii_access_log"),
|
|
65
|
+
bookingId: text("booking_id"),
|
|
66
|
+
participantId: text("participant_id"),
|
|
67
|
+
actorId: text("actor_id"),
|
|
68
|
+
actorType: text("actor_type"),
|
|
69
|
+
callerType: text("caller_type"),
|
|
70
|
+
action: bookingPiiAccessActionEnum("action").notNull(),
|
|
71
|
+
outcome: bookingPiiAccessOutcomeEnum("outcome").notNull(),
|
|
72
|
+
reason: text("reason"),
|
|
73
|
+
metadata: jsonb("metadata").$type(),
|
|
74
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
75
|
+
}, (table) => [
|
|
76
|
+
index("idx_booking_pii_access_log_booking").on(table.bookingId),
|
|
77
|
+
index("idx_booking_pii_access_log_participant").on(table.participantId),
|
|
78
|
+
index("idx_booking_pii_access_log_actor").on(table.actorId),
|
|
79
|
+
index("idx_booking_pii_access_log_created_at").on(table.createdAt),
|
|
80
|
+
]);
|
|
81
|
+
export const bookingPassengers = bookingParticipants;
|