@voyantjs/ground 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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-operations.d.ts","sourceRoot":"","sources":["../src/schema-operations.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBjC,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BrC,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyB9B,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBpC,CAA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kB,CAAC,YAAY,CAAA;AACzE,MAAM,MAAM,uBAAuB,GAAG,OAAO,wBAAwB,CAAC,YAAY,CAAA;AAClF,MAAM,MAAM,0BAA0B,GAAG,OAAO,wBAAwB,CAAC,YAAY,CAAA;AACrF,MAAM,MAAM,iBAAiB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAA;AACtE,MAAM,MAAM,oBAAoB,GAAG,OAAO,kBAAkB,CAAC,YAAY,CAAA;AACzE,MAAM,MAAM,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AACjF,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA"}
@@ -0,0 +1,155 @@
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 { index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
5
+ import { groundDispatches } from "./schema-dispatch";
6
+ import { groundDrivers, groundOperators, groundVehicles } from "./schema-operators";
7
+ import { groundAssignmentSourceEnum, groundCheckpointStatusEnum, groundDispatchLegTypeEnum, groundDriverShiftStatusEnum, groundExecutionEventTypeEnum, groundIncidentResolutionStatusEnum, groundIncidentSeverityEnum, } from "./schema-shared";
8
+ export const groundExecutionEvents = pgTable("ground_execution_events", {
9
+ id: typeId("ground_execution_events"),
10
+ dispatchId: typeIdRef("dispatch_id")
11
+ .notNull()
12
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
13
+ eventType: groundExecutionEventTypeEnum("event_type").notNull().default("note"),
14
+ occurredAt: timestamp("occurred_at", { withTimezone: true }).notNull().defaultNow(),
15
+ facilityId: typeIdRef("facility_id").references(() => facilities.id, { onDelete: "set null" }),
16
+ addressId: typeIdRef("address_id").references(() => identityAddresses.id, {
17
+ onDelete: "set null",
18
+ }),
19
+ notes: text("notes"),
20
+ metadata: jsonb("metadata").$type(),
21
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
22
+ }, (table) => [
23
+ index("idx_ground_execution_events_dispatch").on(table.dispatchId),
24
+ index("idx_ground_execution_events_type").on(table.eventType),
25
+ index("idx_ground_execution_events_occurred_at").on(table.occurredAt),
26
+ ]);
27
+ export const groundDispatchAssignments = pgTable("ground_dispatch_assignments", {
28
+ id: typeId("ground_dispatch_assignments"),
29
+ dispatchId: typeIdRef("dispatch_id")
30
+ .notNull()
31
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
32
+ operatorId: typeIdRef("operator_id").references(() => groundOperators.id, {
33
+ onDelete: "set null",
34
+ }),
35
+ vehicleId: typeIdRef("vehicle_id").references(() => groundVehicles.id, {
36
+ onDelete: "set null",
37
+ }),
38
+ driverId: typeIdRef("driver_id").references(() => groundDrivers.id, { onDelete: "set null" }),
39
+ assignmentSource: groundAssignmentSourceEnum("assignment_source").notNull().default("manual"),
40
+ assignedAt: timestamp("assigned_at", { withTimezone: true }).notNull().defaultNow(),
41
+ acceptedAt: timestamp("accepted_at", { withTimezone: true }),
42
+ notes: text("notes"),
43
+ metadata: jsonb("metadata").$type(),
44
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
45
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
46
+ }, (table) => [
47
+ index("idx_ground_dispatch_assignments_dispatch").on(table.dispatchId),
48
+ index("idx_ground_dispatch_assignments_operator").on(table.operatorId),
49
+ index("idx_ground_dispatch_assignments_vehicle").on(table.vehicleId),
50
+ index("idx_ground_dispatch_assignments_driver").on(table.driverId),
51
+ index("idx_ground_dispatch_assignments_source").on(table.assignmentSource),
52
+ ]);
53
+ export const groundDispatchLegs = pgTable("ground_dispatch_legs", {
54
+ id: typeId("ground_dispatch_legs"),
55
+ dispatchId: typeIdRef("dispatch_id")
56
+ .notNull()
57
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
58
+ sequence: integer("sequence").notNull().default(0),
59
+ legType: groundDispatchLegTypeEnum("leg_type").notNull().default("pickup"),
60
+ facilityId: typeIdRef("facility_id").references(() => facilities.id, { onDelete: "set null" }),
61
+ addressId: typeIdRef("address_id").references(() => identityAddresses.id, {
62
+ onDelete: "set null",
63
+ }),
64
+ scheduledAt: timestamp("scheduled_at", { withTimezone: true }),
65
+ actualAt: timestamp("actual_at", { withTimezone: true }),
66
+ notes: text("notes"),
67
+ metadata: jsonb("metadata").$type(),
68
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
69
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
70
+ }, (table) => [
71
+ index("idx_ground_dispatch_legs_dispatch").on(table.dispatchId),
72
+ index("idx_ground_dispatch_legs_sequence").on(table.sequence),
73
+ index("idx_ground_dispatch_legs_type").on(table.legType),
74
+ ]);
75
+ export const groundDispatchPassengers = pgTable("ground_dispatch_passengers", {
76
+ id: typeId("ground_dispatch_passengers"),
77
+ dispatchId: typeIdRef("dispatch_id")
78
+ .notNull()
79
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
80
+ participantId: text("participant_id"),
81
+ displayName: text("display_name"),
82
+ seatLabel: text("seat_label"),
83
+ notes: text("notes"),
84
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
85
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
86
+ }, (table) => [
87
+ index("idx_ground_dispatch_passengers_dispatch").on(table.dispatchId),
88
+ index("idx_ground_dispatch_passengers_participant").on(table.participantId),
89
+ ]);
90
+ export const groundDriverShifts = pgTable("ground_driver_shifts", {
91
+ id: typeId("ground_driver_shifts"),
92
+ driverId: typeIdRef("driver_id")
93
+ .notNull()
94
+ .references(() => groundDrivers.id, { onDelete: "cascade" }),
95
+ operatorId: typeIdRef("operator_id").references(() => groundOperators.id, {
96
+ onDelete: "set null",
97
+ }),
98
+ facilityId: typeIdRef("facility_id").references(() => facilities.id, { onDelete: "set null" }),
99
+ startsAt: timestamp("starts_at", { withTimezone: true }).notNull(),
100
+ endsAt: timestamp("ends_at", { withTimezone: true }).notNull(),
101
+ status: groundDriverShiftStatusEnum("status").notNull().default("scheduled"),
102
+ notes: text("notes"),
103
+ metadata: jsonb("metadata").$type(),
104
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
105
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
106
+ }, (table) => [
107
+ index("idx_ground_driver_shifts_driver").on(table.driverId),
108
+ index("idx_ground_driver_shifts_operator").on(table.operatorId),
109
+ index("idx_ground_driver_shifts_facility").on(table.facilityId),
110
+ index("idx_ground_driver_shifts_status").on(table.status),
111
+ ]);
112
+ export const groundServiceIncidents = pgTable("ground_service_incidents", {
113
+ id: typeId("ground_service_incidents"),
114
+ dispatchId: typeIdRef("dispatch_id")
115
+ .notNull()
116
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
117
+ severity: groundIncidentSeverityEnum("severity").notNull().default("warning"),
118
+ incidentType: text("incident_type").notNull(),
119
+ resolutionStatus: groundIncidentResolutionStatusEnum("resolution_status")
120
+ .notNull()
121
+ .default("open"),
122
+ openedAt: timestamp("opened_at", { withTimezone: true }).notNull().defaultNow(),
123
+ resolvedAt: timestamp("resolved_at", { withTimezone: true }),
124
+ notes: text("notes"),
125
+ metadata: jsonb("metadata").$type(),
126
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
127
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
128
+ }, (table) => [
129
+ index("idx_ground_service_incidents_dispatch").on(table.dispatchId),
130
+ index("idx_ground_service_incidents_severity").on(table.severity),
131
+ index("idx_ground_service_incidents_resolution").on(table.resolutionStatus),
132
+ ]);
133
+ export const groundDispatchCheckpoints = pgTable("ground_dispatch_checkpoints", {
134
+ id: typeId("ground_dispatch_checkpoints"),
135
+ dispatchId: typeIdRef("dispatch_id")
136
+ .notNull()
137
+ .references(() => groundDispatches.id, { onDelete: "cascade" }),
138
+ sequence: integer("sequence").notNull().default(0),
139
+ checkpointType: text("checkpoint_type").notNull(),
140
+ status: groundCheckpointStatusEnum("status").notNull().default("pending"),
141
+ plannedAt: timestamp("planned_at", { withTimezone: true }),
142
+ actualAt: timestamp("actual_at", { withTimezone: true }),
143
+ facilityId: typeIdRef("facility_id").references(() => facilities.id, { onDelete: "set null" }),
144
+ addressId: typeIdRef("address_id").references(() => identityAddresses.id, {
145
+ onDelete: "set null",
146
+ }),
147
+ notes: text("notes"),
148
+ metadata: jsonb("metadata").$type(),
149
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
150
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
151
+ }, (table) => [
152
+ index("idx_ground_dispatch_checkpoints_dispatch").on(table.dispatchId),
153
+ index("idx_ground_dispatch_checkpoints_sequence").on(table.sequence),
154
+ index("idx_ground_dispatch_checkpoints_status").on(table.status),
155
+ ]);