@unifiedcommerce/core 0.1.0 → 0.2.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/auth/setup.d.ts.map +1 -1
- package/dist/auth/setup.js +8 -3
- package/dist/config/types.d.ts +3 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/interfaces/mcp/server.d.ts +3 -5
- package/dist/interfaces/mcp/server.d.ts.map +1 -1
- package/dist/interfaces/mcp/server.js +25 -510
- package/dist/interfaces/mcp/tool-builder.d.ts +120 -0
- package/dist/interfaces/mcp/tool-builder.d.ts.map +1 -0
- package/dist/interfaces/mcp/tool-builder.js +224 -0
- package/dist/interfaces/mcp/tools/analytics.d.ts +42 -0
- package/dist/interfaces/mcp/tools/analytics.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/analytics.js +70 -0
- package/dist/interfaces/mcp/tools/cart.d.ts +14 -0
- package/dist/interfaces/mcp/tools/cart.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/cart.js +47 -0
- package/dist/interfaces/mcp/tools/catalog.d.ts +53 -0
- package/dist/interfaces/mcp/tools/catalog.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/catalog.js +284 -0
- package/dist/interfaces/mcp/tools/index.d.ts +3 -0
- package/dist/interfaces/mcp/tools/index.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/index.js +20 -0
- package/dist/interfaces/mcp/tools/inventory.d.ts +27 -0
- package/dist/interfaces/mcp/tools/inventory.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/inventory.js +143 -0
- package/dist/interfaces/mcp/tools/orders.d.ts +18 -0
- package/dist/interfaces/mcp/tools/orders.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/orders.js +82 -0
- package/dist/interfaces/mcp/tools/pricing.d.ts +29 -0
- package/dist/interfaces/mcp/tools/pricing.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/pricing.js +90 -0
- package/dist/interfaces/mcp/tools/promotions.d.ts +44 -0
- package/dist/interfaces/mcp/tools/promotions.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/promotions.js +109 -0
- package/dist/interfaces/mcp/tools/registry.d.ts +32 -0
- package/dist/interfaces/mcp/tools/registry.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/registry.js +55 -0
- package/dist/interfaces/mcp/tools/search.d.ts +14 -0
- package/dist/interfaces/mcp/tools/search.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/search.js +39 -0
- package/dist/interfaces/mcp/tools/webhooks.d.ts +15 -0
- package/dist/interfaces/mcp/tools/webhooks.d.ts.map +1 -0
- package/dist/interfaces/mcp/tools/webhooks.js +48 -0
- package/dist/interfaces/mcp/transport.d.ts +17 -2
- package/dist/interfaces/mcp/transport.d.ts.map +1 -1
- package/dist/interfaces/mcp/transport.js +91 -44
- package/dist/interfaces/rest/router.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.js +1 -1
- package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/promotions.js +3 -2
- package/dist/kernel/database/adapter.d.ts +8 -0
- package/dist/kernel/database/adapter.d.ts.map +1 -1
- package/dist/kernel/factory/repository-factory.d.ts.map +1 -1
- package/dist/kernel/factory/repository-factory.js +3 -1
- package/dist/kernel/local-api.d.ts.map +1 -1
- package/dist/kernel/local-api.js +2 -0
- package/dist/kernel/plugin/manifest.d.ts +3 -3
- package/dist/kernel/plugin/manifest.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.js +36 -7
- package/dist/runtime/kernel.d.ts +1 -2
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/kernel.js +16 -8
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +8 -3
- package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -1
- package/dist/test-utils/create-pglite-adapter.js +7 -6
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -2
- package/src/adapters/console-email.ts +0 -43
- package/src/auth/access.ts +0 -187
- package/src/auth/auth-schema.ts +0 -139
- package/src/auth/middleware.ts +0 -161
- package/src/auth/org.ts +0 -41
- package/src/auth/permissions.ts +0 -28
- package/src/auth/setup.ts +0 -169
- package/src/auth/system-actor.ts +0 -19
- package/src/auth/types.ts +0 -10
- package/src/config/defaults.ts +0 -82
- package/src/config/define-config.ts +0 -53
- package/src/config/types.ts +0 -299
- package/src/generated/plugin-capabilities.d.ts +0 -20
- package/src/generated/plugin-manifest.ts +0 -23
- package/src/generated/plugin-repositories.d.ts +0 -20
- package/src/hooks/checkout-completion.ts +0 -262
- package/src/hooks/checkout.ts +0 -677
- package/src/hooks/order-emails.ts +0 -62
- package/src/index.ts +0 -214
- package/src/interfaces/mcp/agent-prompt.ts +0 -174
- package/src/interfaces/mcp/context-enrichment.ts +0 -177
- package/src/interfaces/mcp/server.ts +0 -617
- package/src/interfaces/mcp/transport.ts +0 -68
- package/src/interfaces/rest/customer-portal.ts +0 -299
- package/src/interfaces/rest/index.ts +0 -74
- package/src/interfaces/rest/router.ts +0 -334
- package/src/interfaces/rest/routes/admin-jobs.ts +0 -58
- package/src/interfaces/rest/routes/audit.ts +0 -50
- package/src/interfaces/rest/routes/carts.ts +0 -89
- package/src/interfaces/rest/routes/catalog.ts +0 -493
- package/src/interfaces/rest/routes/checkout.ts +0 -283
- package/src/interfaces/rest/routes/inventory.ts +0 -70
- package/src/interfaces/rest/routes/media.ts +0 -86
- package/src/interfaces/rest/routes/orders.ts +0 -78
- package/src/interfaces/rest/routes/payments.ts +0 -60
- package/src/interfaces/rest/routes/pricing.ts +0 -57
- package/src/interfaces/rest/routes/promotions.ts +0 -92
- package/src/interfaces/rest/routes/search.ts +0 -71
- package/src/interfaces/rest/routes/webhooks.ts +0 -46
- package/src/interfaces/rest/schemas/admin-jobs.ts +0 -40
- package/src/interfaces/rest/schemas/audit.ts +0 -46
- package/src/interfaces/rest/schemas/carts.ts +0 -125
- package/src/interfaces/rest/schemas/catalog.ts +0 -450
- package/src/interfaces/rest/schemas/checkout.ts +0 -66
- package/src/interfaces/rest/schemas/customer-portal.ts +0 -195
- package/src/interfaces/rest/schemas/inventory.ts +0 -138
- package/src/interfaces/rest/schemas/media.ts +0 -75
- package/src/interfaces/rest/schemas/orders.ts +0 -104
- package/src/interfaces/rest/schemas/pricing.ts +0 -80
- package/src/interfaces/rest/schemas/promotions.ts +0 -110
- package/src/interfaces/rest/schemas/responses.ts +0 -85
- package/src/interfaces/rest/schemas/search.ts +0 -58
- package/src/interfaces/rest/schemas/shared.ts +0 -62
- package/src/interfaces/rest/schemas/webhooks.ts +0 -68
- package/src/interfaces/rest/utils.ts +0 -104
- package/src/interfaces/rest/webhook-router.ts +0 -50
- package/src/kernel/compensation/executor.ts +0 -61
- package/src/kernel/compensation/types.ts +0 -26
- package/src/kernel/database/adapter.ts +0 -13
- package/src/kernel/database/drizzle-db.ts +0 -56
- package/src/kernel/database/migrate.ts +0 -76
- package/src/kernel/database/plugin-types.ts +0 -34
- package/src/kernel/database/schema.ts +0 -49
- package/src/kernel/database/scoped-db.ts +0 -68
- package/src/kernel/database/tx-context.ts +0 -46
- package/src/kernel/error-mapper.ts +0 -15
- package/src/kernel/errors.ts +0 -89
- package/src/kernel/factory/repository-factory.ts +0 -242
- package/src/kernel/hooks/create-context.ts +0 -43
- package/src/kernel/hooks/executor.ts +0 -88
- package/src/kernel/hooks/registry.ts +0 -74
- package/src/kernel/hooks/types.ts +0 -52
- package/src/kernel/http-error.ts +0 -44
- package/src/kernel/jobs/adapter.ts +0 -36
- package/src/kernel/jobs/drizzle-adapter.ts +0 -58
- package/src/kernel/jobs/runner.ts +0 -153
- package/src/kernel/jobs/schema.ts +0 -46
- package/src/kernel/jobs/types.ts +0 -30
- package/src/kernel/local-api.ts +0 -185
- package/src/kernel/plugin/manifest.ts +0 -253
- package/src/kernel/query/executor.ts +0 -184
- package/src/kernel/query/registry.ts +0 -46
- package/src/kernel/result.ts +0 -33
- package/src/kernel/schema/extra-columns.ts +0 -37
- package/src/kernel/service-registry.ts +0 -76
- package/src/kernel/service-timing.ts +0 -89
- package/src/kernel/state-machine/machine.ts +0 -101
- package/src/modules/analytics/drizzle-adapter.ts +0 -426
- package/src/modules/analytics/hooks.ts +0 -11
- package/src/modules/analytics/models.ts +0 -125
- package/src/modules/analytics/repository/index.ts +0 -6
- package/src/modules/analytics/service.ts +0 -245
- package/src/modules/analytics/types.ts +0 -180
- package/src/modules/audit/hooks.ts +0 -78
- package/src/modules/audit/schema.ts +0 -33
- package/src/modules/audit/service.ts +0 -151
- package/src/modules/cart/access.ts +0 -27
- package/src/modules/cart/matcher.ts +0 -26
- package/src/modules/cart/repository/index.ts +0 -234
- package/src/modules/cart/schema.ts +0 -42
- package/src/modules/cart/schemas.ts +0 -38
- package/src/modules/cart/service.ts +0 -541
- package/src/modules/catalog/repository/index.ts +0 -772
- package/src/modules/catalog/schema.ts +0 -203
- package/src/modules/catalog/schemas.ts +0 -104
- package/src/modules/catalog/service.ts +0 -1544
- package/src/modules/customers/repository/index.ts +0 -327
- package/src/modules/customers/schema.ts +0 -64
- package/src/modules/customers/service.ts +0 -171
- package/src/modules/fulfillment/repository/index.ts +0 -426
- package/src/modules/fulfillment/schema.ts +0 -101
- package/src/modules/fulfillment/service.ts +0 -555
- package/src/modules/fulfillment/types.ts +0 -59
- package/src/modules/inventory/repository/index.ts +0 -509
- package/src/modules/inventory/schema.ts +0 -94
- package/src/modules/inventory/schemas.ts +0 -38
- package/src/modules/inventory/service.ts +0 -490
- package/src/modules/media/adapter.ts +0 -17
- package/src/modules/media/repository/index.ts +0 -274
- package/src/modules/media/schema.ts +0 -41
- package/src/modules/media/service.ts +0 -151
- package/src/modules/orders/repository/index.ts +0 -287
- package/src/modules/orders/schema.ts +0 -66
- package/src/modules/orders/service.ts +0 -619
- package/src/modules/orders/stale-order-cleanup.ts +0 -76
- package/src/modules/organization/service.ts +0 -191
- package/src/modules/payments/adapter.ts +0 -47
- package/src/modules/payments/repository/index.ts +0 -6
- package/src/modules/payments/service.ts +0 -107
- package/src/modules/pricing/repository/index.ts +0 -291
- package/src/modules/pricing/schema.ts +0 -71
- package/src/modules/pricing/schemas.ts +0 -38
- package/src/modules/pricing/service.ts +0 -494
- package/src/modules/promotions/repository/index.ts +0 -325
- package/src/modules/promotions/schema.ts +0 -62
- package/src/modules/promotions/schemas.ts +0 -38
- package/src/modules/promotions/service.ts +0 -598
- package/src/modules/search/adapter.ts +0 -57
- package/src/modules/search/hooks.ts +0 -12
- package/src/modules/search/repository/index.ts +0 -6
- package/src/modules/search/service.ts +0 -315
- package/src/modules/shipping/calculator.ts +0 -188
- package/src/modules/shipping/repository/index.ts +0 -6
- package/src/modules/shipping/service.ts +0 -51
- package/src/modules/tax/adapter.ts +0 -60
- package/src/modules/tax/repository/index.ts +0 -6
- package/src/modules/tax/service.ts +0 -53
- package/src/modules/webhooks/hook.ts +0 -34
- package/src/modules/webhooks/repository/index.ts +0 -278
- package/src/modules/webhooks/schema.ts +0 -56
- package/src/modules/webhooks/service.ts +0 -117
- package/src/modules/webhooks/signing.ts +0 -6
- package/src/modules/webhooks/ssrf-guard.ts +0 -71
- package/src/modules/webhooks/tasks.ts +0 -52
- package/src/modules/webhooks/worker.ts +0 -134
- package/src/runtime/commerce.ts +0 -145
- package/src/runtime/kernel.ts +0 -419
- package/src/runtime/logger.ts +0 -36
- package/src/runtime/server.ts +0 -349
- package/src/runtime/shutdown.ts +0 -43
- package/src/test-utils/create-pglite-adapter.ts +0 -129
- package/src/test-utils/create-plugin-test-app.ts +0 -128
- package/src/test-utils/create-repository-test-harness.ts +0 -16
- package/src/test-utils/create-test-config.ts +0 -190
- package/src/test-utils/create-test-kernel.ts +0 -7
- package/src/test-utils/create-test-plugin-context.ts +0 -75
- package/src/test-utils/rest-api-test-utils.ts +0 -265
- package/src/test-utils/test-actors.ts +0 -62
- package/src/test-utils/typed-hooks.ts +0 -54
- package/src/types/commerce-types.ts +0 -34
- package/src/utils/id.ts +0 -3
- package/src/utils/logger.ts +0 -18
- package/src/utils/pagination.ts +0 -22
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { errorResponses } from "./shared.js";
|
|
3
|
-
import { CustomerResponse, OrderResponse, OrderListResponse, CustomerAddressListResponse, CartResponse } from "./responses.js";
|
|
4
|
-
|
|
5
|
-
const GenericDataResponse = z.object({ data: z.record(z.string(), z.unknown()) });
|
|
6
|
-
|
|
7
|
-
// ─── GET Route Definitions ─────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
export const getProfileRoute = createRoute({
|
|
10
|
-
method: "get",
|
|
11
|
-
path: "/profile",
|
|
12
|
-
tags: ["Customer Portal"],
|
|
13
|
-
summary: "Get customer profile",
|
|
14
|
-
responses: {
|
|
15
|
-
200: { content: { "application/json": { schema: CustomerResponse } }, description: "Customer profile" },
|
|
16
|
-
...errorResponses,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const listAddressesRoute = createRoute({
|
|
21
|
-
method: "get",
|
|
22
|
-
path: "/addresses",
|
|
23
|
-
tags: ["Customer Portal"],
|
|
24
|
-
summary: "List customer addresses",
|
|
25
|
-
responses: {
|
|
26
|
-
200: { content: { "application/json": { schema: CustomerAddressListResponse } }, description: "Addresses" },
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export const listCustomerOrdersRoute = createRoute({
|
|
31
|
-
method: "get",
|
|
32
|
-
path: "/orders",
|
|
33
|
-
tags: ["Customer Portal"],
|
|
34
|
-
summary: "List customer orders",
|
|
35
|
-
request: {
|
|
36
|
-
query: z.object({
|
|
37
|
-
status: z.string().optional(),
|
|
38
|
-
page: z.string().optional(),
|
|
39
|
-
limit: z.string().optional(),
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
responses: {
|
|
43
|
-
200: { content: { "application/json": { schema: OrderListResponse } }, description: "Orders" },
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const getCustomerOrderRoute = createRoute({
|
|
48
|
-
method: "get",
|
|
49
|
-
path: "/orders/{idOrNumber}",
|
|
50
|
-
tags: ["Customer Portal"],
|
|
51
|
-
summary: "Get a specific customer order",
|
|
52
|
-
request: {
|
|
53
|
-
params: z.object({
|
|
54
|
-
idOrNumber: z.string().min(1).openapi({ example: "ORD-001" }),
|
|
55
|
-
}),
|
|
56
|
-
},
|
|
57
|
-
responses: {
|
|
58
|
-
200: { content: { "application/json": { schema: OrderResponse } }, description: "Order details" },
|
|
59
|
-
...errorResponses,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export const getOrderTrackingRoute = createRoute({
|
|
64
|
-
method: "get",
|
|
65
|
-
path: "/orders/{idOrNumber}/tracking",
|
|
66
|
-
tags: ["Customer Portal"],
|
|
67
|
-
summary: "Get tracking info for an order",
|
|
68
|
-
request: {
|
|
69
|
-
params: z.object({
|
|
70
|
-
idOrNumber: z.string().min(1).openapi({ example: "ORD-001" }),
|
|
71
|
-
}),
|
|
72
|
-
},
|
|
73
|
-
responses: {
|
|
74
|
-
200: { content: { "application/json": { schema: GenericDataResponse } }, description: "Tracking info" },
|
|
75
|
-
...errorResponses,
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export const getOrderDownloadsRoute = createRoute({
|
|
80
|
-
method: "get",
|
|
81
|
-
path: "/orders/{orderId}/downloads",
|
|
82
|
-
tags: ["Customer Portal"],
|
|
83
|
-
summary: "Get digital downloads for an order",
|
|
84
|
-
request: {
|
|
85
|
-
params: z.object({
|
|
86
|
-
orderId: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
responses: {
|
|
90
|
-
200: { content: { "application/json": { schema: GenericDataResponse } }, description: "Downloads" },
|
|
91
|
-
...errorResponses,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
export const listCoursesRoute = createRoute({
|
|
96
|
-
method: "get",
|
|
97
|
-
path: "/courses",
|
|
98
|
-
tags: ["Customer Portal"],
|
|
99
|
-
summary: "List customer course access",
|
|
100
|
-
responses: {
|
|
101
|
-
200: { content: { "application/json": { schema: GenericDataResponse } }, description: "Courses" },
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// ─── DELETE Route Definitions ──────────────────────────────────────────────
|
|
106
|
-
|
|
107
|
-
export const deleteAddressRoute = createRoute({
|
|
108
|
-
method: "delete",
|
|
109
|
-
path: "/addresses/{id}",
|
|
110
|
-
tags: ["Customer Portal"],
|
|
111
|
-
summary: "Delete a customer address",
|
|
112
|
-
request: {
|
|
113
|
-
params: z.object({
|
|
114
|
-
id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
115
|
-
}),
|
|
116
|
-
},
|
|
117
|
-
responses: {
|
|
118
|
-
200: { content: { "application/json": { schema: z.object({ data: z.object({ deleted: z.literal(true) }) }) } }, description: "Deleted" },
|
|
119
|
-
...errorResponses,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// ─── POST Route Definitions (no body or special) ───────────────────────────
|
|
124
|
-
|
|
125
|
-
export const reorderRoute = createRoute({
|
|
126
|
-
method: "post",
|
|
127
|
-
path: "/orders/{orderId}/reorder",
|
|
128
|
-
tags: ["Customer Portal"],
|
|
129
|
-
summary: "Reorder items from a previous order",
|
|
130
|
-
request: {
|
|
131
|
-
params: z.object({
|
|
132
|
-
orderId: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
133
|
-
}),
|
|
134
|
-
},
|
|
135
|
-
responses: {
|
|
136
|
-
201: { content: { "application/json": { schema: CartResponse } }, description: "Reorder cart created" },
|
|
137
|
-
...errorResponses,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// ─── Mutation Route Definitions ─────────────────────────────────────────────
|
|
142
|
-
|
|
143
|
-
const UpdateProfileBodySchema = z.object({
|
|
144
|
-
firstName: z.string().optional(),
|
|
145
|
-
lastName: z.string().optional(),
|
|
146
|
-
phone: z.string().optional(),
|
|
147
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
148
|
-
}).openapi("UpdateProfileBody");
|
|
149
|
-
|
|
150
|
-
const CreateAddressBodySchema = z.object({
|
|
151
|
-
type: z.enum(["shipping", "billing"]).openapi({ example: "shipping" }),
|
|
152
|
-
firstName: z.string().openapi({ example: "John" }),
|
|
153
|
-
lastName: z.string().openapi({ example: "Doe" }),
|
|
154
|
-
line1: z.string().openapi({ example: "123 Main St" }),
|
|
155
|
-
line2: z.string().optional(),
|
|
156
|
-
city: z.string().openapi({ example: "New York" }),
|
|
157
|
-
state: z.string().optional(),
|
|
158
|
-
postalCode: z.string().optional(),
|
|
159
|
-
country: z.string().openapi({ example: "US" }),
|
|
160
|
-
phone: z.string().optional(),
|
|
161
|
-
}).openapi("CreateAddressBody");
|
|
162
|
-
|
|
163
|
-
export const updateProfileRoute = createRoute({
|
|
164
|
-
method: "patch",
|
|
165
|
-
path: "/profile",
|
|
166
|
-
tags: ["Customer Portal"],
|
|
167
|
-
summary: "Update customer profile",
|
|
168
|
-
request: {
|
|
169
|
-
body: {
|
|
170
|
-
content: { "application/json": { schema: UpdateProfileBodySchema } },
|
|
171
|
-
required: true,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
responses: {
|
|
175
|
-
200: { content: { "application/json": { schema: CustomerResponse } }, description: "Updated" },
|
|
176
|
-
...errorResponses,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
export const createAddressRoute = createRoute({
|
|
181
|
-
method: "post",
|
|
182
|
-
path: "/addresses",
|
|
183
|
-
tags: ["Customer Portal"],
|
|
184
|
-
summary: "Create a customer address",
|
|
185
|
-
request: {
|
|
186
|
-
body: {
|
|
187
|
-
content: { "application/json": { schema: CreateAddressBodySchema } },
|
|
188
|
-
required: true,
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
responses: {
|
|
192
|
-
201: { content: { "application/json": { schema: GenericDataResponse } }, description: "Created" },
|
|
193
|
-
...errorResponses,
|
|
194
|
-
},
|
|
195
|
-
});
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { ErrorSchema, errorResponses } from "./shared.js";
|
|
3
|
-
|
|
4
|
-
// ─── Request Schemas ─────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
import { InventoryAdjustBodySchema, InventoryReserveBodySchema, InventoryReleaseBodySchema } from "../../../modules/inventory/schemas.js";
|
|
7
|
-
export { InventoryAdjustBodySchema, InventoryReserveBodySchema, InventoryReleaseBodySchema };
|
|
8
|
-
|
|
9
|
-
export const CreateWarehouseBodySchema = z.object({
|
|
10
|
-
name: z.string().openapi({ example: "Main Warehouse" }),
|
|
11
|
-
code: z.string().optional().openapi({ example: "WH-MAIN" }),
|
|
12
|
-
address: z.record(z.string(), z.unknown()).optional(),
|
|
13
|
-
}).openapi("CreateWarehouseRequest");
|
|
14
|
-
|
|
15
|
-
// ─── Route Definitions ──────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export const inventoryCheckRoute = createRoute({
|
|
18
|
-
method: "get",
|
|
19
|
-
path: "/check",
|
|
20
|
-
tags: ["Inventory"],
|
|
21
|
-
summary: "Check inventory for entities",
|
|
22
|
-
request: {
|
|
23
|
-
query: z.object({
|
|
24
|
-
entityIds: z.string().optional().openapi({ example: "uuid1,uuid2" }),
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
responses: {
|
|
28
|
-
200: {
|
|
29
|
-
content: { "application/json": { schema: z.object({ data: z.record(z.string(), z.unknown()) }) } },
|
|
30
|
-
description: "Inventory levels",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const listWarehousesRoute = createRoute({
|
|
36
|
-
method: "get",
|
|
37
|
-
path: "/warehouses",
|
|
38
|
-
tags: ["Inventory"],
|
|
39
|
-
summary: "List all warehouses",
|
|
40
|
-
responses: {
|
|
41
|
-
200: {
|
|
42
|
-
content: { "application/json": { schema: z.object({ data: z.record(z.string(), z.unknown()) }) } },
|
|
43
|
-
description: "Warehouses",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const inventoryAdjustRoute = createRoute({
|
|
49
|
-
method: "post",
|
|
50
|
-
path: "/adjust",
|
|
51
|
-
tags: ["Inventory"],
|
|
52
|
-
summary: "Adjust inventory levels",
|
|
53
|
-
description: "Adjusts the on-hand quantity for a given entity/variant in a warehouse.",
|
|
54
|
-
request: {
|
|
55
|
-
body: {
|
|
56
|
-
content: {
|
|
57
|
-
"application/json": { schema: InventoryAdjustBodySchema },
|
|
58
|
-
},
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
responses: {
|
|
63
|
-
200: {
|
|
64
|
-
content: { "application/json": { schema: z.object({ data: z.record(z.string(), z.unknown()) }) } },
|
|
65
|
-
description: "Inventory adjusted.",
|
|
66
|
-
},
|
|
67
|
-
...errorResponses,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const inventoryReserveRoute = createRoute({
|
|
72
|
-
method: "post",
|
|
73
|
-
path: "/reserve",
|
|
74
|
-
tags: ["Inventory"],
|
|
75
|
-
summary: "Reserve inventory",
|
|
76
|
-
description: "Reserves inventory quantity for an order.",
|
|
77
|
-
request: {
|
|
78
|
-
body: {
|
|
79
|
-
content: {
|
|
80
|
-
"application/json": { schema: InventoryReserveBodySchema },
|
|
81
|
-
},
|
|
82
|
-
required: true,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
responses: {
|
|
86
|
-
200: {
|
|
87
|
-
content: { "application/json": { schema: z.object({ data: z.object({ reserved: z.literal(true) }) }) } },
|
|
88
|
-
description: "Inventory reserved.",
|
|
89
|
-
},
|
|
90
|
-
...errorResponses,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
export const inventoryReleaseRoute = createRoute({
|
|
95
|
-
method: "post",
|
|
96
|
-
path: "/release",
|
|
97
|
-
tags: ["Inventory"],
|
|
98
|
-
summary: "Release reserved inventory",
|
|
99
|
-
description: "Releases previously reserved inventory back to available stock.",
|
|
100
|
-
request: {
|
|
101
|
-
body: {
|
|
102
|
-
content: {
|
|
103
|
-
"application/json": { schema: InventoryReleaseBodySchema },
|
|
104
|
-
},
|
|
105
|
-
required: true,
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
responses: {
|
|
109
|
-
200: {
|
|
110
|
-
content: { "application/json": { schema: z.object({ data: z.object({ released: z.literal(true) }) }) } },
|
|
111
|
-
description: "Inventory released.",
|
|
112
|
-
},
|
|
113
|
-
...errorResponses,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
export const createWarehouseRoute = createRoute({
|
|
118
|
-
method: "post",
|
|
119
|
-
path: "/warehouses",
|
|
120
|
-
tags: ["Inventory"],
|
|
121
|
-
summary: "Create a warehouse",
|
|
122
|
-
description: "Creates a new warehouse for inventory management.",
|
|
123
|
-
request: {
|
|
124
|
-
body: {
|
|
125
|
-
content: {
|
|
126
|
-
"application/json": { schema: CreateWarehouseBodySchema },
|
|
127
|
-
},
|
|
128
|
-
required: true,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
responses: {
|
|
132
|
-
201: {
|
|
133
|
-
content: { "application/json": { schema: z.object({ data: z.record(z.string(), z.unknown()) }) } },
|
|
134
|
-
description: "Warehouse created.",
|
|
135
|
-
},
|
|
136
|
-
...errorResponses,
|
|
137
|
-
},
|
|
138
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { ErrorSchema, errorResponses } from "./shared.js";
|
|
3
|
-
|
|
4
|
-
// ─── Request Schema ──────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
export const AttachMediaBodySchema = z.object({
|
|
7
|
-
mediaAssetId: z.string().openapi({ example: "asset-uuid" }),
|
|
8
|
-
entityId: z.string().openapi({ example: "product-uuid" }),
|
|
9
|
-
role: z.enum(["primary", "gallery", "thumbnail", "video", "document"]).openapi({ example: "primary" }),
|
|
10
|
-
variantId: z.string().optional(),
|
|
11
|
-
sortOrder: z.number().optional().openapi({ example: 0 }),
|
|
12
|
-
}).openapi("AttachMediaRequest");
|
|
13
|
-
|
|
14
|
-
// ─── Route Definitions ──────────────────────────────────────────────────────
|
|
15
|
-
|
|
16
|
-
export const getMediaRoute = createRoute({
|
|
17
|
-
method: "get",
|
|
18
|
-
path: "/{id}",
|
|
19
|
-
tags: ["Media"],
|
|
20
|
-
summary: "Get a media asset (redirects to URL)",
|
|
21
|
-
request: {
|
|
22
|
-
params: z.object({
|
|
23
|
-
id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
24
|
-
}),
|
|
25
|
-
query: z.object({
|
|
26
|
-
signed: z.string().optional().openapi({ example: "true" }),
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
29
|
-
responses: {
|
|
30
|
-
302: { description: "Redirect to media URL" },
|
|
31
|
-
...errorResponses,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const deleteMediaRoute = createRoute({
|
|
36
|
-
method: "delete",
|
|
37
|
-
path: "/{id}",
|
|
38
|
-
tags: ["Media"],
|
|
39
|
-
summary: "Delete a media asset",
|
|
40
|
-
request: {
|
|
41
|
-
params: z.object({
|
|
42
|
-
id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
43
|
-
}),
|
|
44
|
-
},
|
|
45
|
-
responses: {
|
|
46
|
-
200: {
|
|
47
|
-
content: { "application/json": { schema: z.object({ data: z.object({ deleted: z.literal(true) }) }) } },
|
|
48
|
-
description: "Media deleted.",
|
|
49
|
-
},
|
|
50
|
-
...errorResponses,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const attachMediaRoute = createRoute({
|
|
55
|
-
method: "post",
|
|
56
|
-
path: "/attach",
|
|
57
|
-
tags: ["Media"],
|
|
58
|
-
summary: "Attach a media asset to an entity",
|
|
59
|
-
description: "Links an uploaded media asset to a catalog entity (product, variant, etc.).",
|
|
60
|
-
request: {
|
|
61
|
-
body: {
|
|
62
|
-
content: {
|
|
63
|
-
"application/json": { schema: AttachMediaBodySchema },
|
|
64
|
-
},
|
|
65
|
-
required: true,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
responses: {
|
|
69
|
-
201: {
|
|
70
|
-
content: { "application/json": { schema: z.object({ data: z.object({ attached: z.literal(true) }) }) } },
|
|
71
|
-
description: "Media attached to entity.",
|
|
72
|
-
},
|
|
73
|
-
...errorResponses,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { ErrorSchema, errorResponses } from "./shared.js";
|
|
3
|
-
import { OrderResponse, OrderListResponse } from "./responses.js";
|
|
4
|
-
|
|
5
|
-
// ─── Request Schemas ────────────────────────────────────────────────────────
|
|
6
|
-
|
|
7
|
-
export const ChangeOrderStatusBodySchema = z.object({
|
|
8
|
-
// Accept any string — custom state machines (e.g., BNPL) add states like
|
|
9
|
-
// "payment_initiated", "shipped", "delivered" etc. The order service's
|
|
10
|
-
// state machine validates valid transitions at runtime.
|
|
11
|
-
status: z.string().min(1).openapi({ example: "confirmed" }),
|
|
12
|
-
reason: z.string().optional().openapi({ example: "Payment verified" }),
|
|
13
|
-
}).openapi("ChangeOrderStatusRequest");
|
|
14
|
-
|
|
15
|
-
// ─── Response Schemas ───────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export const OrderDataResponseSchema = OrderResponse;
|
|
18
|
-
|
|
19
|
-
// ─── Path Params ────────────────────────────────────────────────────────────
|
|
20
|
-
|
|
21
|
-
const OrderIdParam = z.object({
|
|
22
|
-
id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// ─── Route Definitions ──────────────────────────────────────────────────────
|
|
26
|
-
|
|
27
|
-
export const listOrdersRoute = createRoute({
|
|
28
|
-
method: "get",
|
|
29
|
-
path: "/",
|
|
30
|
-
tags: ["Orders"],
|
|
31
|
-
summary: "List orders",
|
|
32
|
-
request: {
|
|
33
|
-
query: z.object({
|
|
34
|
-
status: z.string().optional(),
|
|
35
|
-
page: z.string().optional(),
|
|
36
|
-
limit: z.string().optional(),
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
responses: {
|
|
40
|
-
200: {
|
|
41
|
-
content: { "application/json": { schema: OrderListResponse } },
|
|
42
|
-
description: "Success",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const getOrderRoute = createRoute({
|
|
48
|
-
method: "get",
|
|
49
|
-
path: "/{idOrNumber}",
|
|
50
|
-
tags: ["Orders"],
|
|
51
|
-
summary: "Get an order by ID or order number",
|
|
52
|
-
request: {
|
|
53
|
-
params: z.object({
|
|
54
|
-
idOrNumber: z.string().min(1).openapi({ example: "ORD-001" }),
|
|
55
|
-
}),
|
|
56
|
-
},
|
|
57
|
-
responses: {
|
|
58
|
-
200: {
|
|
59
|
-
content: { "application/json": { schema: OrderDataResponseSchema } },
|
|
60
|
-
description: "Success",
|
|
61
|
-
},
|
|
62
|
-
...errorResponses,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const getOrderFulfillmentsRoute = createRoute({
|
|
67
|
-
method: "get",
|
|
68
|
-
path: "/{id}/fulfillments",
|
|
69
|
-
tags: ["Orders"],
|
|
70
|
-
summary: "Get fulfillments for an order",
|
|
71
|
-
request: {
|
|
72
|
-
params: OrderIdParam,
|
|
73
|
-
},
|
|
74
|
-
responses: {
|
|
75
|
-
200: {
|
|
76
|
-
content: { "application/json": { schema: OrderDataResponseSchema } },
|
|
77
|
-
description: "Success",
|
|
78
|
-
},
|
|
79
|
-
...errorResponses,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const changeOrderStatusRoute = createRoute({
|
|
84
|
-
method: "patch",
|
|
85
|
-
path: "/{id}/status",
|
|
86
|
-
tags: ["Orders"],
|
|
87
|
-
summary: "Change the status of an order",
|
|
88
|
-
request: {
|
|
89
|
-
params: OrderIdParam,
|
|
90
|
-
body: {
|
|
91
|
-
content: {
|
|
92
|
-
"application/json": { schema: ChangeOrderStatusBodySchema },
|
|
93
|
-
},
|
|
94
|
-
required: true,
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
responses: {
|
|
98
|
-
200: {
|
|
99
|
-
content: { "application/json": { schema: OrderDataResponseSchema } },
|
|
100
|
-
description: "Order status updated.",
|
|
101
|
-
},
|
|
102
|
-
...errorResponses,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { ErrorSchema, errorResponses } from "./shared.js";
|
|
3
|
-
|
|
4
|
-
// ─── Request Schemas ────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
import { SetBasePriceBodySchema, CreateModifierBodySchema } from "../../../modules/pricing/schemas.js";
|
|
7
|
-
export { SetBasePriceBodySchema, CreateModifierBodySchema };
|
|
8
|
-
|
|
9
|
-
// ─── Response Schemas ───────────────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
export const PricingResponseSchema = z.object({
|
|
12
|
-
data: z.record(z.string(), z.unknown()),
|
|
13
|
-
}).openapi("PricingResponse");
|
|
14
|
-
|
|
15
|
-
// ─── Route Definitions ──────────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export const listPricesRoute = createRoute({
|
|
18
|
-
method: "get",
|
|
19
|
-
path: "/prices",
|
|
20
|
-
tags: ["Pricing"],
|
|
21
|
-
summary: "List prices",
|
|
22
|
-
request: {
|
|
23
|
-
query: z.object({
|
|
24
|
-
entityId: z.string().optional(),
|
|
25
|
-
variantId: z.string().optional(),
|
|
26
|
-
currency: z.string().optional(),
|
|
27
|
-
customerGroupId: z.string().optional(),
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
responses: {
|
|
31
|
-
200: {
|
|
32
|
-
content: { "application/json": { schema: PricingResponseSchema } },
|
|
33
|
-
description: "Prices",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const setBasePriceRoute = createRoute({
|
|
39
|
-
method: "post",
|
|
40
|
-
path: "/prices",
|
|
41
|
-
tags: ["Pricing"],
|
|
42
|
-
summary: "Set a base price for a product or variant",
|
|
43
|
-
request: {
|
|
44
|
-
body: {
|
|
45
|
-
content: {
|
|
46
|
-
"application/json": { schema: SetBasePriceBodySchema },
|
|
47
|
-
},
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
responses: {
|
|
52
|
-
201: {
|
|
53
|
-
content: { "application/json": { schema: PricingResponseSchema } },
|
|
54
|
-
description: "Base price set successfully.",
|
|
55
|
-
},
|
|
56
|
-
...errorResponses,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export const createModifierRoute = createRoute({
|
|
61
|
-
method: "post",
|
|
62
|
-
path: "/modifiers",
|
|
63
|
-
tags: ["Pricing"],
|
|
64
|
-
summary: "Create a price modifier",
|
|
65
|
-
request: {
|
|
66
|
-
body: {
|
|
67
|
-
content: {
|
|
68
|
-
"application/json": { schema: CreateModifierBodySchema },
|
|
69
|
-
},
|
|
70
|
-
required: true,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
responses: {
|
|
74
|
-
201: {
|
|
75
|
-
content: { "application/json": { schema: PricingResponseSchema } },
|
|
76
|
-
description: "Price modifier created successfully.",
|
|
77
|
-
},
|
|
78
|
-
...errorResponses,
|
|
79
|
-
},
|
|
80
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { z, createRoute } from "@hono/zod-openapi";
|
|
2
|
-
import { ErrorSchema, errorResponses, UuidParamSchema } from "./shared.js";
|
|
3
|
-
|
|
4
|
-
// ─── Request Schemas ────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
import { CreatePromotionBodySchema } from "../../../modules/promotions/schemas.js";
|
|
7
|
-
export { CreatePromotionBodySchema };
|
|
8
|
-
|
|
9
|
-
export const ValidatePromotionBodySchema = z.object({
|
|
10
|
-
code: z.string().openapi({ example: "SUMMER10" }),
|
|
11
|
-
currency: z.string().length(3).openapi({ example: "USD" }),
|
|
12
|
-
subtotal: z.number().openapi({ example: 100 }),
|
|
13
|
-
lineItems: z.array(z.object({
|
|
14
|
-
entityId: z.string(),
|
|
15
|
-
entityType: z.string(),
|
|
16
|
-
quantity: z.number().int(),
|
|
17
|
-
unitPrice: z.number(),
|
|
18
|
-
totalPrice: z.number(),
|
|
19
|
-
})),
|
|
20
|
-
customerId: z.string().optional(),
|
|
21
|
-
customerGroupIds: z.array(z.string()).optional(),
|
|
22
|
-
}).openapi("ValidatePromotionRequest");
|
|
23
|
-
|
|
24
|
-
// ─── Response Schemas ───────────────────────────────────────────────────────
|
|
25
|
-
|
|
26
|
-
export const PromotionResponseSchema = z.object({
|
|
27
|
-
data: z.record(z.string(), z.unknown()),
|
|
28
|
-
}).openapi("PromotionResponse");
|
|
29
|
-
|
|
30
|
-
// ─── Path Params ────────────────────────────────────────────────────────────
|
|
31
|
-
|
|
32
|
-
const PromotionIdParam = z.object({
|
|
33
|
-
id: z.uuid().openapi({ example: "550e8400-e29b-41d4-a716-446655440000" }),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// ─── Route Definitions ──────────────────────────────────────────────────────
|
|
37
|
-
|
|
38
|
-
export const listActivePromotionsRoute = createRoute({
|
|
39
|
-
method: "get",
|
|
40
|
-
path: "/",
|
|
41
|
-
tags: ["Promotions"],
|
|
42
|
-
summary: "List active promotions",
|
|
43
|
-
responses: {
|
|
44
|
-
200: {
|
|
45
|
-
content: { "application/json": { schema: PromotionResponseSchema } },
|
|
46
|
-
description: "Active promotions",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const createPromotionRoute = createRoute({
|
|
52
|
-
method: "post",
|
|
53
|
-
path: "/",
|
|
54
|
-
tags: ["Promotions"],
|
|
55
|
-
summary: "Create a new promotion",
|
|
56
|
-
request: {
|
|
57
|
-
body: {
|
|
58
|
-
content: {
|
|
59
|
-
"application/json": { schema: CreatePromotionBodySchema },
|
|
60
|
-
},
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
responses: {
|
|
65
|
-
201: {
|
|
66
|
-
content: { "application/json": { schema: PromotionResponseSchema } },
|
|
67
|
-
description: "Promotion created successfully.",
|
|
68
|
-
},
|
|
69
|
-
...errorResponses,
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export const validatePromotionRoute = createRoute({
|
|
74
|
-
method: "post",
|
|
75
|
-
path: "/validate",
|
|
76
|
-
tags: ["Promotions"],
|
|
77
|
-
summary: "Validate a promotion code against a cart",
|
|
78
|
-
request: {
|
|
79
|
-
body: {
|
|
80
|
-
content: {
|
|
81
|
-
"application/json": { schema: ValidatePromotionBodySchema },
|
|
82
|
-
},
|
|
83
|
-
required: true,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
responses: {
|
|
87
|
-
200: {
|
|
88
|
-
content: { "application/json": { schema: PromotionResponseSchema } },
|
|
89
|
-
description: "Promotion validation result.",
|
|
90
|
-
},
|
|
91
|
-
...errorResponses,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
export const deactivatePromotionRoute = createRoute({
|
|
96
|
-
method: "post",
|
|
97
|
-
path: "/{id}/deactivate",
|
|
98
|
-
tags: ["Promotions"],
|
|
99
|
-
summary: "Deactivate a promotion",
|
|
100
|
-
request: {
|
|
101
|
-
params: PromotionIdParam,
|
|
102
|
-
},
|
|
103
|
-
responses: {
|
|
104
|
-
200: {
|
|
105
|
-
content: { "application/json": { schema: PromotionResponseSchema } },
|
|
106
|
-
description: "Promotion deactivated.",
|
|
107
|
-
},
|
|
108
|
-
...errorResponses,
|
|
109
|
-
},
|
|
110
|
-
});
|