@voyantjs/products 0.52.2 → 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/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.d.ts +2 -2
- 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 +21 -21
- package/dist/validation-public.d.ts +25 -25
- package/dist/validation-shared.d.ts +11 -11
- package/package.json +13 -7
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { productsService } from "./service.js";
|
|
4
|
+
import * as validation from "./validation.js";
|
|
5
|
+
export const productCatalogRoutes = new Hono()
|
|
6
|
+
// ==========================================================================
|
|
7
|
+
// Product Types
|
|
8
|
+
// ==========================================================================
|
|
9
|
+
.get("/product-types", async (c) => {
|
|
10
|
+
const query = parseQuery(c, validation.productTypeListQuerySchema);
|
|
11
|
+
return c.json(await productsService.listProductTypes(c.get("db"), query));
|
|
12
|
+
})
|
|
13
|
+
.get("/product-types/:typeId", async (c) => {
|
|
14
|
+
const row = await productsService.getProductTypeById(c.get("db"), c.req.param("typeId"));
|
|
15
|
+
if (!row) {
|
|
16
|
+
return c.json({ error: "Product type not found" }, 404);
|
|
17
|
+
}
|
|
18
|
+
return c.json({ data: row });
|
|
19
|
+
})
|
|
20
|
+
.post("/product-types", async (c) => {
|
|
21
|
+
return c.json({
|
|
22
|
+
data: await productsService.createProductType(c.get("db"), await parseJsonBody(c, validation.insertProductTypeSchema)),
|
|
23
|
+
}, 201);
|
|
24
|
+
})
|
|
25
|
+
.patch("/product-types/:typeId", async (c) => {
|
|
26
|
+
const row = await productsService.updateProductType(c.get("db"), c.req.param("typeId"), await parseJsonBody(c, validation.updateProductTypeSchema));
|
|
27
|
+
if (!row) {
|
|
28
|
+
return c.json({ error: "Product type not found" }, 404);
|
|
29
|
+
}
|
|
30
|
+
return c.json({ data: row });
|
|
31
|
+
})
|
|
32
|
+
.delete("/product-types/:typeId", async (c) => {
|
|
33
|
+
const row = await productsService.deleteProductType(c.get("db"), c.req.param("typeId"));
|
|
34
|
+
if (!row) {
|
|
35
|
+
return c.json({ error: "Product type not found" }, 404);
|
|
36
|
+
}
|
|
37
|
+
return c.json({ success: true }, 200);
|
|
38
|
+
})
|
|
39
|
+
// ==========================================================================
|
|
40
|
+
// Product Categories
|
|
41
|
+
// ==========================================================================
|
|
42
|
+
.get("/product-categories", async (c) => {
|
|
43
|
+
const query = parseQuery(c, validation.productCategoryListQuerySchema);
|
|
44
|
+
return c.json(await productsService.listProductCategories(c.get("db"), query));
|
|
45
|
+
})
|
|
46
|
+
.get("/product-categories/:categoryId", async (c) => {
|
|
47
|
+
const row = await productsService.getProductCategoryById(c.get("db"), c.req.param("categoryId"));
|
|
48
|
+
if (!row) {
|
|
49
|
+
return c.json({ error: "Product category not found" }, 404);
|
|
50
|
+
}
|
|
51
|
+
return c.json({ data: row });
|
|
52
|
+
})
|
|
53
|
+
.post("/product-categories", async (c) => {
|
|
54
|
+
return c.json({
|
|
55
|
+
data: await productsService.createProductCategory(c.get("db"), await parseJsonBody(c, validation.insertProductCategorySchema)),
|
|
56
|
+
}, 201);
|
|
57
|
+
})
|
|
58
|
+
.patch("/product-categories/:categoryId", async (c) => {
|
|
59
|
+
const row = await productsService.updateProductCategory(c.get("db"), c.req.param("categoryId"), await parseJsonBody(c, validation.updateProductCategorySchema));
|
|
60
|
+
if (!row) {
|
|
61
|
+
return c.json({ error: "Product category not found" }, 404);
|
|
62
|
+
}
|
|
63
|
+
return c.json({ data: row });
|
|
64
|
+
})
|
|
65
|
+
.delete("/product-categories/:categoryId", async (c) => {
|
|
66
|
+
const row = await productsService.deleteProductCategory(c.get("db"), c.req.param("categoryId"));
|
|
67
|
+
if (!row) {
|
|
68
|
+
return c.json({ error: "Product category not found" }, 404);
|
|
69
|
+
}
|
|
70
|
+
return c.json({ success: true }, 200);
|
|
71
|
+
})
|
|
72
|
+
// ==========================================================================
|
|
73
|
+
// Product Tags
|
|
74
|
+
// ==========================================================================
|
|
75
|
+
.get("/product-tags", async (c) => {
|
|
76
|
+
const query = parseQuery(c, validation.productTagListQuerySchema);
|
|
77
|
+
return c.json(await productsService.listProductTags(c.get("db"), query));
|
|
78
|
+
})
|
|
79
|
+
.get("/product-tags/:tagId", async (c) => {
|
|
80
|
+
const row = await productsService.getProductTagById(c.get("db"), c.req.param("tagId"));
|
|
81
|
+
if (!row) {
|
|
82
|
+
return c.json({ error: "Product tag not found" }, 404);
|
|
83
|
+
}
|
|
84
|
+
return c.json({ data: row });
|
|
85
|
+
})
|
|
86
|
+
.post("/product-tags", async (c) => {
|
|
87
|
+
return c.json({
|
|
88
|
+
data: await productsService.createProductTag(c.get("db"), await parseJsonBody(c, validation.insertProductTagSchema)),
|
|
89
|
+
}, 201);
|
|
90
|
+
})
|
|
91
|
+
.patch("/product-tags/:tagId", async (c) => {
|
|
92
|
+
const row = await productsService.updateProductTag(c.get("db"), c.req.param("tagId"), await parseJsonBody(c, validation.updateProductTagSchema));
|
|
93
|
+
if (!row) {
|
|
94
|
+
return c.json({ error: "Product tag not found" }, 404);
|
|
95
|
+
}
|
|
96
|
+
return c.json({ data: row });
|
|
97
|
+
})
|
|
98
|
+
.delete("/product-tags/:tagId", async (c) => {
|
|
99
|
+
const row = await productsService.deleteProductTag(c.get("db"), c.req.param("tagId"));
|
|
100
|
+
if (!row) {
|
|
101
|
+
return c.json({ error: "Product tag not found" }, 404);
|
|
102
|
+
}
|
|
103
|
+
return c.json({ success: true }, 200);
|
|
104
|
+
});
|