@voyantjs/bookings 0.3.1 → 0.4.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/routes.d.ts +81 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +10 -1
- package/dist/service-public.d.ts +65 -1
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +130 -117
- package/dist/validation-public.d.ts +7 -0
- package/dist/validation-public.d.ts.map +1 -1
- package/dist/validation-public.js +10 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export { bookingParticipantDietarySchema, bookingParticipantIdentitySchema, book
|
|
|
19
19
|
export type { Booking, BookingActivity, BookingAllocation, BookingDocument, BookingFulfillment, BookingItem, BookingItemParticipant, BookingNote, BookingParticipant, BookingPassenger, BookingPiiAccessLog, BookingRedemptionEvent, BookingSessionState, BookingSupplierStatus, NewBooking, NewBookingActivity, NewBookingAllocation, NewBookingDocument, NewBookingFulfillment, NewBookingItem, NewBookingItemParticipant, NewBookingNote, NewBookingParticipant, NewBookingPassenger, NewBookingPiiAccessLog, NewBookingRedemptionEvent, NewBookingSessionState, NewBookingSupplierStatus, } from "./schema.js";
|
|
20
20
|
export { bookingActivityLog, bookingAllocations, bookingDocuments, bookingFulfillments, bookingItemParticipants, bookingItems, bookingNotes, bookingParticipants, bookingPassengers, bookingPiiAccessLog, bookingRedemptionEvents, bookingSessionStates, bookingSupplierStatuses, bookings, } from "./schema.js";
|
|
21
21
|
export { publicBookingsService } from "./service-public.js";
|
|
22
|
-
export { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertBookingSchema, insertParticipantSchema, insertPassengerSchema, insertSupplierStatusSchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateParticipantSchema, updatePassengerSchema, updateSupplierStatusSchema, upsertParticipantTravelDetailsSchema, } from "./validation.js";
|
|
22
|
+
export { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertBookingSchema, insertParticipantSchema, insertPassengerSchema, insertSupplierStatusSchema, internalBookingOverviewLookupQuerySchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateParticipantSchema, updatePassengerSchema, updateSupplierStatusSchema, upsertParticipantTravelDetailsSchema, } from "./validation.js";
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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"}
|
package/dist/index.js
CHANGED
|
@@ -27,4 +27,4 @@ export { publicBookingRoutes } from "./routes-public.js";
|
|
|
27
27
|
export { bookingParticipantDietarySchema, bookingParticipantIdentitySchema, bookingParticipantTravelDetailInsertSchema, bookingParticipantTravelDetailSelectSchema, bookingParticipantTravelDetails, bookingParticipantTravelDetailUpdateSchema, decryptedBookingParticipantTravelDetailSchema, } from "./schema/travel-details.js";
|
|
28
28
|
export { bookingActivityLog, bookingAllocations, bookingDocuments, bookingFulfillments, bookingItemParticipants, bookingItems, bookingNotes, bookingParticipants, bookingPassengers, bookingPiiAccessLog, bookingRedemptionEvents, bookingSessionStates, bookingSupplierStatuses, bookings, } from "./schema.js";
|
|
29
29
|
export { publicBookingsService } from "./service-public.js";
|
|
30
|
-
export { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertBookingSchema, insertParticipantSchema, insertPassengerSchema, insertSupplierStatusSchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateParticipantSchema, updatePassengerSchema, updateSupplierStatusSchema, upsertParticipantTravelDetailsSchema, } from "./validation.js";
|
|
30
|
+
export { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertBookingSchema, insertParticipantSchema, insertPassengerSchema, insertSupplierStatusSchema, internalBookingOverviewLookupQuerySchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateParticipantSchema, updatePassengerSchema, updateSupplierStatusSchema, upsertParticipantTravelDetailsSchema, } from "./validation.js";
|
package/dist/routes.d.ts
CHANGED
|
@@ -42,6 +42,87 @@ export declare const bookingRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
42
42
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
+
} & {
|
|
46
|
+
"/overview": {
|
|
47
|
+
$get: {
|
|
48
|
+
input: {};
|
|
49
|
+
output: {
|
|
50
|
+
error: string;
|
|
51
|
+
};
|
|
52
|
+
outputFormat: "json";
|
|
53
|
+
status: 404;
|
|
54
|
+
} | {
|
|
55
|
+
input: {};
|
|
56
|
+
output: {
|
|
57
|
+
data: {
|
|
58
|
+
bookingId: string;
|
|
59
|
+
bookingNumber: string;
|
|
60
|
+
status: "cancelled" | "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired";
|
|
61
|
+
sellCurrency: string;
|
|
62
|
+
sellAmountCents: number | null;
|
|
63
|
+
startDate: string | null;
|
|
64
|
+
endDate: string | null;
|
|
65
|
+
pax: number | null;
|
|
66
|
+
confirmedAt: string | null;
|
|
67
|
+
cancelledAt: string | null;
|
|
68
|
+
completedAt: string | null;
|
|
69
|
+
participants: {
|
|
70
|
+
id: string;
|
|
71
|
+
participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
|
|
72
|
+
firstName: string;
|
|
73
|
+
lastName: string;
|
|
74
|
+
isPrimary: boolean;
|
|
75
|
+
}[];
|
|
76
|
+
items: {
|
|
77
|
+
id: string;
|
|
78
|
+
title: string;
|
|
79
|
+
description: string | null;
|
|
80
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
81
|
+
status: "cancelled" | "draft" | "on_hold" | "confirmed" | "expired" | "fulfilled";
|
|
82
|
+
serviceDate: string | null;
|
|
83
|
+
startsAt: string | null;
|
|
84
|
+
endsAt: string | null;
|
|
85
|
+
quantity: number;
|
|
86
|
+
sellCurrency: string;
|
|
87
|
+
unitSellAmountCents: number | null;
|
|
88
|
+
totalSellAmountCents: number | null;
|
|
89
|
+
costCurrency: string | null;
|
|
90
|
+
unitCostAmountCents: number | null;
|
|
91
|
+
totalCostAmountCents: number | null;
|
|
92
|
+
notes: string | null;
|
|
93
|
+
productId: string | null;
|
|
94
|
+
optionId: string | null;
|
|
95
|
+
optionUnitId: string | null;
|
|
96
|
+
pricingCategoryId: string | null;
|
|
97
|
+
participantLinks: {
|
|
98
|
+
id: string;
|
|
99
|
+
participantId: string;
|
|
100
|
+
role: string;
|
|
101
|
+
isPrimary: boolean;
|
|
102
|
+
}[];
|
|
103
|
+
}[];
|
|
104
|
+
documents: {
|
|
105
|
+
id: string;
|
|
106
|
+
participantId: string | null;
|
|
107
|
+
type: "visa" | "other" | "insurance" | "health" | "passport_copy";
|
|
108
|
+
fileName: string;
|
|
109
|
+
fileUrl: string;
|
|
110
|
+
}[];
|
|
111
|
+
fulfillments: {
|
|
112
|
+
id: string;
|
|
113
|
+
bookingItemId: string | null;
|
|
114
|
+
participantId: string | null;
|
|
115
|
+
fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
|
|
116
|
+
deliveryChannel: "other" | "download" | "email" | "api" | "wallet";
|
|
117
|
+
status: "pending" | "issued" | "reissued" | "revoked" | "failed";
|
|
118
|
+
artifactUrl: string | null;
|
|
119
|
+
}[];
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
outputFormat: "json";
|
|
123
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
45
126
|
} & {
|
|
46
127
|
"/:id": {
|
|
47
128
|
$get: {
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,KAAK,GAAG,EAAiB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,KAAK,GAAG,EAAiB,MAAM,oBAAoB,CAAA;AA2J5D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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shared.js";
|
|
5
5
|
import { bookingPiiAccessLog } from "./schema.js";
|
|
6
6
|
import { bookingsService } from "./service.js";
|
|
7
|
-
import {
|
|
7
|
+
import { publicBookingsService } from "./service-public.js";
|
|
8
|
+
import { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertParticipantSchema, insertPassengerSchema, insertSupplierStatusSchema, internalBookingOverviewLookupQuerySchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateParticipantSchema, updatePassengerSchema, updateSupplierStatusSchema, upsertParticipantTravelDetailsSchema, } from "./validation.js";
|
|
8
9
|
function hasPiiScope(scopes, action) {
|
|
9
10
|
if (!scopes || scopes.length === 0) {
|
|
10
11
|
return false;
|
|
@@ -97,6 +98,14 @@ export const bookingRoutes = new Hono()
|
|
|
97
98
|
.get("/", async (c) => {
|
|
98
99
|
const query = bookingListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
|
|
99
100
|
return c.json(await bookingsService.listBookings(c.get("db"), query));
|
|
101
|
+
})
|
|
102
|
+
// 1a. GET /overview — Internal/admin booking overview lookup
|
|
103
|
+
.get("/overview", async (c) => {
|
|
104
|
+
const overview = await publicBookingsService.getOverviewByLookup(c.get("db"), internalBookingOverviewLookupQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)));
|
|
105
|
+
if (!overview) {
|
|
106
|
+
return c.json({ error: "Booking overview not found" }, 404);
|
|
107
|
+
}
|
|
108
|
+
return c.json({ data: overview });
|
|
100
109
|
})
|
|
101
110
|
// 2. GET /:id — Get single booking
|
|
102
111
|
.get("/:id", async (c) => {
|
package/dist/service-public.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
-
import type { PublicBookingOverviewLookupQuery, PublicBookingSessionMutationInput, PublicBookingSessionRepriceInput, PublicCreateBookingSessionInput, PublicUpdateBookingSessionInput, PublicUpsertBookingSessionStateInput } from "./validation-public.js";
|
|
2
|
+
import type { InternalBookingOverviewLookupQuery, PublicBookingOverviewLookupQuery, PublicBookingSessionMutationInput, PublicBookingSessionRepriceInput, PublicCreateBookingSessionInput, PublicUpdateBookingSessionInput, PublicUpsertBookingSessionStateInput } from "./validation-public.js";
|
|
3
3
|
export declare const publicBookingsService: {
|
|
4
4
|
createSession(db: PostgresJsDatabase, input: PublicCreateBookingSessionInput, userId?: string): Promise<{
|
|
5
5
|
status: Exclude<string, "ok">;
|
|
@@ -705,5 +705,69 @@ export declare const publicBookingsService: {
|
|
|
705
705
|
artifactUrl: string | null;
|
|
706
706
|
}[];
|
|
707
707
|
} | null>;
|
|
708
|
+
getOverviewByLookup(db: PostgresJsDatabase, query: InternalBookingOverviewLookupQuery): Promise<{
|
|
709
|
+
bookingId: string;
|
|
710
|
+
bookingNumber: string;
|
|
711
|
+
status: "cancelled" | "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired";
|
|
712
|
+
sellCurrency: string;
|
|
713
|
+
sellAmountCents: number | null;
|
|
714
|
+
startDate: string | null;
|
|
715
|
+
endDate: string | null;
|
|
716
|
+
pax: number | null;
|
|
717
|
+
confirmedAt: string | null;
|
|
718
|
+
cancelledAt: string | null;
|
|
719
|
+
completedAt: string | null;
|
|
720
|
+
participants: {
|
|
721
|
+
id: string;
|
|
722
|
+
participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
|
|
723
|
+
firstName: string;
|
|
724
|
+
lastName: string;
|
|
725
|
+
isPrimary: boolean;
|
|
726
|
+
}[];
|
|
727
|
+
items: {
|
|
728
|
+
id: string;
|
|
729
|
+
title: string;
|
|
730
|
+
description: string | null;
|
|
731
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
732
|
+
status: "cancelled" | "draft" | "on_hold" | "confirmed" | "expired" | "fulfilled";
|
|
733
|
+
serviceDate: string | null;
|
|
734
|
+
startsAt: string | null;
|
|
735
|
+
endsAt: string | null;
|
|
736
|
+
quantity: number;
|
|
737
|
+
sellCurrency: string;
|
|
738
|
+
unitSellAmountCents: number | null;
|
|
739
|
+
totalSellAmountCents: number | null;
|
|
740
|
+
costCurrency: string | null;
|
|
741
|
+
unitCostAmountCents: number | null;
|
|
742
|
+
totalCostAmountCents: number | null;
|
|
743
|
+
notes: string | null;
|
|
744
|
+
productId: string | null;
|
|
745
|
+
optionId: string | null;
|
|
746
|
+
optionUnitId: string | null;
|
|
747
|
+
pricingCategoryId: string | null;
|
|
748
|
+
participantLinks: {
|
|
749
|
+
id: string;
|
|
750
|
+
participantId: string;
|
|
751
|
+
role: string;
|
|
752
|
+
isPrimary: boolean;
|
|
753
|
+
}[];
|
|
754
|
+
}[];
|
|
755
|
+
documents: {
|
|
756
|
+
id: string;
|
|
757
|
+
participantId: string | null;
|
|
758
|
+
type: "visa" | "other" | "insurance" | "health" | "passport_copy";
|
|
759
|
+
fileName: string;
|
|
760
|
+
fileUrl: string;
|
|
761
|
+
}[];
|
|
762
|
+
fulfillments: {
|
|
763
|
+
id: string;
|
|
764
|
+
bookingItemId: string | null;
|
|
765
|
+
participantId: string | null;
|
|
766
|
+
fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
|
|
767
|
+
deliveryChannel: "other" | "download" | "email" | "api" | "wallet";
|
|
768
|
+
status: "pending" | "issued" | "reissued" | "revoked" | "failed";
|
|
769
|
+
artifactUrl: string | null;
|
|
770
|
+
}[];
|
|
771
|
+
} | null>;
|
|
708
772
|
};
|
|
709
773
|
//# sourceMappingURL=service-public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAoBjE,OAAO,KAAK,EACV,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAEhC,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACrC,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAoBjE,OAAO,KAAK,EACV,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAEhC,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACrC,MAAM,wBAAwB,CAAA;AAyuB/B,eAAO,MAAM,qBAAqB;sBAE1B,kBAAkB,SACf,+BAA+B,WAC7B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAlHT,MAAM;mCACK,MAAM;0BACf,MAAM;+BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAuLH,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA1LhD,MAAM;+BACK,MAAM;sBACf,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2LI,kBAAkB,aAAa,MAAM;;;;;;;;;;2BAUzD,kBAAkB,aACX,MAAM,SACV,oCAAoC;;;;;;;;;;;;;;;;sBAYvC,kBAAkB,aACX,MAAM,SACV,+BAA+B,WAC7B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAzNT,MAAM;mCACK,MAAM;0BACf,MAAM;+BACD,OAAO;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;+BACK,MAAM;sBACf,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;CA29BvB,CAAA"}
|
package/dist/service-public.js
CHANGED
|
@@ -124,6 +124,132 @@ async function generateBookingNumber(db) {
|
|
|
124
124
|
}
|
|
125
125
|
throw new Error("Unable to generate a unique booking number");
|
|
126
126
|
}
|
|
127
|
+
async function buildOverviewSnapshot(db, query) {
|
|
128
|
+
const bookingLookupNumber = query.bookingNumber ?? query.bookingCode ?? null;
|
|
129
|
+
const [booking] = await db
|
|
130
|
+
.select()
|
|
131
|
+
.from(bookings)
|
|
132
|
+
.where(query.bookingId
|
|
133
|
+
? eq(bookings.id, query.bookingId)
|
|
134
|
+
: bookingLookupNumber
|
|
135
|
+
? eq(bookings.bookingNumber, bookingLookupNumber)
|
|
136
|
+
: eq(bookings.id, "__missing__"))
|
|
137
|
+
.limit(1);
|
|
138
|
+
if (!booking) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const [participants, items, itemParticipantLinks, documents, fulfillments] = await Promise.all([
|
|
142
|
+
db
|
|
143
|
+
.select()
|
|
144
|
+
.from(bookingParticipants)
|
|
145
|
+
.where(eq(bookingParticipants.bookingId, booking.id))
|
|
146
|
+
.orderBy(asc(bookingParticipants.createdAt)),
|
|
147
|
+
db
|
|
148
|
+
.select()
|
|
149
|
+
.from(bookingItems)
|
|
150
|
+
.where(eq(bookingItems.bookingId, booking.id))
|
|
151
|
+
.orderBy(asc(bookingItems.createdAt)),
|
|
152
|
+
db
|
|
153
|
+
.select({
|
|
154
|
+
id: bookingItemParticipants.id,
|
|
155
|
+
bookingItemId: bookingItemParticipants.bookingItemId,
|
|
156
|
+
participantId: bookingItemParticipants.participantId,
|
|
157
|
+
role: bookingItemParticipants.role,
|
|
158
|
+
isPrimary: bookingItemParticipants.isPrimary,
|
|
159
|
+
})
|
|
160
|
+
.from(bookingItemParticipants)
|
|
161
|
+
.innerJoin(bookingItems, eq(bookingItems.id, bookingItemParticipants.bookingItemId))
|
|
162
|
+
.where(eq(bookingItems.bookingId, booking.id))
|
|
163
|
+
.orderBy(asc(bookingItemParticipants.createdAt)),
|
|
164
|
+
db
|
|
165
|
+
.select()
|
|
166
|
+
.from(bookingDocuments)
|
|
167
|
+
.where(eq(bookingDocuments.bookingId, booking.id))
|
|
168
|
+
.orderBy(asc(bookingDocuments.createdAt)),
|
|
169
|
+
db
|
|
170
|
+
.select()
|
|
171
|
+
.from(bookingFulfillments)
|
|
172
|
+
.where(eq(bookingFulfillments.bookingId, booking.id))
|
|
173
|
+
.orderBy(asc(bookingFulfillments.createdAt)),
|
|
174
|
+
]);
|
|
175
|
+
const email = query.email?.trim().toLowerCase() ?? null;
|
|
176
|
+
if (email) {
|
|
177
|
+
const authorized = participants.some((participant) => participant.email?.toLowerCase() === email);
|
|
178
|
+
if (!authorized) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const itemLinksByItemId = new Map();
|
|
183
|
+
for (const link of itemParticipantLinks) {
|
|
184
|
+
const existing = itemLinksByItemId.get(link.bookingItemId) ?? [];
|
|
185
|
+
existing.push({
|
|
186
|
+
id: link.id,
|
|
187
|
+
participantId: link.participantId,
|
|
188
|
+
role: link.role,
|
|
189
|
+
isPrimary: link.isPrimary,
|
|
190
|
+
});
|
|
191
|
+
itemLinksByItemId.set(link.bookingItemId, existing);
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
bookingId: booking.id,
|
|
195
|
+
bookingNumber: booking.bookingNumber,
|
|
196
|
+
status: booking.status,
|
|
197
|
+
sellCurrency: booking.sellCurrency,
|
|
198
|
+
sellAmountCents: booking.sellAmountCents ?? null,
|
|
199
|
+
startDate: normalizeDate(booking.startDate),
|
|
200
|
+
endDate: normalizeDate(booking.endDate),
|
|
201
|
+
pax: booking.pax ?? null,
|
|
202
|
+
confirmedAt: normalizeDateTime(booking.confirmedAt),
|
|
203
|
+
cancelledAt: normalizeDateTime(booking.cancelledAt),
|
|
204
|
+
completedAt: normalizeDateTime(booking.completedAt),
|
|
205
|
+
participants: participants.map((participant) => ({
|
|
206
|
+
id: participant.id,
|
|
207
|
+
participantType: participant.participantType,
|
|
208
|
+
firstName: participant.firstName,
|
|
209
|
+
lastName: participant.lastName,
|
|
210
|
+
isPrimary: participant.isPrimary,
|
|
211
|
+
})),
|
|
212
|
+
items: items.map((item) => ({
|
|
213
|
+
id: item.id,
|
|
214
|
+
title: item.title,
|
|
215
|
+
description: item.description ?? null,
|
|
216
|
+
itemType: item.itemType,
|
|
217
|
+
status: item.status,
|
|
218
|
+
serviceDate: normalizeDate(item.serviceDate),
|
|
219
|
+
startsAt: normalizeDateTime(item.startsAt),
|
|
220
|
+
endsAt: normalizeDateTime(item.endsAt),
|
|
221
|
+
quantity: item.quantity,
|
|
222
|
+
sellCurrency: item.sellCurrency,
|
|
223
|
+
unitSellAmountCents: item.unitSellAmountCents ?? null,
|
|
224
|
+
totalSellAmountCents: item.totalSellAmountCents ?? null,
|
|
225
|
+
costCurrency: item.costCurrency ?? null,
|
|
226
|
+
unitCostAmountCents: item.unitCostAmountCents ?? null,
|
|
227
|
+
totalCostAmountCents: item.totalCostAmountCents ?? null,
|
|
228
|
+
notes: item.notes ?? null,
|
|
229
|
+
productId: item.productId ?? null,
|
|
230
|
+
optionId: item.optionId ?? null,
|
|
231
|
+
optionUnitId: item.optionUnitId ?? null,
|
|
232
|
+
pricingCategoryId: item.pricingCategoryId ?? null,
|
|
233
|
+
participantLinks: itemLinksByItemId.get(item.id) ?? [],
|
|
234
|
+
})),
|
|
235
|
+
documents: documents.map((document) => ({
|
|
236
|
+
id: document.id,
|
|
237
|
+
participantId: document.participantId ?? null,
|
|
238
|
+
type: document.type,
|
|
239
|
+
fileName: document.fileName,
|
|
240
|
+
fileUrl: document.fileUrl,
|
|
241
|
+
})),
|
|
242
|
+
fulfillments: fulfillments.map((fulfillment) => ({
|
|
243
|
+
id: fulfillment.id,
|
|
244
|
+
bookingItemId: fulfillment.bookingItemId ?? null,
|
|
245
|
+
participantId: fulfillment.participantId ?? null,
|
|
246
|
+
fulfillmentType: fulfillment.fulfillmentType,
|
|
247
|
+
deliveryChannel: fulfillment.deliveryChannel,
|
|
248
|
+
status: fulfillment.status,
|
|
249
|
+
artifactUrl: fulfillment.artifactUrl ?? null,
|
|
250
|
+
})),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
127
253
|
function buildUnitWarnings(unit, quantity, sessionPax) {
|
|
128
254
|
const warnings = [];
|
|
129
255
|
if (!unit) {
|
|
@@ -766,122 +892,9 @@ export const publicBookingsService = {
|
|
|
766
892
|
return session ? { status: "ok", session } : { status: "not_found" };
|
|
767
893
|
},
|
|
768
894
|
async getOverview(db, query) {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
.limit(1);
|
|
774
|
-
if (!booking) {
|
|
775
|
-
return null;
|
|
776
|
-
}
|
|
777
|
-
const [participants, items, itemParticipantLinks, documents, fulfillments] = await Promise.all([
|
|
778
|
-
db
|
|
779
|
-
.select()
|
|
780
|
-
.from(bookingParticipants)
|
|
781
|
-
.where(eq(bookingParticipants.bookingId, booking.id))
|
|
782
|
-
.orderBy(asc(bookingParticipants.createdAt)),
|
|
783
|
-
db
|
|
784
|
-
.select()
|
|
785
|
-
.from(bookingItems)
|
|
786
|
-
.where(eq(bookingItems.bookingId, booking.id))
|
|
787
|
-
.orderBy(asc(bookingItems.createdAt)),
|
|
788
|
-
db
|
|
789
|
-
.select({
|
|
790
|
-
id: bookingItemParticipants.id,
|
|
791
|
-
bookingItemId: bookingItemParticipants.bookingItemId,
|
|
792
|
-
participantId: bookingItemParticipants.participantId,
|
|
793
|
-
role: bookingItemParticipants.role,
|
|
794
|
-
isPrimary: bookingItemParticipants.isPrimary,
|
|
795
|
-
})
|
|
796
|
-
.from(bookingItemParticipants)
|
|
797
|
-
.innerJoin(bookingItems, eq(bookingItems.id, bookingItemParticipants.bookingItemId))
|
|
798
|
-
.where(eq(bookingItems.bookingId, booking.id))
|
|
799
|
-
.orderBy(asc(bookingItemParticipants.createdAt)),
|
|
800
|
-
db
|
|
801
|
-
.select()
|
|
802
|
-
.from(bookingDocuments)
|
|
803
|
-
.where(eq(bookingDocuments.bookingId, booking.id))
|
|
804
|
-
.orderBy(asc(bookingDocuments.createdAt)),
|
|
805
|
-
db
|
|
806
|
-
.select()
|
|
807
|
-
.from(bookingFulfillments)
|
|
808
|
-
.where(eq(bookingFulfillments.bookingId, booking.id))
|
|
809
|
-
.orderBy(asc(bookingFulfillments.createdAt)),
|
|
810
|
-
]);
|
|
811
|
-
const email = query.email.trim().toLowerCase();
|
|
812
|
-
const authorized = participants.some((participant) => participant.email?.toLowerCase() === email);
|
|
813
|
-
if (!authorized) {
|
|
814
|
-
return null;
|
|
815
|
-
}
|
|
816
|
-
const itemLinksByItemId = new Map();
|
|
817
|
-
for (const link of itemParticipantLinks) {
|
|
818
|
-
const existing = itemLinksByItemId.get(link.bookingItemId) ?? [];
|
|
819
|
-
existing.push({
|
|
820
|
-
id: link.id,
|
|
821
|
-
participantId: link.participantId,
|
|
822
|
-
role: link.role,
|
|
823
|
-
isPrimary: link.isPrimary,
|
|
824
|
-
});
|
|
825
|
-
itemLinksByItemId.set(link.bookingItemId, existing);
|
|
826
|
-
}
|
|
827
|
-
return {
|
|
828
|
-
bookingId: booking.id,
|
|
829
|
-
bookingNumber: booking.bookingNumber,
|
|
830
|
-
status: booking.status,
|
|
831
|
-
sellCurrency: booking.sellCurrency,
|
|
832
|
-
sellAmountCents: booking.sellAmountCents ?? null,
|
|
833
|
-
startDate: normalizeDate(booking.startDate),
|
|
834
|
-
endDate: normalizeDate(booking.endDate),
|
|
835
|
-
pax: booking.pax ?? null,
|
|
836
|
-
confirmedAt: normalizeDateTime(booking.confirmedAt),
|
|
837
|
-
cancelledAt: normalizeDateTime(booking.cancelledAt),
|
|
838
|
-
completedAt: normalizeDateTime(booking.completedAt),
|
|
839
|
-
participants: participants.map((participant) => ({
|
|
840
|
-
id: participant.id,
|
|
841
|
-
participantType: participant.participantType,
|
|
842
|
-
firstName: participant.firstName,
|
|
843
|
-
lastName: participant.lastName,
|
|
844
|
-
isPrimary: participant.isPrimary,
|
|
845
|
-
})),
|
|
846
|
-
items: items.map((item) => ({
|
|
847
|
-
id: item.id,
|
|
848
|
-
title: item.title,
|
|
849
|
-
description: item.description ?? null,
|
|
850
|
-
itemType: item.itemType,
|
|
851
|
-
status: item.status,
|
|
852
|
-
serviceDate: normalizeDate(item.serviceDate),
|
|
853
|
-
startsAt: normalizeDateTime(item.startsAt),
|
|
854
|
-
endsAt: normalizeDateTime(item.endsAt),
|
|
855
|
-
quantity: item.quantity,
|
|
856
|
-
sellCurrency: item.sellCurrency,
|
|
857
|
-
unitSellAmountCents: item.unitSellAmountCents ?? null,
|
|
858
|
-
totalSellAmountCents: item.totalSellAmountCents ?? null,
|
|
859
|
-
costCurrency: item.costCurrency ?? null,
|
|
860
|
-
unitCostAmountCents: item.unitCostAmountCents ?? null,
|
|
861
|
-
totalCostAmountCents: item.totalCostAmountCents ?? null,
|
|
862
|
-
notes: item.notes ?? null,
|
|
863
|
-
productId: item.productId ?? null,
|
|
864
|
-
optionId: item.optionId ?? null,
|
|
865
|
-
optionUnitId: item.optionUnitId ?? null,
|
|
866
|
-
pricingCategoryId: item.pricingCategoryId ?? null,
|
|
867
|
-
participantLinks: itemLinksByItemId.get(item.id) ?? [],
|
|
868
|
-
})),
|
|
869
|
-
documents: documents.map((document) => ({
|
|
870
|
-
id: document.id,
|
|
871
|
-
participantId: document.participantId ?? null,
|
|
872
|
-
type: document.type,
|
|
873
|
-
fileName: document.fileName,
|
|
874
|
-
fileUrl: document.fileUrl,
|
|
875
|
-
})),
|
|
876
|
-
fulfillments: fulfillments.map((fulfillment) => ({
|
|
877
|
-
id: fulfillment.id,
|
|
878
|
-
bookingItemId: fulfillment.bookingItemId ?? null,
|
|
879
|
-
participantId: fulfillment.participantId ?? null,
|
|
880
|
-
fulfillmentType: fulfillment.fulfillmentType,
|
|
881
|
-
deliveryChannel: fulfillment.deliveryChannel,
|
|
882
|
-
status: fulfillment.status,
|
|
883
|
-
artifactUrl: fulfillment.artifactUrl ?? null,
|
|
884
|
-
})),
|
|
885
|
-
};
|
|
895
|
+
return buildOverviewSnapshot(db, query);
|
|
896
|
+
},
|
|
897
|
+
async getOverviewByLookup(db, query) {
|
|
898
|
+
return buildOverviewSnapshot(db, query);
|
|
886
899
|
},
|
|
887
900
|
};
|
|
@@ -217,6 +217,12 @@ export declare const publicBookingOverviewLookupQuerySchema: z.ZodObject<{
|
|
|
217
217
|
bookingNumber: z.ZodString;
|
|
218
218
|
email: z.ZodString;
|
|
219
219
|
}, z.core.$strip>;
|
|
220
|
+
export declare const internalBookingOverviewLookupQuerySchema: z.ZodObject<{
|
|
221
|
+
bookingId: z.ZodOptional<z.ZodString>;
|
|
222
|
+
bookingNumber: z.ZodOptional<z.ZodString>;
|
|
223
|
+
bookingCode: z.ZodOptional<z.ZodString>;
|
|
224
|
+
email: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>;
|
|
220
226
|
export declare const publicBookingSessionParticipantSchema: z.ZodObject<{
|
|
221
227
|
id: z.ZodString;
|
|
222
228
|
participantType: z.ZodEnum<{
|
|
@@ -898,4 +904,5 @@ export type PublicBookingSessionState = z.infer<typeof publicBookingSessionState
|
|
|
898
904
|
export type PublicUpsertBookingSessionStateInput = z.infer<typeof publicUpsertBookingSessionStateSchema>;
|
|
899
905
|
export type PublicBookingSessionRepriceInput = z.infer<typeof publicRepriceBookingSessionSchema>;
|
|
900
906
|
export type PublicBookingOverviewLookupQuery = z.infer<typeof publicBookingOverviewLookupQuerySchema>;
|
|
907
|
+
export type InternalBookingOverviewLookupQuery = z.infer<typeof internalBookingOverviewLookupQuerySchema>;
|
|
901
908
|
//# sourceMappingURL=validation-public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-public.d.ts","sourceRoot":"","sources":["../src/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AC9F,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAClG,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,qCAAqC,CAC7C,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAChG,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAA;AACD,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAA"}
|
|
@@ -109,6 +109,16 @@ export const publicBookingOverviewLookupQuerySchema = z.object({
|
|
|
109
109
|
bookingNumber: z.string().min(1).max(50),
|
|
110
110
|
email: z.string().email(),
|
|
111
111
|
});
|
|
112
|
+
export const internalBookingOverviewLookupQuerySchema = z
|
|
113
|
+
.object({
|
|
114
|
+
bookingId: z.string().min(1).max(50).optional(),
|
|
115
|
+
bookingNumber: z.string().min(1).max(50).optional(),
|
|
116
|
+
bookingCode: z.string().min(1).max(50).optional(),
|
|
117
|
+
email: z.string().email().optional(),
|
|
118
|
+
})
|
|
119
|
+
.refine((value) => Boolean(value.bookingId || value.bookingNumber || value.bookingCode), {
|
|
120
|
+
message: "Provide a bookingId, bookingNumber, or bookingCode",
|
|
121
|
+
});
|
|
112
122
|
export const publicBookingSessionParticipantSchema = z.object({
|
|
113
123
|
id: z.string(),
|
|
114
124
|
participantType: bookingParticipantTypeSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/bookings",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"drizzle-orm": "^0.45.2",
|
|
50
50
|
"hono": "^4.12.10",
|
|
51
51
|
"zod": "^4.3.6",
|
|
52
|
-
"@voyantjs/core": "0.
|
|
53
|
-
"@voyantjs/db": "0.
|
|
54
|
-
"@voyantjs/hono": "0.
|
|
55
|
-
"@voyantjs/utils": "0.
|
|
52
|
+
"@voyantjs/core": "0.4.0",
|
|
53
|
+
"@voyantjs/db": "0.4.0",
|
|
54
|
+
"@voyantjs/hono": "0.4.0",
|
|
55
|
+
"@voyantjs/utils": "0.4.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"typescript": "^6.0.2",
|
|
59
|
-
"@voyantjs/products": "0.
|
|
59
|
+
"@voyantjs/products": "0.4.0",
|
|
60
60
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|