@voyantjs/ground 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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-dispatch.d.ts","sourceRoot":"","sources":["../src/schema-dispatch.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCrC,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC5B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACvF,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAA"}
@@ -0,0 +1,79 @@
1
+ import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
+ import { facilities } from "@voyantjs/facilities/schema";
3
+ import { identityAddresses } from "@voyantjs/identity/schema";
4
+ import { boolean, date, index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
5
+ import { groundDrivers, groundOperators, groundVehicles } from "./schema-operators";
6
+ import { groundDispatchStatusEnum, groundServiceLevelEnum, groundVehicleCategoryEnum, groundVehicleClassEnum, } from "./schema-shared";
7
+ export const groundTransferPreferences = pgTable("ground_transfer_preferences", {
8
+ id: typeId("ground_transfer_preferences"),
9
+ bookingId: text("booking_id").notNull(),
10
+ bookingItemId: text("booking_item_id"),
11
+ pickupFacilityId: typeIdRef("pickup_facility_id").references(() => facilities.id, {
12
+ onDelete: "set null",
13
+ }),
14
+ dropoffFacilityId: typeIdRef("dropoff_facility_id").references(() => facilities.id, {
15
+ onDelete: "set null",
16
+ }),
17
+ pickupAddressId: typeIdRef("pickup_address_id").references(() => identityAddresses.id, {
18
+ onDelete: "set null",
19
+ }),
20
+ dropoffAddressId: typeIdRef("dropoff_address_id").references(() => identityAddresses.id, {
21
+ onDelete: "set null",
22
+ }),
23
+ requestedVehicleCategory: groundVehicleCategoryEnum("requested_vehicle_category"),
24
+ requestedVehicleClass: groundVehicleClassEnum("requested_vehicle_class"),
25
+ serviceLevel: groundServiceLevelEnum("service_level").notNull().default("private"),
26
+ passengerCount: integer("passenger_count"),
27
+ checkedBags: integer("checked_bags"),
28
+ carryOnBags: integer("carry_on_bags"),
29
+ wheelchairCount: integer("wheelchair_count"),
30
+ childSeatCount: integer("child_seat_count"),
31
+ driverLanguage: text("driver_language"),
32
+ meetAndGreet: boolean("meet_and_greet").notNull().default(false),
33
+ accessibilityNotes: text("accessibility_notes"),
34
+ pickupNotes: text("pickup_notes"),
35
+ dropoffNotes: text("dropoff_notes"),
36
+ notes: text("notes"),
37
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
38
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
39
+ }, (table) => [
40
+ index("idx_ground_transfer_preferences_booking").on(table.bookingId),
41
+ index("idx_ground_transfer_preferences_booking_item").on(table.bookingItemId),
42
+ index("idx_ground_transfer_preferences_service_level").on(table.serviceLevel),
43
+ ]);
44
+ export const groundDispatches = pgTable("ground_dispatches", {
45
+ id: typeId("ground_dispatches"),
46
+ transferPreferenceId: typeIdRef("transfer_preference_id")
47
+ .notNull()
48
+ .references(() => groundTransferPreferences.id, { onDelete: "cascade" }),
49
+ bookingId: text("booking_id").notNull(),
50
+ bookingItemId: text("booking_item_id"),
51
+ operatorId: typeIdRef("operator_id").references(() => groundOperators.id, {
52
+ onDelete: "set null",
53
+ }),
54
+ vehicleId: typeIdRef("vehicle_id").references(() => groundVehicles.id, {
55
+ onDelete: "set null",
56
+ }),
57
+ driverId: typeIdRef("driver_id").references(() => groundDrivers.id, { onDelete: "set null" }),
58
+ serviceDate: date("service_date"),
59
+ scheduledPickupAt: timestamp("scheduled_pickup_at", { withTimezone: true }),
60
+ scheduledDropoffAt: timestamp("scheduled_dropoff_at", { withTimezone: true }),
61
+ actualPickupAt: timestamp("actual_pickup_at", { withTimezone: true }),
62
+ actualDropoffAt: timestamp("actual_dropoff_at", { withTimezone: true }),
63
+ status: groundDispatchStatusEnum("status").notNull().default("draft"),
64
+ passengerCount: integer("passenger_count"),
65
+ checkedBags: integer("checked_bags"),
66
+ carryOnBags: integer("carry_on_bags"),
67
+ notes: text("notes"),
68
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
69
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
70
+ }, (table) => [
71
+ index("idx_ground_dispatches_preference").on(table.transferPreferenceId),
72
+ index("idx_ground_dispatches_booking").on(table.bookingId),
73
+ index("idx_ground_dispatches_booking_item").on(table.bookingItemId),
74
+ index("idx_ground_dispatches_operator").on(table.operatorId),
75
+ index("idx_ground_dispatches_vehicle").on(table.vehicleId),
76
+ index("idx_ground_dispatches_driver").on(table.driverId),
77
+ index("idx_ground_dispatches_status").on(table.status),
78
+ index("idx_ground_dispatches_service_date").on(table.serviceDate),
79
+ ]);