@voyant-travel/commerce 0.1.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/LICENSE +201 -0
- package/README.md +145 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts +2 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts.map +1 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.js +398 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/interface.d.ts +18 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +246 -0
- package/dist/interface.test.d.ts +2 -0
- package/dist/interface.test.d.ts.map +1 -0
- package/dist/interface.test.js +357 -0
- package/dist/markets/index.d.ts +11 -0
- package/dist/markets/index.d.ts.map +1 -0
- package/dist/markets/index.js +12 -0
- package/dist/markets/routes.d.ts +1182 -0
- package/dist/markets/routes.d.ts.map +1 -0
- package/dist/markets/routes.js +209 -0
- package/dist/markets/schema.d.ts +1527 -0
- package/dist/markets/schema.d.ts.map +1 -0
- package/dist/markets/schema.js +240 -0
- package/dist/markets/service-core.d.ts +253 -0
- package/dist/markets/service-core.d.ts.map +1 -0
- package/dist/markets/service-core.js +242 -0
- package/dist/markets/service-rules.d.ts +191 -0
- package/dist/markets/service-rules.d.ts.map +1 -0
- package/dist/markets/service-rules.js +155 -0
- package/dist/markets/service-shared.d.ts +36 -0
- package/dist/markets/service-shared.d.ts.map +1 -0
- package/dist/markets/service-shared.js +7 -0
- package/dist/markets/service.d.ts +43 -0
- package/dist/markets/service.d.ts.map +1 -0
- package/dist/markets/service.js +42 -0
- package/dist/markets/validation.d.ts +451 -0
- package/dist/markets/validation.d.ts.map +1 -0
- package/dist/markets/validation.js +160 -0
- package/dist/pricing/events.d.ts +53 -0
- package/dist/pricing/events.d.ts.map +1 -0
- package/dist/pricing/events.js +28 -0
- package/dist/pricing/index.d.ts +15 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +18 -0
- package/dist/pricing/routes-core.d.ts +981 -0
- package/dist/pricing/routes-core.d.ts.map +1 -0
- package/dist/pricing/routes-core.js +102 -0
- package/dist/pricing/routes-public.d.ts +136 -0
- package/dist/pricing/routes-public.d.ts.map +1 -0
- package/dist/pricing/routes-public.js +14 -0
- package/dist/pricing/routes-rules.d.ts +1339 -0
- package/dist/pricing/routes-rules.d.ts.map +1 -0
- package/dist/pricing/routes-rules.js +138 -0
- package/dist/pricing/routes-shared.d.ts +14 -0
- package/dist/pricing/routes-shared.d.ts.map +1 -0
- package/dist/pricing/routes-shared.js +3 -0
- package/dist/pricing/routes.d.ts +7 -0
- package/dist/pricing/routes.d.ts.map +1 -0
- package/dist/pricing/routes.js +6 -0
- package/dist/pricing/schema-catalogs.d.ts +467 -0
- package/dist/pricing/schema-catalogs.d.ts.map +1 -0
- package/dist/pricing/schema-catalogs.js +47 -0
- package/dist/pricing/schema-categories.d.ts +497 -0
- package/dist/pricing/schema-categories.d.ts.map +1 -0
- package/dist/pricing/schema-categories.js +54 -0
- package/dist/pricing/schema-departure-overrides.d.ts +228 -0
- package/dist/pricing/schema-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/schema-departure-overrides.js +36 -0
- package/dist/pricing/schema-option-rules.d.ts +1770 -0
- package/dist/pricing/schema-option-rules.d.ts.map +1 -0
- package/dist/pricing/schema-option-rules.js +181 -0
- package/dist/pricing/schema-policies.d.ts +395 -0
- package/dist/pricing/schema-policies.d.ts.map +1 -0
- package/dist/pricing/schema-policies.js +41 -0
- package/dist/pricing/schema-relations.d.ts +59 -0
- package/dist/pricing/schema-relations.d.ts.map +1 -0
- package/dist/pricing/schema-relations.js +111 -0
- package/dist/pricing/schema-shared.d.ts +11 -0
- package/dist/pricing/schema-shared.d.ts.map +1 -0
- package/dist/pricing/schema-shared.js +67 -0
- package/dist/pricing/schema.d.ts +8 -0
- package/dist/pricing/schema.d.ts.map +1 -0
- package/dist/pricing/schema.js +7 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts +95 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts.map +1 -0
- package/dist/pricing/service-catalog-plane-pricing.js +382 -0
- package/dist/pricing/service-catalogs.d.ts +139 -0
- package/dist/pricing/service-catalogs.d.ts.map +1 -0
- package/dist/pricing/service-catalogs.js +89 -0
- package/dist/pricing/service-categories.d.ts +147 -0
- package/dist/pricing/service-categories.d.ts.map +1 -0
- package/dist/pricing/service-categories.js +105 -0
- package/dist/pricing/service-departure-overrides.d.ts +67 -0
- package/dist/pricing/service-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/service-departure-overrides.js +54 -0
- package/dist/pricing/service-option-rules.d.ts +321 -0
- package/dist/pricing/service-option-rules.d.ts.map +1 -0
- package/dist/pricing/service-option-rules.js +340 -0
- package/dist/pricing/service-policies.d.ts +123 -0
- package/dist/pricing/service-policies.d.ts.map +1 -0
- package/dist/pricing/service-policies.js +95 -0
- package/dist/pricing/service-public.d.ts +89 -0
- package/dist/pricing/service-public.d.ts.map +1 -0
- package/dist/pricing/service-public.js +473 -0
- package/dist/pricing/service-rule-resolver.d.ts +67 -0
- package/dist/pricing/service-rule-resolver.d.ts.map +1 -0
- package/dist/pricing/service-rule-resolver.js +204 -0
- package/dist/pricing/service-shared.d.ts +53 -0
- package/dist/pricing/service-shared.d.ts.map +1 -0
- package/dist/pricing/service-shared.js +4 -0
- package/dist/pricing/service-transfer-rules.d.ts +211 -0
- package/dist/pricing/service-transfer-rules.d.ts.map +1 -0
- package/dist/pricing/service-transfer-rules.js +139 -0
- package/dist/pricing/service.d.ts +79 -0
- package/dist/pricing/service.d.ts.map +1 -0
- package/dist/pricing/service.js +78 -0
- package/dist/pricing/validation-public.d.ts +412 -0
- package/dist/pricing/validation-public.d.ts.map +1 -0
- package/dist/pricing/validation-public.js +111 -0
- package/dist/pricing/validation-shared.d.ts +71 -0
- package/dist/pricing/validation-shared.d.ts.map +1 -0
- package/dist/pricing/validation-shared.js +63 -0
- package/dist/pricing/validation.d.ts +987 -0
- package/dist/pricing/validation.d.ts.map +1 -0
- package/dist/pricing/validation.js +307 -0
- package/dist/promotions/events.d.ts +38 -0
- package/dist/promotions/events.d.ts.map +1 -0
- package/dist/promotions/events.js +25 -0
- package/dist/promotions/index.d.ts +12 -0
- package/dist/promotions/index.d.ts.map +1 -0
- package/dist/promotions/index.js +17 -0
- package/dist/promotions/routes-shared.d.ts +14 -0
- package/dist/promotions/routes-shared.d.ts.map +1 -0
- package/dist/promotions/routes-shared.js +3 -0
- package/dist/promotions/routes.d.ts +395 -0
- package/dist/promotions/routes.d.ts.map +1 -0
- package/dist/promotions/routes.js +55 -0
- package/dist/promotions/schema.d.ts +675 -0
- package/dist/promotions/schema.d.ts.map +1 -0
- package/dist/promotions/schema.js +126 -0
- package/dist/promotions/service-booking-confirmed.d.ts +77 -0
- package/dist/promotions/service-booking-confirmed.d.ts.map +1 -0
- package/dist/promotions/service-booking-confirmed.js +134 -0
- package/dist/promotions/service-boundary-scheduler.d.ts +85 -0
- package/dist/promotions/service-boundary-scheduler.d.ts.map +1 -0
- package/dist/promotions/service-boundary-scheduler.js +141 -0
- package/dist/promotions/service-catalog-evaluator.d.ts +22 -0
- package/dist/promotions/service-catalog-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-catalog-evaluator.js +33 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts +73 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts.map +1 -0
- package/dist/promotions/service-catalog-plane-promotions.js +118 -0
- package/dist/promotions/service-evaluator.d.ts +134 -0
- package/dist/promotions/service-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-evaluator.js +302 -0
- package/dist/promotions/service-storefront.d.ts +147 -0
- package/dist/promotions/service-storefront.d.ts.map +1 -0
- package/dist/promotions/service-storefront.js +326 -0
- package/dist/promotions/service.d.ts +143 -0
- package/dist/promotions/service.d.ts.map +1 -0
- package/dist/promotions/service.js +359 -0
- package/dist/promotions/validation.d.ts +195 -0
- package/dist/promotions/validation.d.ts.map +1 -0
- package/dist/promotions/validation.js +167 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts +36 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts.map +1 -0
- package/dist/promotions/workflow-bulk-reindex.js +53 -0
- package/dist/promotions/workflow-runtime.d.ts +17 -0
- package/dist/promotions/workflow-runtime.d.ts.map +1 -0
- package/dist/promotions/workflow-runtime.js +9 -0
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +27 -0
- package/dist/runtime.test.d.ts +2 -0
- package/dist/runtime.test.d.ts.map +1 -0
- package/dist/runtime.test.js +25 -0
- package/dist/schema.d.ts +5 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +4 -0
- package/dist/sellability/index.d.ts +13 -0
- package/dist/sellability/index.d.ts.map +1 -0
- package/dist/sellability/index.js +17 -0
- package/dist/sellability/routes.d.ts +2332 -0
- package/dist/sellability/routes.d.ts.map +1 -0
- package/dist/sellability/routes.js +166 -0
- package/dist/sellability/schema.d.ts +1716 -0
- package/dist/sellability/schema.d.ts.map +1 -0
- package/dist/sellability/schema.js +278 -0
- package/dist/sellability/service-records.d.ts +316 -0
- package/dist/sellability/service-records.d.ts.map +1 -0
- package/dist/sellability/service-records.js +253 -0
- package/dist/sellability/service-resolve.d.ts +72 -0
- package/dist/sellability/service-resolve.d.ts.map +1 -0
- package/dist/sellability/service-resolve.js +580 -0
- package/dist/sellability/service-shared.d.ts +124 -0
- package/dist/sellability/service-shared.d.ts.map +1 -0
- package/dist/sellability/service-shared.js +96 -0
- package/dist/sellability/service-snapshots.d.ts +191 -0
- package/dist/sellability/service-snapshots.d.ts.map +1 -0
- package/dist/sellability/service-snapshots.js +153 -0
- package/dist/sellability/service.d.ts +1038 -0
- package/dist/sellability/service.d.ts.map +1 -0
- package/dist/sellability/service.js +17 -0
- package/dist/sellability/validation.d.ts +477 -0
- package/dist/sellability/validation.d.ts.map +1 -0
- package/dist/sellability/validation.js +192 -0
- package/dist/types.d.ts +239 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin routes for promotions — mounted by the operator starter at
|
|
3
|
+
* `/v1/admin/promotions/*` (staff-actor-gated by the parent app's
|
|
4
|
+
* middleware chain).
|
|
5
|
+
*
|
|
6
|
+
* PR1 ships CRUD only. Public storefront routes are exposed via the
|
|
7
|
+
* existing `/v1/public/products/:productId/offers` endpoints in
|
|
8
|
+
* `@voyant-travel/storefront` once the storefront resolver is wired in PR4.
|
|
9
|
+
*/
|
|
10
|
+
import { type Env } from "./routes-shared.js";
|
|
11
|
+
export declare const promotionsRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
12
|
+
"/": {
|
|
13
|
+
$get: {
|
|
14
|
+
input: {};
|
|
15
|
+
output: {
|
|
16
|
+
data: {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
description: string | null;
|
|
21
|
+
discountType: "percentage" | "fixed_amount";
|
|
22
|
+
discountPercent: string | null;
|
|
23
|
+
discountAmountCents: number | null;
|
|
24
|
+
currency: string | null;
|
|
25
|
+
scope: {
|
|
26
|
+
kind: "global";
|
|
27
|
+
} | {
|
|
28
|
+
kind: "products";
|
|
29
|
+
productIds: string[];
|
|
30
|
+
} | {
|
|
31
|
+
kind: "categories";
|
|
32
|
+
categoryIds: string[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: "destinations";
|
|
35
|
+
destinationIds: string[];
|
|
36
|
+
} | {
|
|
37
|
+
kind: "markets";
|
|
38
|
+
marketIds: string[];
|
|
39
|
+
} | {
|
|
40
|
+
kind: "audiences";
|
|
41
|
+
audiences: ("staff" | "customer" | "partner" | "supplier")[];
|
|
42
|
+
} | {
|
|
43
|
+
kind: "fare_codes";
|
|
44
|
+
fareCodes: string[];
|
|
45
|
+
} | {
|
|
46
|
+
kind: "cabin_grades";
|
|
47
|
+
cabinGradeCodes: string[];
|
|
48
|
+
};
|
|
49
|
+
conditions: {
|
|
50
|
+
minPax?: number | undefined;
|
|
51
|
+
pastGuestOnly?: boolean | undefined;
|
|
52
|
+
soloTravelerOnly?: boolean | undefined;
|
|
53
|
+
childTravelerOnly?: boolean | undefined;
|
|
54
|
+
familyOnly?: boolean | undefined;
|
|
55
|
+
};
|
|
56
|
+
validFrom: string | null;
|
|
57
|
+
validUntil: string | null;
|
|
58
|
+
code: string | null;
|
|
59
|
+
stackable: boolean;
|
|
60
|
+
active: boolean;
|
|
61
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}[];
|
|
65
|
+
total: number;
|
|
66
|
+
limit: number;
|
|
67
|
+
offset: number;
|
|
68
|
+
};
|
|
69
|
+
outputFormat: "json";
|
|
70
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} & {
|
|
74
|
+
"/": {
|
|
75
|
+
$post: {
|
|
76
|
+
input: {};
|
|
77
|
+
output: {
|
|
78
|
+
data: {
|
|
79
|
+
id: string;
|
|
80
|
+
code: string | null;
|
|
81
|
+
currency: string | null;
|
|
82
|
+
validUntil: string | null;
|
|
83
|
+
validFrom: string | null;
|
|
84
|
+
active: boolean;
|
|
85
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
86
|
+
description: string | null;
|
|
87
|
+
name: string;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
updatedAt: string;
|
|
90
|
+
slug: string;
|
|
91
|
+
discountType: "percentage" | "fixed_amount";
|
|
92
|
+
discountPercent: string | null;
|
|
93
|
+
discountAmountCents: number | null;
|
|
94
|
+
scope: {
|
|
95
|
+
kind: "global";
|
|
96
|
+
} | {
|
|
97
|
+
kind: "products";
|
|
98
|
+
productIds: string[];
|
|
99
|
+
} | {
|
|
100
|
+
kind: "categories";
|
|
101
|
+
categoryIds: string[];
|
|
102
|
+
} | {
|
|
103
|
+
kind: "destinations";
|
|
104
|
+
destinationIds: string[];
|
|
105
|
+
} | {
|
|
106
|
+
kind: "markets";
|
|
107
|
+
marketIds: string[];
|
|
108
|
+
} | {
|
|
109
|
+
kind: "audiences";
|
|
110
|
+
audiences: ("staff" | "customer" | "partner" | "supplier")[];
|
|
111
|
+
} | {
|
|
112
|
+
kind: "fare_codes";
|
|
113
|
+
fareCodes: string[];
|
|
114
|
+
} | {
|
|
115
|
+
kind: "cabin_grades";
|
|
116
|
+
cabinGradeCodes: string[];
|
|
117
|
+
};
|
|
118
|
+
conditions: {
|
|
119
|
+
minPax?: number | undefined;
|
|
120
|
+
pastGuestOnly?: boolean | undefined;
|
|
121
|
+
soloTravelerOnly?: boolean | undefined;
|
|
122
|
+
childTravelerOnly?: boolean | undefined;
|
|
123
|
+
familyOnly?: boolean | undefined;
|
|
124
|
+
};
|
|
125
|
+
stackable: boolean;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
outputFormat: "json";
|
|
129
|
+
status: 201;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
} & {
|
|
133
|
+
"/:id": {
|
|
134
|
+
$get: {
|
|
135
|
+
input: {
|
|
136
|
+
param: {
|
|
137
|
+
id: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
output: {
|
|
141
|
+
data: {
|
|
142
|
+
id: string;
|
|
143
|
+
code: string | null;
|
|
144
|
+
currency: string | null;
|
|
145
|
+
validUntil: string | null;
|
|
146
|
+
validFrom: string | null;
|
|
147
|
+
active: boolean;
|
|
148
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
149
|
+
description: string | null;
|
|
150
|
+
name: string;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
slug: string;
|
|
154
|
+
discountType: "percentage" | "fixed_amount";
|
|
155
|
+
discountPercent: string | null;
|
|
156
|
+
discountAmountCents: number | null;
|
|
157
|
+
scope: {
|
|
158
|
+
kind: "global";
|
|
159
|
+
} | {
|
|
160
|
+
kind: "products";
|
|
161
|
+
productIds: string[];
|
|
162
|
+
} | {
|
|
163
|
+
kind: "categories";
|
|
164
|
+
categoryIds: string[];
|
|
165
|
+
} | {
|
|
166
|
+
kind: "destinations";
|
|
167
|
+
destinationIds: string[];
|
|
168
|
+
} | {
|
|
169
|
+
kind: "markets";
|
|
170
|
+
marketIds: string[];
|
|
171
|
+
} | {
|
|
172
|
+
kind: "audiences";
|
|
173
|
+
audiences: ("staff" | "customer" | "partner" | "supplier")[];
|
|
174
|
+
} | {
|
|
175
|
+
kind: "fare_codes";
|
|
176
|
+
fareCodes: string[];
|
|
177
|
+
} | {
|
|
178
|
+
kind: "cabin_grades";
|
|
179
|
+
cabinGradeCodes: string[];
|
|
180
|
+
};
|
|
181
|
+
conditions: {
|
|
182
|
+
minPax?: number | undefined;
|
|
183
|
+
pastGuestOnly?: boolean | undefined;
|
|
184
|
+
soloTravelerOnly?: boolean | undefined;
|
|
185
|
+
childTravelerOnly?: boolean | undefined;
|
|
186
|
+
familyOnly?: boolean | undefined;
|
|
187
|
+
};
|
|
188
|
+
stackable: boolean;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
outputFormat: "json";
|
|
192
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
193
|
+
} | {
|
|
194
|
+
input: {
|
|
195
|
+
param: {
|
|
196
|
+
id: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
output: {
|
|
200
|
+
error: string;
|
|
201
|
+
};
|
|
202
|
+
outputFormat: "json";
|
|
203
|
+
status: 404;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
} & {
|
|
207
|
+
"/:id": {
|
|
208
|
+
$patch: {
|
|
209
|
+
input: {
|
|
210
|
+
param: {
|
|
211
|
+
id: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
output: {
|
|
215
|
+
error: string;
|
|
216
|
+
};
|
|
217
|
+
outputFormat: "json";
|
|
218
|
+
status: 404;
|
|
219
|
+
} | {
|
|
220
|
+
input: {
|
|
221
|
+
param: {
|
|
222
|
+
id: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
output: {
|
|
226
|
+
data: {
|
|
227
|
+
id: string;
|
|
228
|
+
code: string | null;
|
|
229
|
+
currency: string | null;
|
|
230
|
+
validUntil: string | null;
|
|
231
|
+
validFrom: string | null;
|
|
232
|
+
active: boolean;
|
|
233
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
234
|
+
description: string | null;
|
|
235
|
+
name: string;
|
|
236
|
+
createdAt: string;
|
|
237
|
+
updatedAt: string;
|
|
238
|
+
slug: string;
|
|
239
|
+
discountType: "percentage" | "fixed_amount";
|
|
240
|
+
discountPercent: string | null;
|
|
241
|
+
discountAmountCents: number | null;
|
|
242
|
+
scope: {
|
|
243
|
+
kind: "global";
|
|
244
|
+
} | {
|
|
245
|
+
kind: "products";
|
|
246
|
+
productIds: string[];
|
|
247
|
+
} | {
|
|
248
|
+
kind: "categories";
|
|
249
|
+
categoryIds: string[];
|
|
250
|
+
} | {
|
|
251
|
+
kind: "destinations";
|
|
252
|
+
destinationIds: string[];
|
|
253
|
+
} | {
|
|
254
|
+
kind: "markets";
|
|
255
|
+
marketIds: string[];
|
|
256
|
+
} | {
|
|
257
|
+
kind: "audiences";
|
|
258
|
+
audiences: ("staff" | "customer" | "partner" | "supplier")[];
|
|
259
|
+
} | {
|
|
260
|
+
kind: "fare_codes";
|
|
261
|
+
fareCodes: string[];
|
|
262
|
+
} | {
|
|
263
|
+
kind: "cabin_grades";
|
|
264
|
+
cabinGradeCodes: string[];
|
|
265
|
+
};
|
|
266
|
+
conditions: {
|
|
267
|
+
minPax?: number | undefined;
|
|
268
|
+
pastGuestOnly?: boolean | undefined;
|
|
269
|
+
soloTravelerOnly?: boolean | undefined;
|
|
270
|
+
childTravelerOnly?: boolean | undefined;
|
|
271
|
+
familyOnly?: boolean | undefined;
|
|
272
|
+
};
|
|
273
|
+
stackable: boolean;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
outputFormat: "json";
|
|
277
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
} & {
|
|
281
|
+
"/:id/archive": {
|
|
282
|
+
$post: {
|
|
283
|
+
input: {
|
|
284
|
+
param: {
|
|
285
|
+
id: string;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
output: {
|
|
289
|
+
error: string;
|
|
290
|
+
};
|
|
291
|
+
outputFormat: "json";
|
|
292
|
+
status: 404;
|
|
293
|
+
} | {
|
|
294
|
+
input: {
|
|
295
|
+
param: {
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
output: {
|
|
300
|
+
data: {
|
|
301
|
+
id: string;
|
|
302
|
+
code: string | null;
|
|
303
|
+
currency: string | null;
|
|
304
|
+
validUntil: string | null;
|
|
305
|
+
validFrom: string | null;
|
|
306
|
+
active: boolean;
|
|
307
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
308
|
+
description: string | null;
|
|
309
|
+
name: string;
|
|
310
|
+
createdAt: string;
|
|
311
|
+
updatedAt: string;
|
|
312
|
+
slug: string;
|
|
313
|
+
discountType: "percentage" | "fixed_amount";
|
|
314
|
+
discountPercent: string | null;
|
|
315
|
+
discountAmountCents: number | null;
|
|
316
|
+
scope: {
|
|
317
|
+
kind: "global";
|
|
318
|
+
} | {
|
|
319
|
+
kind: "products";
|
|
320
|
+
productIds: string[];
|
|
321
|
+
} | {
|
|
322
|
+
kind: "categories";
|
|
323
|
+
categoryIds: string[];
|
|
324
|
+
} | {
|
|
325
|
+
kind: "destinations";
|
|
326
|
+
destinationIds: string[];
|
|
327
|
+
} | {
|
|
328
|
+
kind: "markets";
|
|
329
|
+
marketIds: string[];
|
|
330
|
+
} | {
|
|
331
|
+
kind: "audiences";
|
|
332
|
+
audiences: ("staff" | "customer" | "partner" | "supplier")[];
|
|
333
|
+
} | {
|
|
334
|
+
kind: "fare_codes";
|
|
335
|
+
fareCodes: string[];
|
|
336
|
+
} | {
|
|
337
|
+
kind: "cabin_grades";
|
|
338
|
+
cabinGradeCodes: string[];
|
|
339
|
+
};
|
|
340
|
+
conditions: {
|
|
341
|
+
minPax?: number | undefined;
|
|
342
|
+
pastGuestOnly?: boolean | undefined;
|
|
343
|
+
soloTravelerOnly?: boolean | undefined;
|
|
344
|
+
childTravelerOnly?: boolean | undefined;
|
|
345
|
+
familyOnly?: boolean | undefined;
|
|
346
|
+
};
|
|
347
|
+
stackable: boolean;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
outputFormat: "json";
|
|
351
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
} & {
|
|
355
|
+
"/:id": {
|
|
356
|
+
$delete: {
|
|
357
|
+
input: {
|
|
358
|
+
param: {
|
|
359
|
+
id: string;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
output: {
|
|
363
|
+
error: string;
|
|
364
|
+
};
|
|
365
|
+
outputFormat: "json";
|
|
366
|
+
status: 404;
|
|
367
|
+
} | {
|
|
368
|
+
input: {
|
|
369
|
+
param: {
|
|
370
|
+
id: string;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
output: {
|
|
374
|
+
data: {
|
|
375
|
+
id: string;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
outputFormat: "json";
|
|
379
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
380
|
+
} | {
|
|
381
|
+
input: {
|
|
382
|
+
param: {
|
|
383
|
+
id: string;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
output: {
|
|
387
|
+
error: string;
|
|
388
|
+
};
|
|
389
|
+
outputFormat: "json";
|
|
390
|
+
status: 409;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
}, "/", "/:id">;
|
|
394
|
+
export type PromotionsRoutes = typeof promotionsRoutes;
|
|
395
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/promotions/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAQvD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAgDzB,CAAA;AAEJ,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin routes for promotions — mounted by the operator starter at
|
|
3
|
+
* `/v1/admin/promotions/*` (staff-actor-gated by the parent app's
|
|
4
|
+
* middleware chain).
|
|
5
|
+
*
|
|
6
|
+
* PR1 ships CRUD only. Public storefront routes are exposed via the
|
|
7
|
+
* existing `/v1/public/products/:productId/offers` endpoints in
|
|
8
|
+
* `@voyant-travel/storefront` once the storefront resolver is wired in PR4.
|
|
9
|
+
*/
|
|
10
|
+
import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
|
|
11
|
+
import { Hono } from "hono";
|
|
12
|
+
import { notFound } from "./routes-shared.js";
|
|
13
|
+
import { promotionsService } from "./service.js";
|
|
14
|
+
import { insertPromotionalOfferSchema, promotionalOfferListQuerySchema, updatePromotionalOfferSchema, } from "./validation.js";
|
|
15
|
+
export const promotionsRoutes = new Hono()
|
|
16
|
+
.get("/", async (c) => {
|
|
17
|
+
const query = await parseQuery(c, promotionalOfferListQuerySchema);
|
|
18
|
+
return c.json(await promotionsService.listOffers(c.get("db"), query));
|
|
19
|
+
})
|
|
20
|
+
.post("/", async (c) => c.json({
|
|
21
|
+
data: await promotionsService.createOffer(c.get("db"), await parseJsonBody(c, insertPromotionalOfferSchema), { eventBus: c.get("eventBus") }),
|
|
22
|
+
}, 201))
|
|
23
|
+
.get("/:id", async (c) => {
|
|
24
|
+
const offer = await promotionsService.getOfferById(c.get("db"), c.req.param("id"));
|
|
25
|
+
return offer ? c.json({ data: offer }) : notFound(c, "Promotional offer not found");
|
|
26
|
+
})
|
|
27
|
+
.patch("/:id", async (c) => {
|
|
28
|
+
const patch = await parseJsonBody(c, updatePromotionalOfferSchema);
|
|
29
|
+
const offer = await promotionsService.updateOffer(c.get("db"), c.req.param("id"), patch, {
|
|
30
|
+
eventBus: c.get("eventBus"),
|
|
31
|
+
});
|
|
32
|
+
return offer ? c.json({ data: offer }) : notFound(c, "Promotional offer not found");
|
|
33
|
+
})
|
|
34
|
+
.post("/:id/archive", async (c) => {
|
|
35
|
+
const offer = await promotionsService.archiveOffer(c.get("db"), c.req.param("id"), {
|
|
36
|
+
eventBus: c.get("eventBus"),
|
|
37
|
+
});
|
|
38
|
+
return offer ? c.json({ data: offer }) : notFound(c, "Promotional offer not found");
|
|
39
|
+
})
|
|
40
|
+
.delete("/:id", async (c) => {
|
|
41
|
+
try {
|
|
42
|
+
const result = await promotionsService.deleteOffer(c.get("db"), c.req.param("id"), {
|
|
43
|
+
eventBus: c.get("eventBus"),
|
|
44
|
+
});
|
|
45
|
+
return result ? c.json({ data: result }) : notFound(c, "Promotional offer not found");
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
// `deleteOffer` throws when redemptions exist (the FK RESTRICT
|
|
49
|
+
// would otherwise surface a less helpful error). Translate to 409.
|
|
50
|
+
if (err instanceof Error && err.message.includes("redemption(s) exist")) {
|
|
51
|
+
return c.json({ error: err.message }, 409);
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
});
|