@voyantjs/products 0.52.1 → 0.52.3
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/action-ledger-drift.d.ts +29 -0
- package/dist/action-ledger-drift.d.ts.map +1 -0
- package/dist/action-ledger-drift.js +335 -0
- package/dist/action-ledger.d.ts +104 -0
- package/dist/action-ledger.d.ts.map +1 -0
- package/dist/action-ledger.js +100 -0
- package/dist/booking-extension.d.ts +3 -3
- package/dist/catalog-policy.d.ts.map +1 -1
- package/dist/catalog-policy.js +18 -0
- package/dist/content-shape.d.ts +2 -0
- package/dist/content-shape.d.ts.map +1 -1
- package/dist/content-shape.js +2 -0
- package/dist/events.d.ts +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/route-env.d.ts +22 -0
- package/dist/route-env.d.ts.map +1 -0
- package/dist/route-env.js +1 -0
- package/dist/routes-associations.d.ts +164 -0
- package/dist/routes-associations.d.ts.map +1 -0
- package/dist/routes-associations.js +100 -0
- package/dist/routes-catalog.d.ts +436 -0
- package/dist/routes-catalog.d.ts.map +1 -0
- package/dist/routes-catalog.js +104 -0
- package/dist/routes-configuration.d.ts +773 -0
- package/dist/routes-configuration.d.ts.map +1 -0
- package/dist/routes-configuration.js +364 -0
- package/dist/routes-core.d.ts +302 -0
- package/dist/routes-core.d.ts.map +1 -0
- package/dist/routes-core.js +79 -0
- package/dist/routes-itinerary.d.ts +614 -0
- package/dist/routes-itinerary.d.ts.map +1 -0
- package/dist/routes-itinerary.js +309 -0
- package/dist/routes-maintenance.d.ts +32 -0
- package/dist/routes-maintenance.d.ts.map +1 -0
- package/dist/routes-maintenance.js +14 -0
- package/dist/routes-media.d.ts +634 -0
- package/dist/routes-media.d.ts.map +1 -0
- package/dist/routes-media.js +245 -0
- package/dist/routes-merchandising.d.ts +1108 -0
- package/dist/routes-merchandising.d.ts.map +1 -0
- package/dist/routes-merchandising.js +376 -0
- package/dist/routes-options.d.ts +363 -0
- package/dist/routes-options.d.ts.map +1 -0
- package/dist/routes-options.js +173 -0
- package/dist/routes-public.d.ts +4 -4
- package/dist/routes-translations.d.ts +477 -0
- package/dist/routes-translations.d.ts.map +1 -0
- package/dist/routes-translations.js +258 -0
- package/dist/routes.d.ts +417 -355
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +21 -1133
- package/dist/schema-core.d.ts +3 -3
- package/dist/schema-itinerary.d.ts +1 -1
- package/dist/schema-settings.d.ts +4 -4
- package/dist/service-catalog-plane.d.ts.map +1 -1
- package/dist/service-catalog-plane.js +48 -1
- package/dist/service-catalog.d.ts +2 -2
- package/dist/service-content-owned.d.ts.map +1 -1
- package/dist/service-content-owned.js +98 -4
- package/dist/service-public.d.ts +4 -4
- package/dist/service.d.ts +225 -97
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +91 -0
- package/dist/tasks/brochures.d.ts +1 -1
- package/dist/validation-catalog.d.ts +10 -10
- package/dist/validation-config.d.ts +17 -17
- package/dist/validation-content.d.ts +26 -26
- package/dist/validation-core.d.ts +46 -46
- package/dist/validation-core.d.ts.map +1 -1
- package/dist/validation-core.js +17 -1
- package/dist/validation-public.d.ts +25 -25
- package/dist/validation-shared.d.ts +11 -11
- package/package.json +13 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-configuration.d.ts","sourceRoot":"","sources":["../src/routes-configuration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAobnC,CAAA"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { appendProductMutationLedgerEntry, changedMutationFields } from "./action-ledger.js";
|
|
4
|
+
import { productsService } from "./service.js";
|
|
5
|
+
import * as validation from "./validation.js";
|
|
6
|
+
export const productConfigurationRoutes = new Hono()
|
|
7
|
+
// ==========================================================================
|
|
8
|
+
// Product operating configuration
|
|
9
|
+
// ==========================================================================
|
|
10
|
+
.get("/activation-settings", async (c) => {
|
|
11
|
+
const query = parseQuery(c, validation.productActivationSettingListQuerySchema);
|
|
12
|
+
return c.json(await productsService.listActivationSettings(c.get("db"), query));
|
|
13
|
+
})
|
|
14
|
+
.get("/activation-settings/:id", async (c) => {
|
|
15
|
+
const row = await productsService.getActivationSettingById(c.get("db"), c.req.param("id"));
|
|
16
|
+
if (!row) {
|
|
17
|
+
return c.json({ error: "Product activation setting not found" }, 404);
|
|
18
|
+
}
|
|
19
|
+
return c.json({ data: row });
|
|
20
|
+
})
|
|
21
|
+
.post("/:id/activation-settings", async (c) => {
|
|
22
|
+
const productId = c.req.param("id");
|
|
23
|
+
const body = await parseJsonBody(c, validation.insertProductActivationSettingSchema);
|
|
24
|
+
const before = await productsService.getActivationSettingByProductId(c.get("db"), productId);
|
|
25
|
+
const row = await productsService.upsertActivationSetting(c.get("db"), productId, body);
|
|
26
|
+
if (!row) {
|
|
27
|
+
return c.json({ error: "Product not found" }, 404);
|
|
28
|
+
}
|
|
29
|
+
const action = before ? "update" : "create";
|
|
30
|
+
await appendProductMutationLedgerEntry(c, {
|
|
31
|
+
action,
|
|
32
|
+
productId,
|
|
33
|
+
changedFields: changedMutationFields(body, before, row),
|
|
34
|
+
subject: "product activation settings",
|
|
35
|
+
actionName: `product.activation_settings.${action}`,
|
|
36
|
+
routeOrToolName: `products.activation_settings.${action}`,
|
|
37
|
+
});
|
|
38
|
+
return c.json({ data: row }, 201);
|
|
39
|
+
})
|
|
40
|
+
.patch("/activation-settings/:id", async (c) => {
|
|
41
|
+
const id = c.req.param("id");
|
|
42
|
+
const body = await parseJsonBody(c, validation.updateProductActivationSettingSchema);
|
|
43
|
+
const before = await productsService.getActivationSettingById(c.get("db"), id);
|
|
44
|
+
if (!before) {
|
|
45
|
+
return c.json({ error: "Product activation setting not found" }, 404);
|
|
46
|
+
}
|
|
47
|
+
const row = await productsService.updateActivationSetting(c.get("db"), id, body);
|
|
48
|
+
if (!row) {
|
|
49
|
+
return c.json({ error: "Product activation setting not found" }, 404);
|
|
50
|
+
}
|
|
51
|
+
await appendProductMutationLedgerEntry(c, {
|
|
52
|
+
action: "update",
|
|
53
|
+
productId: row.productId,
|
|
54
|
+
changedFields: changedMutationFields(body, before, row),
|
|
55
|
+
subject: "product activation settings",
|
|
56
|
+
actionName: "product.activation_settings.update",
|
|
57
|
+
routeOrToolName: "products.activation_settings.update",
|
|
58
|
+
});
|
|
59
|
+
return c.json({ data: row });
|
|
60
|
+
})
|
|
61
|
+
.delete("/activation-settings/:id", async (c) => {
|
|
62
|
+
const id = c.req.param("id");
|
|
63
|
+
const before = await productsService.getActivationSettingById(c.get("db"), id);
|
|
64
|
+
if (!before) {
|
|
65
|
+
return c.json({ error: "Product activation setting not found" }, 404);
|
|
66
|
+
}
|
|
67
|
+
const row = await productsService.deleteActivationSetting(c.get("db"), id);
|
|
68
|
+
if (!row) {
|
|
69
|
+
return c.json({ error: "Product activation setting not found" }, 404);
|
|
70
|
+
}
|
|
71
|
+
await appendProductMutationLedgerEntry(c, {
|
|
72
|
+
action: "delete",
|
|
73
|
+
productId: before.productId,
|
|
74
|
+
changedFields: [],
|
|
75
|
+
subject: "product activation settings",
|
|
76
|
+
actionName: "product.activation_settings.delete",
|
|
77
|
+
routeOrToolName: "products.activation_settings.delete",
|
|
78
|
+
});
|
|
79
|
+
return c.json({ success: true }, 200);
|
|
80
|
+
})
|
|
81
|
+
.get("/ticket-settings", async (c) => {
|
|
82
|
+
const query = parseQuery(c, validation.productTicketSettingListQuerySchema);
|
|
83
|
+
return c.json(await productsService.listTicketSettings(c.get("db"), query));
|
|
84
|
+
})
|
|
85
|
+
.get("/ticket-settings/:id", async (c) => {
|
|
86
|
+
const row = await productsService.getTicketSettingById(c.get("db"), c.req.param("id"));
|
|
87
|
+
if (!row) {
|
|
88
|
+
return c.json({ error: "Product ticket setting not found" }, 404);
|
|
89
|
+
}
|
|
90
|
+
return c.json({ data: row });
|
|
91
|
+
})
|
|
92
|
+
.post("/:id/ticket-settings", async (c) => {
|
|
93
|
+
const productId = c.req.param("id");
|
|
94
|
+
const body = await parseJsonBody(c, validation.insertProductTicketSettingSchema);
|
|
95
|
+
const before = await productsService.getTicketSettingByProductId(c.get("db"), productId);
|
|
96
|
+
const row = await productsService.upsertTicketSetting(c.get("db"), productId, body);
|
|
97
|
+
if (!row) {
|
|
98
|
+
return c.json({ error: "Product not found" }, 404);
|
|
99
|
+
}
|
|
100
|
+
const action = before ? "update" : "create";
|
|
101
|
+
await appendProductMutationLedgerEntry(c, {
|
|
102
|
+
action,
|
|
103
|
+
productId,
|
|
104
|
+
changedFields: changedMutationFields(body, before, row),
|
|
105
|
+
subject: "product ticket settings",
|
|
106
|
+
actionName: `product.ticket_settings.${action}`,
|
|
107
|
+
routeOrToolName: `products.ticket_settings.${action}`,
|
|
108
|
+
});
|
|
109
|
+
return c.json({ data: row }, 201);
|
|
110
|
+
})
|
|
111
|
+
.patch("/ticket-settings/:id", async (c) => {
|
|
112
|
+
const id = c.req.param("id");
|
|
113
|
+
const body = await parseJsonBody(c, validation.updateProductTicketSettingSchema);
|
|
114
|
+
const before = await productsService.getTicketSettingById(c.get("db"), id);
|
|
115
|
+
if (!before) {
|
|
116
|
+
return c.json({ error: "Product ticket setting not found" }, 404);
|
|
117
|
+
}
|
|
118
|
+
const row = await productsService.updateTicketSetting(c.get("db"), id, body);
|
|
119
|
+
if (!row) {
|
|
120
|
+
return c.json({ error: "Product ticket setting not found" }, 404);
|
|
121
|
+
}
|
|
122
|
+
await appendProductMutationLedgerEntry(c, {
|
|
123
|
+
action: "update",
|
|
124
|
+
productId: row.productId,
|
|
125
|
+
changedFields: changedMutationFields(body, before, row),
|
|
126
|
+
subject: "product ticket settings",
|
|
127
|
+
actionName: "product.ticket_settings.update",
|
|
128
|
+
routeOrToolName: "products.ticket_settings.update",
|
|
129
|
+
});
|
|
130
|
+
return c.json({ data: row });
|
|
131
|
+
})
|
|
132
|
+
.delete("/ticket-settings/:id", async (c) => {
|
|
133
|
+
const id = c.req.param("id");
|
|
134
|
+
const before = await productsService.getTicketSettingById(c.get("db"), id);
|
|
135
|
+
if (!before) {
|
|
136
|
+
return c.json({ error: "Product ticket setting not found" }, 404);
|
|
137
|
+
}
|
|
138
|
+
const row = await productsService.deleteTicketSetting(c.get("db"), id);
|
|
139
|
+
if (!row) {
|
|
140
|
+
return c.json({ error: "Product ticket setting not found" }, 404);
|
|
141
|
+
}
|
|
142
|
+
await appendProductMutationLedgerEntry(c, {
|
|
143
|
+
action: "delete",
|
|
144
|
+
productId: before.productId,
|
|
145
|
+
changedFields: [],
|
|
146
|
+
subject: "product ticket settings",
|
|
147
|
+
actionName: "product.ticket_settings.delete",
|
|
148
|
+
routeOrToolName: "products.ticket_settings.delete",
|
|
149
|
+
});
|
|
150
|
+
return c.json({ success: true }, 200);
|
|
151
|
+
})
|
|
152
|
+
.get("/visibility-settings", async (c) => {
|
|
153
|
+
const query = parseQuery(c, validation.productVisibilitySettingListQuerySchema);
|
|
154
|
+
return c.json(await productsService.listVisibilitySettings(c.get("db"), query));
|
|
155
|
+
})
|
|
156
|
+
.get("/visibility-settings/:id", async (c) => {
|
|
157
|
+
const row = await productsService.getVisibilitySettingById(c.get("db"), c.req.param("id"));
|
|
158
|
+
if (!row) {
|
|
159
|
+
return c.json({ error: "Product visibility setting not found" }, 404);
|
|
160
|
+
}
|
|
161
|
+
return c.json({ data: row });
|
|
162
|
+
})
|
|
163
|
+
.post("/:id/visibility-settings", async (c) => {
|
|
164
|
+
const productId = c.req.param("id");
|
|
165
|
+
const body = await parseJsonBody(c, validation.insertProductVisibilitySettingSchema);
|
|
166
|
+
const before = await productsService.getVisibilitySettingByProductId(c.get("db"), productId);
|
|
167
|
+
const row = await productsService.upsertVisibilitySetting(c.get("db"), productId, body);
|
|
168
|
+
if (!row) {
|
|
169
|
+
return c.json({ error: "Product not found" }, 404);
|
|
170
|
+
}
|
|
171
|
+
const action = before ? "update" : "create";
|
|
172
|
+
await appendProductMutationLedgerEntry(c, {
|
|
173
|
+
action,
|
|
174
|
+
productId,
|
|
175
|
+
changedFields: changedMutationFields(body, before, row),
|
|
176
|
+
subject: "product visibility settings",
|
|
177
|
+
actionName: `product.visibility_settings.${action}`,
|
|
178
|
+
routeOrToolName: `products.visibility_settings.${action}`,
|
|
179
|
+
});
|
|
180
|
+
return c.json({ data: row }, 201);
|
|
181
|
+
})
|
|
182
|
+
.patch("/visibility-settings/:id", async (c) => {
|
|
183
|
+
const id = c.req.param("id");
|
|
184
|
+
const body = await parseJsonBody(c, validation.updateProductVisibilitySettingSchema);
|
|
185
|
+
const before = await productsService.getVisibilitySettingById(c.get("db"), id);
|
|
186
|
+
if (!before) {
|
|
187
|
+
return c.json({ error: "Product visibility setting not found" }, 404);
|
|
188
|
+
}
|
|
189
|
+
const row = await productsService.updateVisibilitySetting(c.get("db"), id, body);
|
|
190
|
+
if (!row) {
|
|
191
|
+
return c.json({ error: "Product visibility setting not found" }, 404);
|
|
192
|
+
}
|
|
193
|
+
await appendProductMutationLedgerEntry(c, {
|
|
194
|
+
action: "update",
|
|
195
|
+
productId: row.productId,
|
|
196
|
+
changedFields: changedMutationFields(body, before, row),
|
|
197
|
+
subject: "product visibility settings",
|
|
198
|
+
actionName: "product.visibility_settings.update",
|
|
199
|
+
routeOrToolName: "products.visibility_settings.update",
|
|
200
|
+
});
|
|
201
|
+
return c.json({ data: row });
|
|
202
|
+
})
|
|
203
|
+
.delete("/visibility-settings/:id", async (c) => {
|
|
204
|
+
const id = c.req.param("id");
|
|
205
|
+
const before = await productsService.getVisibilitySettingById(c.get("db"), id);
|
|
206
|
+
if (!before) {
|
|
207
|
+
return c.json({ error: "Product visibility setting not found" }, 404);
|
|
208
|
+
}
|
|
209
|
+
const row = await productsService.deleteVisibilitySetting(c.get("db"), id);
|
|
210
|
+
if (!row) {
|
|
211
|
+
return c.json({ error: "Product visibility setting not found" }, 404);
|
|
212
|
+
}
|
|
213
|
+
await appendProductMutationLedgerEntry(c, {
|
|
214
|
+
action: "delete",
|
|
215
|
+
productId: before.productId,
|
|
216
|
+
changedFields: [],
|
|
217
|
+
subject: "product visibility settings",
|
|
218
|
+
actionName: "product.visibility_settings.delete",
|
|
219
|
+
routeOrToolName: "products.visibility_settings.delete",
|
|
220
|
+
});
|
|
221
|
+
return c.json({ success: true }, 200);
|
|
222
|
+
})
|
|
223
|
+
.get("/capabilities", async (c) => {
|
|
224
|
+
const query = parseQuery(c, validation.productCapabilityListQuerySchema);
|
|
225
|
+
return c.json(await productsService.listCapabilities(c.get("db"), query));
|
|
226
|
+
})
|
|
227
|
+
.get("/capabilities/:id", async (c) => {
|
|
228
|
+
const row = await productsService.getCapabilityById(c.get("db"), c.req.param("id"));
|
|
229
|
+
if (!row) {
|
|
230
|
+
return c.json({ error: "Product capability not found" }, 404);
|
|
231
|
+
}
|
|
232
|
+
return c.json({ data: row });
|
|
233
|
+
})
|
|
234
|
+
.post("/:id/capabilities", async (c) => {
|
|
235
|
+
const productId = c.req.param("id");
|
|
236
|
+
const body = await parseJsonBody(c, validation.insertProductCapabilitySchema);
|
|
237
|
+
const before = await productsService.getCapabilityByProductAndName(c.get("db"), productId, body.capability);
|
|
238
|
+
const row = await productsService.createCapability(c.get("db"), productId, body);
|
|
239
|
+
if (!row) {
|
|
240
|
+
return c.json({ error: "Product not found" }, 404);
|
|
241
|
+
}
|
|
242
|
+
const action = before ? "update" : "create";
|
|
243
|
+
await appendProductMutationLedgerEntry(c, {
|
|
244
|
+
action,
|
|
245
|
+
productId,
|
|
246
|
+
changedFields: changedMutationFields(body, before, row),
|
|
247
|
+
subject: "product capability",
|
|
248
|
+
actionName: `product.capability.${action}`,
|
|
249
|
+
routeOrToolName: `products.capability.${action}`,
|
|
250
|
+
});
|
|
251
|
+
return c.json({ data: row }, 201);
|
|
252
|
+
})
|
|
253
|
+
.patch("/capabilities/:id", async (c) => {
|
|
254
|
+
const id = c.req.param("id");
|
|
255
|
+
const body = await parseJsonBody(c, validation.updateProductCapabilitySchema);
|
|
256
|
+
const before = await productsService.getCapabilityById(c.get("db"), id);
|
|
257
|
+
if (!before) {
|
|
258
|
+
return c.json({ error: "Product capability not found" }, 404);
|
|
259
|
+
}
|
|
260
|
+
const row = await productsService.updateCapability(c.get("db"), id, body);
|
|
261
|
+
if (!row) {
|
|
262
|
+
return c.json({ error: "Product capability not found" }, 404);
|
|
263
|
+
}
|
|
264
|
+
await appendProductMutationLedgerEntry(c, {
|
|
265
|
+
action: "update",
|
|
266
|
+
productId: row.productId,
|
|
267
|
+
changedFields: changedMutationFields(body, before, row),
|
|
268
|
+
subject: "product capability",
|
|
269
|
+
actionName: "product.capability.update",
|
|
270
|
+
routeOrToolName: "products.capability.update",
|
|
271
|
+
});
|
|
272
|
+
return c.json({ data: row });
|
|
273
|
+
})
|
|
274
|
+
.delete("/capabilities/:id", async (c) => {
|
|
275
|
+
const id = c.req.param("id");
|
|
276
|
+
const before = await productsService.getCapabilityById(c.get("db"), id);
|
|
277
|
+
if (!before) {
|
|
278
|
+
return c.json({ error: "Product capability not found" }, 404);
|
|
279
|
+
}
|
|
280
|
+
const row = await productsService.deleteCapability(c.get("db"), id);
|
|
281
|
+
if (!row) {
|
|
282
|
+
return c.json({ error: "Product capability not found" }, 404);
|
|
283
|
+
}
|
|
284
|
+
await appendProductMutationLedgerEntry(c, {
|
|
285
|
+
action: "delete",
|
|
286
|
+
productId: before.productId,
|
|
287
|
+
changedFields: [],
|
|
288
|
+
subject: "product capability",
|
|
289
|
+
actionName: "product.capability.delete",
|
|
290
|
+
routeOrToolName: "products.capability.delete",
|
|
291
|
+
});
|
|
292
|
+
return c.json({ success: true }, 200);
|
|
293
|
+
})
|
|
294
|
+
.get("/delivery-formats", async (c) => {
|
|
295
|
+
const query = parseQuery(c, validation.productDeliveryFormatListQuerySchema);
|
|
296
|
+
return c.json(await productsService.listDeliveryFormats(c.get("db"), query));
|
|
297
|
+
})
|
|
298
|
+
.get("/delivery-formats/:id", async (c) => {
|
|
299
|
+
const row = await productsService.getDeliveryFormatById(c.get("db"), c.req.param("id"));
|
|
300
|
+
if (!row) {
|
|
301
|
+
return c.json({ error: "Product delivery format not found" }, 404);
|
|
302
|
+
}
|
|
303
|
+
return c.json({ data: row });
|
|
304
|
+
})
|
|
305
|
+
.post("/:id/delivery-formats", async (c) => {
|
|
306
|
+
const productId = c.req.param("id");
|
|
307
|
+
const body = await parseJsonBody(c, validation.insertProductDeliveryFormatSchema);
|
|
308
|
+
const before = await productsService.getDeliveryFormatByProductAndFormat(c.get("db"), productId, body.format);
|
|
309
|
+
const row = await productsService.createDeliveryFormat(c.get("db"), productId, body);
|
|
310
|
+
if (!row) {
|
|
311
|
+
return c.json({ error: "Product not found" }, 404);
|
|
312
|
+
}
|
|
313
|
+
const action = before ? "update" : "create";
|
|
314
|
+
await appendProductMutationLedgerEntry(c, {
|
|
315
|
+
action,
|
|
316
|
+
productId,
|
|
317
|
+
changedFields: changedMutationFields(body, before, row),
|
|
318
|
+
subject: "product delivery format",
|
|
319
|
+
actionName: `product.delivery_format.${action}`,
|
|
320
|
+
routeOrToolName: `products.delivery_format.${action}`,
|
|
321
|
+
});
|
|
322
|
+
return c.json({ data: row }, 201);
|
|
323
|
+
})
|
|
324
|
+
.patch("/delivery-formats/:id", async (c) => {
|
|
325
|
+
const id = c.req.param("id");
|
|
326
|
+
const body = await parseJsonBody(c, validation.updateProductDeliveryFormatSchema);
|
|
327
|
+
const before = await productsService.getDeliveryFormatById(c.get("db"), id);
|
|
328
|
+
if (!before) {
|
|
329
|
+
return c.json({ error: "Product delivery format not found" }, 404);
|
|
330
|
+
}
|
|
331
|
+
const row = await productsService.updateDeliveryFormat(c.get("db"), id, body);
|
|
332
|
+
if (!row) {
|
|
333
|
+
return c.json({ error: "Product delivery format not found" }, 404);
|
|
334
|
+
}
|
|
335
|
+
await appendProductMutationLedgerEntry(c, {
|
|
336
|
+
action: "update",
|
|
337
|
+
productId: row.productId,
|
|
338
|
+
changedFields: changedMutationFields(body, before, row),
|
|
339
|
+
subject: "product delivery format",
|
|
340
|
+
actionName: "product.delivery_format.update",
|
|
341
|
+
routeOrToolName: "products.delivery_format.update",
|
|
342
|
+
});
|
|
343
|
+
return c.json({ data: row });
|
|
344
|
+
})
|
|
345
|
+
.delete("/delivery-formats/:id", async (c) => {
|
|
346
|
+
const id = c.req.param("id");
|
|
347
|
+
const before = await productsService.getDeliveryFormatById(c.get("db"), id);
|
|
348
|
+
if (!before) {
|
|
349
|
+
return c.json({ error: "Product delivery format not found" }, 404);
|
|
350
|
+
}
|
|
351
|
+
const row = await productsService.deleteDeliveryFormat(c.get("db"), id);
|
|
352
|
+
if (!row) {
|
|
353
|
+
return c.json({ error: "Product delivery format not found" }, 404);
|
|
354
|
+
}
|
|
355
|
+
await appendProductMutationLedgerEntry(c, {
|
|
356
|
+
action: "delete",
|
|
357
|
+
productId: before.productId,
|
|
358
|
+
changedFields: [],
|
|
359
|
+
subject: "product delivery format",
|
|
360
|
+
actionName: "product.delivery_format.delete",
|
|
361
|
+
routeOrToolName: "products.delivery_format.delete",
|
|
362
|
+
});
|
|
363
|
+
return c.json({ success: true }, 200);
|
|
364
|
+
});
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import type { Env } from "./route-env.js";
|
|
2
|
+
export declare const productCoreRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
3
|
+
"/aggregates": {
|
|
4
|
+
$get: {
|
|
5
|
+
input: {};
|
|
6
|
+
output: {
|
|
7
|
+
data: {
|
|
8
|
+
total: number;
|
|
9
|
+
countsByStatus: {
|
|
10
|
+
status: "draft" | "active" | "archived";
|
|
11
|
+
count: number;
|
|
12
|
+
}[];
|
|
13
|
+
active: number;
|
|
14
|
+
publicActive: number;
|
|
15
|
+
monthlyCreatedCounts: {
|
|
16
|
+
yearMonth: string;
|
|
17
|
+
count: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
outputFormat: "json";
|
|
22
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
} & {
|
|
26
|
+
"/": {
|
|
27
|
+
$get: {
|
|
28
|
+
input: {};
|
|
29
|
+
output: {
|
|
30
|
+
data: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
status: "draft" | "active" | "archived";
|
|
34
|
+
description: string | null;
|
|
35
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
36
|
+
capacityMode: "free_sale" | "limited" | "on_request";
|
|
37
|
+
timezone: string | null;
|
|
38
|
+
visibility: "public" | "private" | "hidden";
|
|
39
|
+
activated: boolean;
|
|
40
|
+
reservationTimeoutMinutes: number | null;
|
|
41
|
+
sellCurrency: string;
|
|
42
|
+
sellAmountCents: number | null;
|
|
43
|
+
costAmountCents: number | null;
|
|
44
|
+
marginPercent: number | null;
|
|
45
|
+
facilityId: string | null;
|
|
46
|
+
supplierId: string | null;
|
|
47
|
+
startDate: string | null;
|
|
48
|
+
endDate: string | null;
|
|
49
|
+
pax: number | null;
|
|
50
|
+
productTypeId: string | null;
|
|
51
|
+
taxClassId: string | null;
|
|
52
|
+
customerPaymentPolicy: import("hono/utils/types").JSONValue;
|
|
53
|
+
tags: string[] | null;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}[];
|
|
57
|
+
total: number;
|
|
58
|
+
limit: number;
|
|
59
|
+
offset: number;
|
|
60
|
+
};
|
|
61
|
+
outputFormat: "json";
|
|
62
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
} & {
|
|
66
|
+
"/": {
|
|
67
|
+
$post: {
|
|
68
|
+
input: {};
|
|
69
|
+
output: {
|
|
70
|
+
data: {
|
|
71
|
+
name: string;
|
|
72
|
+
id: string;
|
|
73
|
+
description: string | null;
|
|
74
|
+
status: "draft" | "active" | "archived";
|
|
75
|
+
createdAt: string;
|
|
76
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
77
|
+
capacityMode: "free_sale" | "limited" | "on_request";
|
|
78
|
+
timezone: string | null;
|
|
79
|
+
visibility: "public" | "private" | "hidden";
|
|
80
|
+
activated: boolean;
|
|
81
|
+
reservationTimeoutMinutes: number | null;
|
|
82
|
+
sellCurrency: string;
|
|
83
|
+
sellAmountCents: number | null;
|
|
84
|
+
costAmountCents: number | null;
|
|
85
|
+
marginPercent: number | null;
|
|
86
|
+
facilityId: string | null;
|
|
87
|
+
supplierId: string | null;
|
|
88
|
+
startDate: string | null;
|
|
89
|
+
endDate: string | null;
|
|
90
|
+
pax: number | null;
|
|
91
|
+
productTypeId: string | null;
|
|
92
|
+
taxClassId: string | null;
|
|
93
|
+
customerPaymentPolicy: import("hono/utils/types").JSONValue;
|
|
94
|
+
tags: string[] | null;
|
|
95
|
+
updatedAt: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
outputFormat: "json";
|
|
99
|
+
status: 201;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
} & {
|
|
103
|
+
"/:id": {
|
|
104
|
+
$get: {
|
|
105
|
+
input: {
|
|
106
|
+
param: {
|
|
107
|
+
id: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
output: {
|
|
111
|
+
error: string;
|
|
112
|
+
};
|
|
113
|
+
outputFormat: "json";
|
|
114
|
+
status: 404;
|
|
115
|
+
} | {
|
|
116
|
+
input: {
|
|
117
|
+
param: {
|
|
118
|
+
id: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
output: {
|
|
122
|
+
data: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
status: "draft" | "active" | "archived";
|
|
126
|
+
description: string | null;
|
|
127
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
128
|
+
capacityMode: "free_sale" | "limited" | "on_request";
|
|
129
|
+
timezone: string | null;
|
|
130
|
+
visibility: "public" | "private" | "hidden";
|
|
131
|
+
activated: boolean;
|
|
132
|
+
reservationTimeoutMinutes: number | null;
|
|
133
|
+
sellCurrency: string;
|
|
134
|
+
sellAmountCents: number | null;
|
|
135
|
+
costAmountCents: number | null;
|
|
136
|
+
marginPercent: number | null;
|
|
137
|
+
facilityId: string | null;
|
|
138
|
+
supplierId: string | null;
|
|
139
|
+
startDate: string | null;
|
|
140
|
+
endDate: string | null;
|
|
141
|
+
pax: number | null;
|
|
142
|
+
productTypeId: string | null;
|
|
143
|
+
taxClassId: string | null;
|
|
144
|
+
customerPaymentPolicy: import("hono/utils/types").JSONValue;
|
|
145
|
+
tags: string[] | null;
|
|
146
|
+
createdAt: string;
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
outputFormat: "json";
|
|
151
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
} & {
|
|
155
|
+
"/:id/action-ledger": {
|
|
156
|
+
$get: {
|
|
157
|
+
input: {
|
|
158
|
+
param: {
|
|
159
|
+
id: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
output: {
|
|
163
|
+
error: string;
|
|
164
|
+
};
|
|
165
|
+
outputFormat: "json";
|
|
166
|
+
status: 404;
|
|
167
|
+
} | {
|
|
168
|
+
input: {
|
|
169
|
+
param: {
|
|
170
|
+
id: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
output: {
|
|
174
|
+
data: {
|
|
175
|
+
id: string;
|
|
176
|
+
actionName: string;
|
|
177
|
+
actionVersion: string;
|
|
178
|
+
actionKind: "execute" | "reverse" | "update" | "delete" | "read" | "create" | "approve" | "reject" | "compensate" | "duplicate";
|
|
179
|
+
status: "requested" | "awaiting_approval" | "approved" | "denied" | "succeeded" | "failed" | "reversed" | "compensated" | "expired" | "cancelled" | "superseded";
|
|
180
|
+
evaluatedRisk: "low" | "medium" | "high" | "critical";
|
|
181
|
+
actorType: string | null;
|
|
182
|
+
principalType: "user" | "api_key" | "agent" | "workflow" | "system";
|
|
183
|
+
principalId: string;
|
|
184
|
+
principalSubtype: string | null;
|
|
185
|
+
sessionId: string | null;
|
|
186
|
+
apiTokenId: string | null;
|
|
187
|
+
internalRequest: boolean;
|
|
188
|
+
delegatedByPrincipalType: "user" | "api_key" | "agent" | "workflow" | "system" | null;
|
|
189
|
+
delegatedByPrincipalId: string | null;
|
|
190
|
+
delegationId: string | null;
|
|
191
|
+
callerType: string | null;
|
|
192
|
+
organizationId: string | null;
|
|
193
|
+
routeOrToolName: string | null;
|
|
194
|
+
workflowRunId: string | null;
|
|
195
|
+
workflowStepId: string | null;
|
|
196
|
+
correlationId: string | null;
|
|
197
|
+
causationActionId: string | null;
|
|
198
|
+
idempotencyScope: string | null;
|
|
199
|
+
idempotencyKey: string | null;
|
|
200
|
+
idempotencyFingerprint: string | null;
|
|
201
|
+
targetType: string;
|
|
202
|
+
targetId: string;
|
|
203
|
+
capabilityId: string | null;
|
|
204
|
+
capabilityVersion: string | null;
|
|
205
|
+
authorizationSource: string | null;
|
|
206
|
+
approvalId: string | null;
|
|
207
|
+
amendsActionId: string | null;
|
|
208
|
+
occurredAt: string;
|
|
209
|
+
createdAt: string;
|
|
210
|
+
mutationSummary: string | null;
|
|
211
|
+
}[];
|
|
212
|
+
pageInfo: {
|
|
213
|
+
nextCursor: {
|
|
214
|
+
occurredAt: string;
|
|
215
|
+
id: string;
|
|
216
|
+
} | null;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
outputFormat: "json";
|
|
220
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
} & {
|
|
224
|
+
"/:id": {
|
|
225
|
+
$patch: {
|
|
226
|
+
input: {
|
|
227
|
+
param: {
|
|
228
|
+
id: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
output: {
|
|
232
|
+
error: string;
|
|
233
|
+
};
|
|
234
|
+
outputFormat: "json";
|
|
235
|
+
status: 404;
|
|
236
|
+
} | {
|
|
237
|
+
input: {
|
|
238
|
+
param: {
|
|
239
|
+
id: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
output: {
|
|
243
|
+
data: {
|
|
244
|
+
id: string;
|
|
245
|
+
name: string;
|
|
246
|
+
status: "draft" | "active" | "archived";
|
|
247
|
+
description: string | null;
|
|
248
|
+
bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
|
|
249
|
+
capacityMode: "free_sale" | "limited" | "on_request";
|
|
250
|
+
timezone: string | null;
|
|
251
|
+
visibility: "public" | "private" | "hidden";
|
|
252
|
+
activated: boolean;
|
|
253
|
+
reservationTimeoutMinutes: number | null;
|
|
254
|
+
sellCurrency: string;
|
|
255
|
+
sellAmountCents: number | null;
|
|
256
|
+
costAmountCents: number | null;
|
|
257
|
+
marginPercent: number | null;
|
|
258
|
+
facilityId: string | null;
|
|
259
|
+
supplierId: string | null;
|
|
260
|
+
startDate: string | null;
|
|
261
|
+
endDate: string | null;
|
|
262
|
+
pax: number | null;
|
|
263
|
+
productTypeId: string | null;
|
|
264
|
+
taxClassId: string | null;
|
|
265
|
+
customerPaymentPolicy: import("hono/utils/types").JSONValue;
|
|
266
|
+
tags: string[] | null;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
updatedAt: string;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
outputFormat: "json";
|
|
272
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
} & {
|
|
276
|
+
"/:id": {
|
|
277
|
+
$delete: {
|
|
278
|
+
input: {
|
|
279
|
+
param: {
|
|
280
|
+
id: string;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
output: {
|
|
284
|
+
error: string;
|
|
285
|
+
};
|
|
286
|
+
outputFormat: "json";
|
|
287
|
+
status: 404;
|
|
288
|
+
} | {
|
|
289
|
+
input: {
|
|
290
|
+
param: {
|
|
291
|
+
id: string;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
output: {
|
|
295
|
+
success: true;
|
|
296
|
+
};
|
|
297
|
+
outputFormat: "json";
|
|
298
|
+
status: 200;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
}, "/", "/:id">;
|
|
302
|
+
//# sourceMappingURL=routes-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-core.d.ts","sourceRoot":"","sources":["../src/routes-core.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsF1B,CAAA"}
|