@porulle/plugin-marketplace 0.64.0 → 0.65.1
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/README.md +11 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -11
- package/dist/routes/b2b.d.ts +1 -3
- package/dist/routes/b2b.d.ts.map +1 -1
- package/dist/routes/b2b.js +2 -70
- package/dist/routes/sub-orders.js +3 -3
- package/dist/routes/vendor-portal.js +6 -6
- package/dist/schema.d.ts +0 -194
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +0 -14
- package/dist/schemas/b2b.d.ts +0 -986
- package/dist/schemas/b2b.d.ts.map +1 -1
- package/dist/schemas/b2b.js +1 -184
- package/dist/schemas/commission.d.ts +0 -495
- package/dist/schemas/commission.d.ts.map +1 -1
- package/dist/schemas/commission.js +1 -78
- package/dist/schemas/disputes-returns-reviews.d.ts +0 -1354
- package/dist/schemas/disputes-returns-reviews.d.ts.map +1 -1
- package/dist/schemas/disputes-returns-reviews.js +1 -208
- package/dist/schemas/sub-orders.d.ts +0 -290
- package/dist/schemas/sub-orders.d.ts.map +1 -1
- package/dist/schemas/sub-orders.js +1 -59
- package/dist/schemas/vendor-portal.d.ts +0 -1755
- package/dist/schemas/vendor-portal.d.ts.map +1 -1
- package/dist/schemas/vendor-portal.js +1 -247
- package/dist/schemas/vendors.d.ts +0 -1321
- package/dist/schemas/vendors.d.ts.map +1 -1
- package/dist/schemas/vendors.js +1 -205
- package/dist/services/sub-order.d.ts +1 -31
- package/dist/services/sub-order.d.ts.map +1 -1
- package/dist/services/sub-order.js +14 -22
- package/dist/types.d.ts +0 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -4
- package/package.json +13 -11
- package/src/index.ts +3 -11
- package/src/routes/b2b.ts +1 -76
- package/src/routes/sub-orders.ts +3 -3
- package/src/routes/vendor-portal.ts +6 -6
- package/src/schema.ts +0 -16
- package/src/schemas/b2b.ts +1 -208
- package/src/schemas/commission.ts +1 -86
- package/src/schemas/disputes-returns-reviews.ts +1 -225
- package/src/schemas/sub-orders.ts +1 -65
- package/src/schemas/vendor-portal.ts +1 -269
- package/src/schemas/vendors.ts +1 -222
- package/src/services/sub-order.ts +16 -18
- package/src/types.ts +0 -28
- package/dist/schemas/payouts.d.ts +0 -375
- package/dist/schemas/payouts.d.ts.map +0 -1
- package/dist/schemas/payouts.js +0 -78
- package/dist/services/contract-price.d.ts +0 -64
- package/dist/services/contract-price.d.ts.map +0 -1
- package/dist/services/contract-price.js +0 -57
- package/src/schemas/payouts.ts +0 -90
- package/src/services/contract-price.ts +0 -80
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
|
|
3
|
-
const ErrorSchema = z.object({
|
|
4
|
-
error: z.object({
|
|
5
|
-
code: z.string(),
|
|
6
|
-
message: z.string(),
|
|
7
|
-
}),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const errorResponses = {
|
|
11
|
-
401: { content: { "application/json": { schema: ErrorSchema } }, description: "Authentication required." },
|
|
12
|
-
403: { content: { "application/json": { schema: ErrorSchema } }, description: "Insufficient permissions." },
|
|
13
|
-
404: { content: { "application/json": { schema: ErrorSchema } }, description: "Not found." },
|
|
14
|
-
422: { content: { "application/json": { schema: ErrorSchema } }, description: "Validation error." },
|
|
15
|
-
500: { content: { "application/json": { schema: ErrorSchema } }, description: "Server error." },
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
const DataResponseSchema = z.object({ data: z.any() });
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
19
2
|
|
|
20
3
|
// ─── Update Vendor Profile ──────────────────────────────────────────────────
|
|
21
4
|
|
|
@@ -26,20 +9,6 @@ export const UpdateVendorProfileBodySchema = z.object({
|
|
|
26
9
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
27
10
|
}).openapi("UpdateVendorProfileRequest");
|
|
28
11
|
|
|
29
|
-
export const updateVendorProfileRoute = createRoute({
|
|
30
|
-
method: "patch",
|
|
31
|
-
path: "/api/marketplace/vendor/me",
|
|
32
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
33
|
-
summary: "Update my vendor profile",
|
|
34
|
-
request: {
|
|
35
|
-
body: { content: { "application/json": { schema: UpdateVendorProfileBodySchema } }, required: true },
|
|
36
|
-
},
|
|
37
|
-
responses: {
|
|
38
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Profile updated." },
|
|
39
|
-
...errorResponses,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
12
|
// ─── Upload Document ────────────────────────────────────────────────────────
|
|
44
13
|
|
|
45
14
|
export const UploadVendorDocumentBodySchema = z.object({
|
|
@@ -47,39 +16,10 @@ export const UploadVendorDocumentBodySchema = z.object({
|
|
|
47
16
|
fileUrl: z.string().url().openapi({ example: "https://storage.example.com/doc.pdf" }),
|
|
48
17
|
}).openapi("UploadVendorPortalDocumentRequest");
|
|
49
18
|
|
|
50
|
-
export const uploadVendorDocumentRoute = createRoute({
|
|
51
|
-
method: "post",
|
|
52
|
-
path: "/api/marketplace/vendor/me/documents",
|
|
53
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
54
|
-
summary: "Upload a document for my vendor profile",
|
|
55
|
-
request: {
|
|
56
|
-
body: { content: { "application/json": { schema: UploadVendorDocumentBodySchema } }, required: true },
|
|
57
|
-
},
|
|
58
|
-
responses: {
|
|
59
|
-
201: { content: { "application/json": { schema: DataResponseSchema } }, description: "Document uploaded." },
|
|
60
|
-
...errorResponses,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
19
|
// ─── Confirm Sub-Order ──────────────────────────────────────────────────────
|
|
65
20
|
|
|
66
21
|
export const ConfirmSubOrderBodySchema = z.object({}).openapi("ConfirmSubOrderRequest");
|
|
67
22
|
|
|
68
|
-
export const confirmSubOrderRoute = createRoute({
|
|
69
|
-
method: "post",
|
|
70
|
-
path: "/api/marketplace/vendor/me/orders/{subOrderId}/confirm",
|
|
71
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
72
|
-
summary: "Confirm a sub-order",
|
|
73
|
-
request: {
|
|
74
|
-
params: z.object({ subOrderId: z.uuid() }),
|
|
75
|
-
body: { content: { "application/json": { schema: ConfirmSubOrderBodySchema } }, required: true },
|
|
76
|
-
},
|
|
77
|
-
responses: {
|
|
78
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Sub-order confirmed." },
|
|
79
|
-
...errorResponses,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
23
|
// ─── Ship Sub-Order ─────────────────────────────────────────────────────────
|
|
84
24
|
|
|
85
25
|
export const ShipSubOrderBodySchema = z.object({
|
|
@@ -87,258 +27,50 @@ export const ShipSubOrderBodySchema = z.object({
|
|
|
87
27
|
carrier: z.string().min(1).openapi({ example: "UPS" }),
|
|
88
28
|
}).openapi("ShipSubOrderRequest");
|
|
89
29
|
|
|
90
|
-
export const shipSubOrderRoute = createRoute({
|
|
91
|
-
method: "post",
|
|
92
|
-
path: "/api/marketplace/vendor/me/orders/{subOrderId}/ship",
|
|
93
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
94
|
-
summary: "Ship a sub-order",
|
|
95
|
-
request: {
|
|
96
|
-
params: z.object({ subOrderId: z.uuid() }),
|
|
97
|
-
body: { content: { "application/json": { schema: ShipSubOrderBodySchema } }, required: true },
|
|
98
|
-
},
|
|
99
|
-
responses: {
|
|
100
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Sub-order shipped." },
|
|
101
|
-
...errorResponses,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
30
|
// ─── Deliver Sub-Order ──────────────────────────────────────────────────────
|
|
106
31
|
|
|
107
32
|
export const DeliverSubOrderBodySchema = z.object({}).openapi("DeliverSubOrderRequest");
|
|
108
33
|
|
|
109
|
-
export const deliverSubOrderRoute = createRoute({
|
|
110
|
-
method: "post",
|
|
111
|
-
path: "/api/marketplace/vendor/me/orders/{subOrderId}/deliver",
|
|
112
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
113
|
-
summary: "Mark a sub-order as delivered",
|
|
114
|
-
request: {
|
|
115
|
-
params: z.object({ subOrderId: z.uuid() }),
|
|
116
|
-
body: { content: { "application/json": { schema: DeliverSubOrderBodySchema } }, required: true },
|
|
117
|
-
},
|
|
118
|
-
responses: {
|
|
119
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Sub-order delivered." },
|
|
120
|
-
...errorResponses,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
|
|
124
34
|
// ─── Cancel Sub-Order ───────────────────────────────────────────────────────
|
|
125
35
|
|
|
126
36
|
export const CancelSubOrderBodySchema = z.object({
|
|
127
37
|
reason: z.string().min(1).openapi({ example: "Out of stock" }),
|
|
128
38
|
}).openapi("CancelSubOrderRequest");
|
|
129
39
|
|
|
130
|
-
export const cancelSubOrderRoute = createRoute({
|
|
131
|
-
method: "post",
|
|
132
|
-
path: "/api/marketplace/vendor/me/orders/{subOrderId}/cancel",
|
|
133
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
134
|
-
summary: "Cancel a sub-order",
|
|
135
|
-
request: {
|
|
136
|
-
params: z.object({ subOrderId: z.uuid() }),
|
|
137
|
-
body: { content: { "application/json": { schema: CancelSubOrderBodySchema } }, required: true },
|
|
138
|
-
},
|
|
139
|
-
responses: {
|
|
140
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Sub-order cancelled." },
|
|
141
|
-
...errorResponses,
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
|
|
145
40
|
// ─── Respond to Review ──────────────────────────────────────────────────────
|
|
146
41
|
|
|
147
42
|
export const RespondToReviewBodySchema = z.object({
|
|
148
43
|
response: z.string().min(1).openapi({ example: "Thank you for your feedback!" }),
|
|
149
44
|
}).openapi("RespondToReviewRequest");
|
|
150
45
|
|
|
151
|
-
export const respondToReviewRoute = createRoute({
|
|
152
|
-
method: "post",
|
|
153
|
-
path: "/api/marketplace/vendor/me/reviews/{id}/respond",
|
|
154
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
155
|
-
summary: "Respond to a review",
|
|
156
|
-
request: {
|
|
157
|
-
params: z.object({ id: z.uuid() }),
|
|
158
|
-
body: { content: { "application/json": { schema: RespondToReviewBodySchema } }, required: true },
|
|
159
|
-
},
|
|
160
|
-
responses: {
|
|
161
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Response submitted." },
|
|
162
|
-
...errorResponses,
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
|
|
166
46
|
// ─── Approve Return ─────────────────────────────────────────────────────────
|
|
167
47
|
|
|
168
48
|
export const ApproveReturnBodySchema = z.object({
|
|
169
49
|
refundAmountCents: z.number().int().min(0).optional(),
|
|
170
50
|
}).openapi("ApproveReturnRequest");
|
|
171
51
|
|
|
172
|
-
export const approveReturnRoute = createRoute({
|
|
173
|
-
method: "post",
|
|
174
|
-
path: "/api/marketplace/vendor/me/returns/{id}/approve",
|
|
175
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
176
|
-
summary: "Approve a return request",
|
|
177
|
-
request: {
|
|
178
|
-
params: z.object({ id: z.uuid() }),
|
|
179
|
-
body: { content: { "application/json": { schema: ApproveReturnBodySchema } }, required: true },
|
|
180
|
-
},
|
|
181
|
-
responses: {
|
|
182
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Return approved." },
|
|
183
|
-
...errorResponses,
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
|
|
187
52
|
// ─── Reject Return ──────────────────────────────────────────────────────────
|
|
188
53
|
|
|
189
54
|
export const RejectReturnBodySchema = z.object({
|
|
190
55
|
notes: z.string().optional(),
|
|
191
56
|
}).openapi("RejectReturnRequest");
|
|
192
57
|
|
|
193
|
-
export const rejectReturnRoute = createRoute({
|
|
194
|
-
method: "post",
|
|
195
|
-
path: "/api/marketplace/vendor/me/returns/{id}/reject",
|
|
196
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
197
|
-
summary: "Reject a return request",
|
|
198
|
-
request: {
|
|
199
|
-
params: z.object({ id: z.uuid() }),
|
|
200
|
-
body: { content: { "application/json": { schema: RejectReturnBodySchema } }, required: true },
|
|
201
|
-
},
|
|
202
|
-
responses: {
|
|
203
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Return rejected." },
|
|
204
|
-
...errorResponses,
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
|
|
208
58
|
// ─── Get My Vendor Profile ──────────────────────────────────────────────────
|
|
209
59
|
|
|
210
|
-
export const getMyVendorProfileRoute = createRoute({
|
|
211
|
-
method: "get",
|
|
212
|
-
path: "/api/marketplace/vendor/me",
|
|
213
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
214
|
-
summary: "Get my vendor profile",
|
|
215
|
-
responses: {
|
|
216
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
217
|
-
...errorResponses,
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
|
|
221
60
|
// ─── List My Documents ──────────────────────────────────────────────────────
|
|
222
61
|
|
|
223
|
-
export const listMyDocumentsRoute = createRoute({
|
|
224
|
-
method: "get",
|
|
225
|
-
path: "/api/marketplace/vendor/me/documents",
|
|
226
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
227
|
-
summary: "List my vendor documents",
|
|
228
|
-
responses: {
|
|
229
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
230
|
-
...errorResponses,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
|
|
234
62
|
// ─── List My Products ───────────────────────────────────────────────────────
|
|
235
63
|
|
|
236
|
-
export const listMyProductsRoute = createRoute({
|
|
237
|
-
method: "get",
|
|
238
|
-
path: "/api/marketplace/vendor/me/products",
|
|
239
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
240
|
-
summary: "List my products",
|
|
241
|
-
responses: {
|
|
242
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
243
|
-
...errorResponses,
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
|
|
247
64
|
// ─── List My Sub-Orders ─────────────────────────────────────────────────────
|
|
248
65
|
|
|
249
|
-
export const listMyOrdersRoute = createRoute({
|
|
250
|
-
method: "get",
|
|
251
|
-
path: "/api/marketplace/vendor/me/orders",
|
|
252
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
253
|
-
summary: "List my sub-orders",
|
|
254
|
-
request: {
|
|
255
|
-
query: z.object({
|
|
256
|
-
status: z.string().optional(),
|
|
257
|
-
}),
|
|
258
|
-
},
|
|
259
|
-
responses: {
|
|
260
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
261
|
-
...errorResponses,
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
|
|
265
66
|
// ─── Get Single Sub-Order ───────────────────────────────────────────────────
|
|
266
67
|
|
|
267
|
-
export const getMyOrderRoute = createRoute({
|
|
268
|
-
method: "get",
|
|
269
|
-
path: "/api/marketplace/vendor/me/orders/{subOrderId}",
|
|
270
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
271
|
-
summary: "Get a single sub-order",
|
|
272
|
-
request: {
|
|
273
|
-
params: z.object({ subOrderId: z.uuid() }),
|
|
274
|
-
},
|
|
275
|
-
responses: {
|
|
276
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
277
|
-
...errorResponses,
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
|
|
281
68
|
// ─── List My Payouts ────────────────────────────────────────────────────────
|
|
282
69
|
|
|
283
|
-
export const listMyPayoutsRoute = createRoute({
|
|
284
|
-
method: "get",
|
|
285
|
-
path: "/api/marketplace/vendor/me/payouts",
|
|
286
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
287
|
-
summary: "List my payouts",
|
|
288
|
-
responses: {
|
|
289
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
290
|
-
...errorResponses,
|
|
291
|
-
},
|
|
292
|
-
});
|
|
293
|
-
|
|
294
70
|
// ─── My Balance ─────────────────────────────────────────────────────────────
|
|
295
71
|
|
|
296
|
-
export const myBalanceRoute = createRoute({
|
|
297
|
-
method: "get",
|
|
298
|
-
path: "/api/marketplace/vendor/me/balance",
|
|
299
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
300
|
-
summary: "Get my balance",
|
|
301
|
-
responses: {
|
|
302
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
303
|
-
...errorResponses,
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
|
|
307
72
|
// ─── My Analytics ───────────────────────────────────────────────────────────
|
|
308
73
|
|
|
309
|
-
export const myAnalyticsRoute = createRoute({
|
|
310
|
-
method: "get",
|
|
311
|
-
path: "/api/marketplace/vendor/me/analytics",
|
|
312
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
313
|
-
summary: "Get my analytics",
|
|
314
|
-
responses: {
|
|
315
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
316
|
-
...errorResponses,
|
|
317
|
-
},
|
|
318
|
-
});
|
|
319
|
-
|
|
320
74
|
// ─── My Reviews ─────────────────────────────────────────────────────────────
|
|
321
75
|
|
|
322
|
-
export const myReviewsRoute = createRoute({
|
|
323
|
-
method: "get",
|
|
324
|
-
path: "/api/marketplace/vendor/me/reviews",
|
|
325
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
326
|
-
summary: "List my reviews",
|
|
327
|
-
responses: {
|
|
328
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
329
|
-
...errorResponses,
|
|
330
|
-
},
|
|
331
|
-
});
|
|
332
|
-
|
|
333
76
|
// ─── My Returns ─────────────────────────────────────────────────────────────
|
|
334
|
-
|
|
335
|
-
export const myReturnsRoute = createRoute({
|
|
336
|
-
method: "get",
|
|
337
|
-
path: "/api/marketplace/vendor/me/returns",
|
|
338
|
-
tags: ["Marketplace - Vendor Portal"],
|
|
339
|
-
summary: "List my returns",
|
|
340
|
-
responses: {
|
|
341
|
-
200: { content: { "application/json": { schema: DataResponseSchema } }, description: "Success" },
|
|
342
|
-
...errorResponses,
|
|
343
|
-
},
|
|
344
|
-
});
|
package/src/schemas/vendors.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
|
|
3
|
-
const ErrorSchema = z.object({
|
|
4
|
-
error: z.object({
|
|
5
|
-
code: z.string(),
|
|
6
|
-
message: z.string(),
|
|
7
|
-
}),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const errorResponses = {
|
|
11
|
-
401: { content: { "application/json": { schema: ErrorSchema } }, description: "Authentication required." },
|
|
12
|
-
403: { content: { "application/json": { schema: ErrorSchema } }, description: "Insufficient permissions." },
|
|
13
|
-
404: { content: { "application/json": { schema: ErrorSchema } }, description: "Not found." },
|
|
14
|
-
422: { content: { "application/json": { schema: ErrorSchema } }, description: "Validation error." },
|
|
15
|
-
500: { content: { "application/json": { schema: ErrorSchema } }, description: "Server error." },
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
const VendorResponseSchema = z.object({ data: z.any() });
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
19
2
|
|
|
20
3
|
// ─── Create Vendor ───────────────────────────────────────────────────────────
|
|
21
4
|
|
|
@@ -28,20 +11,6 @@ export const CreateVendorBodySchema = z.object({
|
|
|
28
11
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
29
12
|
}).openapi("CreateVendorRequest");
|
|
30
13
|
|
|
31
|
-
export const createVendorRoute = createRoute({
|
|
32
|
-
method: "post",
|
|
33
|
-
path: "/api/marketplace/vendors",
|
|
34
|
-
tags: ["Marketplace - Vendors"],
|
|
35
|
-
summary: "Create a vendor",
|
|
36
|
-
request: {
|
|
37
|
-
body: { content: { "application/json": { schema: CreateVendorBodySchema } }, required: true },
|
|
38
|
-
},
|
|
39
|
-
responses: {
|
|
40
|
-
201: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor created." },
|
|
41
|
-
...errorResponses,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
14
|
// ─── Update Vendor ───────────────────────────────────────────────────────────
|
|
46
15
|
|
|
47
16
|
export const UpdateVendorBodySchema = z.object({
|
|
@@ -53,63 +22,18 @@ export const UpdateVendorBodySchema = z.object({
|
|
|
53
22
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
54
23
|
}).openapi("UpdateVendorRequest");
|
|
55
24
|
|
|
56
|
-
export const updateVendorRoute = createRoute({
|
|
57
|
-
method: "patch",
|
|
58
|
-
path: "/api/marketplace/vendors/{id}",
|
|
59
|
-
tags: ["Marketplace - Vendors"],
|
|
60
|
-
summary: "Update a vendor",
|
|
61
|
-
request: {
|
|
62
|
-
params: z.object({ id: z.uuid() }),
|
|
63
|
-
body: { content: { "application/json": { schema: UpdateVendorBodySchema } }, required: true },
|
|
64
|
-
},
|
|
65
|
-
responses: {
|
|
66
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor updated." },
|
|
67
|
-
...errorResponses,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
25
|
// ─── Reject Vendor ───────────────────────────────────────────────────────────
|
|
72
26
|
|
|
73
27
|
export const RejectVendorBodySchema = z.object({
|
|
74
28
|
reason: z.string().min(1).openapi({ example: "Incomplete documentation" }),
|
|
75
29
|
}).openapi("RejectVendorRequest");
|
|
76
30
|
|
|
77
|
-
export const rejectVendorRoute = createRoute({
|
|
78
|
-
method: "post",
|
|
79
|
-
path: "/api/marketplace/vendors/{id}/reject",
|
|
80
|
-
tags: ["Marketplace - Vendors"],
|
|
81
|
-
summary: "Reject a vendor application",
|
|
82
|
-
request: {
|
|
83
|
-
params: z.object({ id: z.uuid() }),
|
|
84
|
-
body: { content: { "application/json": { schema: RejectVendorBodySchema } }, required: true },
|
|
85
|
-
},
|
|
86
|
-
responses: {
|
|
87
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor rejected." },
|
|
88
|
-
...errorResponses,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
31
|
// ─── Suspend Vendor ──────────────────────────────────────────────────────────
|
|
93
32
|
|
|
94
33
|
export const SuspendVendorBodySchema = z.object({
|
|
95
34
|
reason: z.string().min(1).openapi({ example: "Policy violation" }),
|
|
96
35
|
}).openapi("SuspendVendorRequest");
|
|
97
36
|
|
|
98
|
-
export const suspendVendorRoute = createRoute({
|
|
99
|
-
method: "post",
|
|
100
|
-
path: "/api/marketplace/vendors/{id}/suspend",
|
|
101
|
-
tags: ["Marketplace - Vendors"],
|
|
102
|
-
summary: "Suspend a vendor",
|
|
103
|
-
request: {
|
|
104
|
-
params: z.object({ id: z.uuid() }),
|
|
105
|
-
body: { content: { "application/json": { schema: SuspendVendorBodySchema } }, required: true },
|
|
106
|
-
},
|
|
107
|
-
responses: {
|
|
108
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor suspended." },
|
|
109
|
-
...errorResponses,
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
37
|
// ─── Upload Document ─────────────────────────────────────────────────────────
|
|
114
38
|
|
|
115
39
|
export const UploadDocumentBodySchema = z.object({
|
|
@@ -117,165 +41,20 @@ export const UploadDocumentBodySchema = z.object({
|
|
|
117
41
|
fileUrl: z.string().url().openapi({ example: "https://storage.example.com/doc.pdf" }),
|
|
118
42
|
}).openapi("UploadVendorDocumentRequest");
|
|
119
43
|
|
|
120
|
-
export const uploadDocumentRoute = createRoute({
|
|
121
|
-
method: "post",
|
|
122
|
-
path: "/api/marketplace/vendors/{id}/documents",
|
|
123
|
-
tags: ["Marketplace - Vendors"],
|
|
124
|
-
summary: "Upload a vendor document",
|
|
125
|
-
request: {
|
|
126
|
-
params: z.object({ id: z.uuid() }),
|
|
127
|
-
body: { content: { "application/json": { schema: UploadDocumentBodySchema } }, required: true },
|
|
128
|
-
},
|
|
129
|
-
responses: {
|
|
130
|
-
201: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Document uploaded." },
|
|
131
|
-
...errorResponses,
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
|
|
135
44
|
// ─── List Vendors ───────────────────────────────────────────────────────────
|
|
136
45
|
|
|
137
|
-
export const listVendorsRoute = createRoute({
|
|
138
|
-
method: "get",
|
|
139
|
-
path: "/api/marketplace/vendors",
|
|
140
|
-
tags: ["Marketplace - Vendors"],
|
|
141
|
-
summary: "List all vendors",
|
|
142
|
-
request: {
|
|
143
|
-
query: z.object({
|
|
144
|
-
status: z.string().optional(),
|
|
145
|
-
tier: z.string().optional(),
|
|
146
|
-
search: z.string().optional(),
|
|
147
|
-
}),
|
|
148
|
-
},
|
|
149
|
-
responses: {
|
|
150
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Success" },
|
|
151
|
-
...errorResponses,
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
|
|
155
46
|
// ─── Get Vendor ─────────────────────────────────────────────────────────────
|
|
156
47
|
|
|
157
|
-
export const getVendorRoute = createRoute({
|
|
158
|
-
method: "get",
|
|
159
|
-
path: "/api/marketplace/vendors/{id}",
|
|
160
|
-
tags: ["Marketplace - Vendors"],
|
|
161
|
-
summary: "Get vendor detail",
|
|
162
|
-
request: {
|
|
163
|
-
params: z.object({ id: z.uuid() }),
|
|
164
|
-
},
|
|
165
|
-
responses: {
|
|
166
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Success" },
|
|
167
|
-
...errorResponses,
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
|
|
171
48
|
// ─── Approve Vendor ─────────────────────────────────────────────────────────
|
|
172
49
|
|
|
173
|
-
export const approveVendorRoute = createRoute({
|
|
174
|
-
method: "post",
|
|
175
|
-
path: "/api/marketplace/vendors/{id}/approve",
|
|
176
|
-
tags: ["Marketplace - Vendors"],
|
|
177
|
-
summary: "Approve a vendor application",
|
|
178
|
-
request: {
|
|
179
|
-
params: z.object({ id: z.uuid() }),
|
|
180
|
-
},
|
|
181
|
-
responses: {
|
|
182
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor approved." },
|
|
183
|
-
...errorResponses,
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
|
|
187
50
|
// ─── Reinstate Vendor ───────────────────────────────────────────────────────
|
|
188
51
|
|
|
189
|
-
export const reinstateVendorRoute = createRoute({
|
|
190
|
-
method: "post",
|
|
191
|
-
path: "/api/marketplace/vendors/{id}/reinstate",
|
|
192
|
-
tags: ["Marketplace - Vendors"],
|
|
193
|
-
summary: "Reinstate a suspended vendor",
|
|
194
|
-
request: {
|
|
195
|
-
params: z.object({ id: z.uuid() }),
|
|
196
|
-
},
|
|
197
|
-
responses: {
|
|
198
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Vendor reinstated." },
|
|
199
|
-
...errorResponses,
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
|
|
203
52
|
// ─── List Vendor Documents ──────────────────────────────────────────────────
|
|
204
53
|
|
|
205
|
-
export const listVendorDocumentsRoute = createRoute({
|
|
206
|
-
method: "get",
|
|
207
|
-
path: "/api/marketplace/vendors/{id}/documents",
|
|
208
|
-
tags: ["Marketplace - Vendors"],
|
|
209
|
-
summary: "List vendor documents",
|
|
210
|
-
request: {
|
|
211
|
-
params: z.object({ id: z.uuid() }),
|
|
212
|
-
},
|
|
213
|
-
responses: {
|
|
214
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Success" },
|
|
215
|
-
...errorResponses,
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
|
-
|
|
219
54
|
// ─── Approve Document ───────────────────────────────────────────────────────
|
|
220
55
|
|
|
221
|
-
export const approveDocumentRoute = createRoute({
|
|
222
|
-
method: "post",
|
|
223
|
-
path: "/api/marketplace/vendors/{id}/documents/{docId}/approve",
|
|
224
|
-
tags: ["Marketplace - Vendors"],
|
|
225
|
-
summary: "Approve a vendor document",
|
|
226
|
-
request: {
|
|
227
|
-
params: z.object({ id: z.uuid(), docId: z.uuid() }),
|
|
228
|
-
},
|
|
229
|
-
responses: {
|
|
230
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Document approved." },
|
|
231
|
-
...errorResponses,
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
|
|
235
56
|
// ─── Reject Document ────────────────────────────────────────────────────────
|
|
236
57
|
|
|
237
|
-
export const rejectDocumentRoute = createRoute({
|
|
238
|
-
method: "post",
|
|
239
|
-
path: "/api/marketplace/vendors/{id}/documents/{docId}/reject",
|
|
240
|
-
tags: ["Marketplace - Vendors"],
|
|
241
|
-
summary: "Reject a vendor document",
|
|
242
|
-
request: {
|
|
243
|
-
params: z.object({ id: z.uuid(), docId: z.uuid() }),
|
|
244
|
-
},
|
|
245
|
-
responses: {
|
|
246
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Document rejected." },
|
|
247
|
-
...errorResponses,
|
|
248
|
-
},
|
|
249
|
-
});
|
|
250
|
-
|
|
251
58
|
// ─── Vendor Balance ─────────────────────────────────────────────────────────
|
|
252
59
|
|
|
253
|
-
export const vendorBalanceRoute = createRoute({
|
|
254
|
-
method: "get",
|
|
255
|
-
path: "/api/marketplace/vendors/{id}/balance",
|
|
256
|
-
tags: ["Marketplace - Vendors"],
|
|
257
|
-
summary: "Get vendor balance",
|
|
258
|
-
request: {
|
|
259
|
-
params: z.object({ id: z.uuid() }),
|
|
260
|
-
},
|
|
261
|
-
responses: {
|
|
262
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Success" },
|
|
263
|
-
...errorResponses,
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
|
|
267
60
|
// ─── Vendor Performance ─────────────────────────────────────────────────────
|
|
268
|
-
|
|
269
|
-
export const vendorPerformanceRoute = createRoute({
|
|
270
|
-
method: "get",
|
|
271
|
-
path: "/api/marketplace/vendors/{id}/performance",
|
|
272
|
-
tags: ["Marketplace - Vendors"],
|
|
273
|
-
summary: "Get vendor performance metrics",
|
|
274
|
-
request: {
|
|
275
|
-
params: z.object({ id: z.uuid() }),
|
|
276
|
-
},
|
|
277
|
-
responses: {
|
|
278
|
-
200: { content: { "application/json": { schema: VendorResponseSchema } }, description: "Success" },
|
|
279
|
-
...errorResponses,
|
|
280
|
-
},
|
|
281
|
-
});
|