@voyantjs/hospitality 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-accommodation.d.ts +1196 -0
- package/dist/routes-accommodation.d.ts.map +1 -0
- package/dist/routes-accommodation.js +194 -0
- package/dist/routes-inventory.d.ts +981 -0
- package/dist/routes-inventory.d.ts.map +1 -0
- package/dist/routes-inventory.js +159 -0
- package/dist/routes-operations.d.ts +2349 -0
- package/dist/routes-operations.d.ts.map +1 -0
- package/dist/routes-operations.js +6 -0
- package/dist/routes-shared.d.ts +11 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +3 -0
- package/dist/routes-stays.d.ts +1371 -0
- package/dist/routes-stays.d.ts.map +1 -0
- package/dist/routes-stays.js +211 -0
- package/dist/routes.d.ts +520 -527
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +4 -551
- package/dist/schema-bookings.d.ts +1476 -0
- package/dist/schema-bookings.d.ts.map +1 -0
- package/dist/schema-bookings.js +156 -0
- package/dist/schema-inventory.d.ts +1593 -0
- package/dist/schema-inventory.d.ts.map +1 -0
- package/dist/schema-inventory.js +154 -0
- package/dist/schema-operations.d.ts +1076 -0
- package/dist/schema-operations.d.ts.map +1 -0
- package/dist/schema-operations.js +114 -0
- package/dist/schema-pricing.d.ts +1065 -0
- package/dist/schema-pricing.d.ts.map +1 -0
- package/dist/schema-pricing.js +107 -0
- package/dist/schema-relations.d.ts +118 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +199 -0
- package/dist/schema-shared.d.ts +13 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +73 -0
- package/dist/schema.d.ts +6 -5335
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -779
- package/dist/service.d.ts +37 -37
- package/dist/validation-accommodation.d.ts +438 -0
- package/dist/validation-accommodation.d.ts.map +1 -0
- package/dist/validation-accommodation.js +151 -0
- package/dist/validation-operations.d.ts +860 -0
- package/dist/validation-operations.d.ts.map +1 -0
- package/dist/validation-operations.js +293 -0
- package/dist/validation-shared.d.ts +94 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +79 -0
- package/dist/validation.d.ts +3 -1377
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -520
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-bookings.d.ts","sourceRoot":"","sources":["../src/schema-bookings.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC5B,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuB1B,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA;AACrE,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAA;AAC9D,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,CAAC,YAAY,CAAA;AACjE,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AACtD,MAAM,MAAM,YAAY,GAAG,OAAO,UAAU,CAAC,YAAY,CAAA;AACzD,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC7E,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACvE,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { bookingItems } from "@voyantjs/bookings/schema";
|
|
2
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
3
|
+
import { properties } from "@voyantjs/facilities/schema";
|
|
4
|
+
import { date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
5
|
+
import { mealPlans, ratePlans, roomTypes, roomUnits } from "./schema-inventory";
|
|
6
|
+
import { hospitalityHousekeepingTaskStatusEnum, hospitalityMaintenanceBlockStatusEnum, hospitalityRoomBlockStatusEnum, stayBookingItemStatusEnum, } from "./schema-shared";
|
|
7
|
+
export const stayBookingItems = pgTable("stay_booking_items", {
|
|
8
|
+
id: typeId("stay_booking_items"),
|
|
9
|
+
bookingItemId: typeIdRef("booking_item_id")
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => bookingItems.id, { onDelete: "cascade" }),
|
|
12
|
+
propertyId: typeIdRef("property_id")
|
|
13
|
+
.notNull()
|
|
14
|
+
.references(() => properties.id, { onDelete: "cascade" }),
|
|
15
|
+
roomTypeId: typeIdRef("room_type_id")
|
|
16
|
+
.notNull()
|
|
17
|
+
.references(() => roomTypes.id, { onDelete: "cascade" }),
|
|
18
|
+
roomUnitId: typeIdRef("room_unit_id").references(() => roomUnits.id, { onDelete: "set null" }),
|
|
19
|
+
ratePlanId: typeIdRef("rate_plan_id")
|
|
20
|
+
.notNull()
|
|
21
|
+
.references(() => ratePlans.id, { onDelete: "cascade" }),
|
|
22
|
+
checkInDate: date("check_in_date").notNull(),
|
|
23
|
+
checkOutDate: date("check_out_date").notNull(),
|
|
24
|
+
nightCount: integer("night_count").notNull().default(1),
|
|
25
|
+
roomCount: integer("room_count").notNull().default(1),
|
|
26
|
+
adults: integer("adults").notNull().default(1),
|
|
27
|
+
children: integer("children").notNull().default(0),
|
|
28
|
+
infants: integer("infants").notNull().default(0),
|
|
29
|
+
mealPlanId: typeIdRef("meal_plan_id").references(() => mealPlans.id, { onDelete: "set null" }),
|
|
30
|
+
confirmationCode: text("confirmation_code"),
|
|
31
|
+
voucherCode: text("voucher_code"),
|
|
32
|
+
status: stayBookingItemStatusEnum("status").notNull().default("reserved"),
|
|
33
|
+
notes: text("notes"),
|
|
34
|
+
metadata: jsonb("metadata").$type(),
|
|
35
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
36
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
37
|
+
}, (table) => [
|
|
38
|
+
index("idx_stay_booking_items_booking_item").on(table.bookingItemId),
|
|
39
|
+
index("idx_stay_booking_items_property").on(table.propertyId),
|
|
40
|
+
index("idx_stay_booking_items_room_type").on(table.roomTypeId),
|
|
41
|
+
index("idx_stay_booking_items_room_unit").on(table.roomUnitId),
|
|
42
|
+
index("idx_stay_booking_items_rate_plan").on(table.ratePlanId),
|
|
43
|
+
uniqueIndex("uidx_stay_booking_items_booking_item").on(table.bookingItemId),
|
|
44
|
+
]);
|
|
45
|
+
export const stayDailyRates = pgTable("stay_daily_rates", {
|
|
46
|
+
id: typeId("stay_daily_rates"),
|
|
47
|
+
stayBookingItemId: typeIdRef("stay_booking_item_id")
|
|
48
|
+
.notNull()
|
|
49
|
+
.references(() => stayBookingItems.id, { onDelete: "cascade" }),
|
|
50
|
+
date: date("date").notNull(),
|
|
51
|
+
sellCurrency: text("sell_currency").notNull(),
|
|
52
|
+
sellAmountCents: integer("sell_amount_cents"),
|
|
53
|
+
costCurrency: text("cost_currency"),
|
|
54
|
+
costAmountCents: integer("cost_amount_cents"),
|
|
55
|
+
taxAmountCents: integer("tax_amount_cents"),
|
|
56
|
+
feeAmountCents: integer("fee_amount_cents"),
|
|
57
|
+
commissionAmountCents: integer("commission_amount_cents"),
|
|
58
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
59
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
60
|
+
}, (table) => [
|
|
61
|
+
index("idx_stay_daily_rates_stay_booking_item").on(table.stayBookingItemId),
|
|
62
|
+
index("idx_stay_daily_rates_date").on(table.date),
|
|
63
|
+
uniqueIndex("uidx_stay_daily_rates_item_date").on(table.stayBookingItemId, table.date),
|
|
64
|
+
]);
|
|
65
|
+
export const roomBlocks = pgTable("room_blocks", {
|
|
66
|
+
id: typeId("room_blocks"),
|
|
67
|
+
propertyId: typeIdRef("property_id")
|
|
68
|
+
.notNull()
|
|
69
|
+
.references(() => properties.id, { onDelete: "cascade" }),
|
|
70
|
+
roomTypeId: typeIdRef("room_type_id").references(() => roomTypes.id, { onDelete: "set null" }),
|
|
71
|
+
roomUnitId: typeIdRef("room_unit_id").references(() => roomUnits.id, { onDelete: "set null" }),
|
|
72
|
+
startsOn: date("starts_on").notNull(),
|
|
73
|
+
endsOn: date("ends_on").notNull(),
|
|
74
|
+
status: hospitalityRoomBlockStatusEnum("status").notNull().default("draft"),
|
|
75
|
+
blockReason: text("block_reason"),
|
|
76
|
+
quantity: integer("quantity").notNull().default(1),
|
|
77
|
+
releaseAt: timestamp("release_at", { withTimezone: true }),
|
|
78
|
+
notes: text("notes"),
|
|
79
|
+
metadata: jsonb("metadata").$type(),
|
|
80
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
81
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
82
|
+
}, (table) => [
|
|
83
|
+
index("idx_room_blocks_property").on(table.propertyId),
|
|
84
|
+
index("idx_room_blocks_room_type").on(table.roomTypeId),
|
|
85
|
+
index("idx_room_blocks_room_unit").on(table.roomUnitId),
|
|
86
|
+
index("idx_room_blocks_status").on(table.status),
|
|
87
|
+
index("idx_room_blocks_dates").on(table.startsOn, table.endsOn),
|
|
88
|
+
]);
|
|
89
|
+
export const roomUnitStatusEvents = pgTable("room_unit_status_events", {
|
|
90
|
+
id: typeId("room_unit_status_events"),
|
|
91
|
+
roomUnitId: typeIdRef("room_unit_id")
|
|
92
|
+
.notNull()
|
|
93
|
+
.references(() => roomUnits.id, { onDelete: "cascade" }),
|
|
94
|
+
statusCode: text("status_code").notNull(),
|
|
95
|
+
housekeepingStatus: text("housekeeping_status"),
|
|
96
|
+
effectiveFrom: timestamp("effective_from", { withTimezone: true }).notNull().defaultNow(),
|
|
97
|
+
effectiveTo: timestamp("effective_to", { withTimezone: true }),
|
|
98
|
+
notes: text("notes"),
|
|
99
|
+
metadata: jsonb("metadata").$type(),
|
|
100
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
101
|
+
}, (table) => [
|
|
102
|
+
index("idx_room_unit_status_events_room_unit").on(table.roomUnitId),
|
|
103
|
+
index("idx_room_unit_status_events_status").on(table.statusCode),
|
|
104
|
+
index("idx_room_unit_status_events_effective_from").on(table.effectiveFrom),
|
|
105
|
+
]);
|
|
106
|
+
export const maintenanceBlocks = pgTable("maintenance_blocks", {
|
|
107
|
+
id: typeId("maintenance_blocks"),
|
|
108
|
+
propertyId: typeIdRef("property_id")
|
|
109
|
+
.notNull()
|
|
110
|
+
.references(() => properties.id, { onDelete: "cascade" }),
|
|
111
|
+
roomTypeId: typeIdRef("room_type_id").references(() => roomTypes.id, { onDelete: "set null" }),
|
|
112
|
+
roomUnitId: typeIdRef("room_unit_id").references(() => roomUnits.id, { onDelete: "set null" }),
|
|
113
|
+
startsOn: date("starts_on").notNull(),
|
|
114
|
+
endsOn: date("ends_on").notNull(),
|
|
115
|
+
status: hospitalityMaintenanceBlockStatusEnum("status").notNull().default("open"),
|
|
116
|
+
reason: text("reason"),
|
|
117
|
+
notes: text("notes"),
|
|
118
|
+
metadata: jsonb("metadata").$type(),
|
|
119
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
120
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
121
|
+
}, (table) => [
|
|
122
|
+
index("idx_maintenance_blocks_property").on(table.propertyId),
|
|
123
|
+
index("idx_maintenance_blocks_room_type").on(table.roomTypeId),
|
|
124
|
+
index("idx_maintenance_blocks_room_unit").on(table.roomUnitId),
|
|
125
|
+
index("idx_maintenance_blocks_status").on(table.status),
|
|
126
|
+
index("idx_maintenance_blocks_dates").on(table.startsOn, table.endsOn),
|
|
127
|
+
]);
|
|
128
|
+
export const housekeepingTasks = pgTable("housekeeping_tasks", {
|
|
129
|
+
id: typeId("housekeeping_tasks"),
|
|
130
|
+
propertyId: typeIdRef("property_id")
|
|
131
|
+
.notNull()
|
|
132
|
+
.references(() => properties.id, { onDelete: "cascade" }),
|
|
133
|
+
roomUnitId: typeIdRef("room_unit_id")
|
|
134
|
+
.notNull()
|
|
135
|
+
.references(() => roomUnits.id, { onDelete: "cascade" }),
|
|
136
|
+
stayBookingItemId: typeIdRef("stay_booking_item_id").references(() => stayBookingItems.id, {
|
|
137
|
+
onDelete: "set null",
|
|
138
|
+
}),
|
|
139
|
+
taskType: text("task_type").notNull(),
|
|
140
|
+
status: hospitalityHousekeepingTaskStatusEnum("status").notNull().default("open"),
|
|
141
|
+
priority: integer("priority").notNull().default(0),
|
|
142
|
+
dueAt: timestamp("due_at", { withTimezone: true }),
|
|
143
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
144
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
145
|
+
assignedTo: text("assigned_to"),
|
|
146
|
+
notes: text("notes"),
|
|
147
|
+
metadata: jsonb("metadata").$type(),
|
|
148
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
149
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
150
|
+
}, (table) => [
|
|
151
|
+
index("idx_housekeeping_tasks_property").on(table.propertyId),
|
|
152
|
+
index("idx_housekeeping_tasks_room_unit").on(table.roomUnitId),
|
|
153
|
+
index("idx_housekeeping_tasks_stay_booking_item").on(table.stayBookingItemId),
|
|
154
|
+
index("idx_housekeeping_tasks_status").on(table.status),
|
|
155
|
+
index("idx_housekeeping_tasks_due_at").on(table.dueAt),
|
|
156
|
+
]);
|