@ai-grator/api 0.0.13 → 0.1.14
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/billing/enums/model-type.enum.ts +1 -0
- package/build/billing/enums/model-type.enum.d.ts +2 -1
- package/build/billing/enums/model-type.enum.d.ts.map +1 -1
- package/build/billing/enums/model-type.enum.js +1 -0
- package/build/errors/errors.d.ts +42 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +42 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/marketplace-card/endpoints/commands/create-marketplace-card.command.d.ts +81 -0
- package/build/marketplace-card/endpoints/commands/create-marketplace-card.command.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/commands/create-marketplace-card.command.js +72 -0
- package/build/marketplace-card/endpoints/commands/delete-marketplace-card.command.d.ts +23 -0
- package/build/marketplace-card/endpoints/commands/delete-marketplace-card.command.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/commands/delete-marketplace-card.command.js +24 -0
- package/build/marketplace-card/endpoints/commands/index.d.ts +4 -0
- package/build/marketplace-card/endpoints/commands/index.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/commands/index.js +19 -0
- package/build/marketplace-card/endpoints/commands/update-marketplace-card.command.d.ts +73 -0
- package/build/marketplace-card/endpoints/commands/update-marketplace-card.command.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/commands/update-marketplace-card.command.js +31 -0
- package/build/marketplace-card/endpoints/index.d.ts +4 -0
- package/build/marketplace-card/endpoints/index.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/index.js +19 -0
- package/build/marketplace-card/endpoints/marketplace-card.d.ts +10 -0
- package/build/marketplace-card/endpoints/marketplace-card.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/marketplace-card.js +12 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-history.query.d.ts +79 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-history.query.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-history.query.js +31 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card.query.d.ts +65 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card.query.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card.query.js +25 -0
- package/build/marketplace-card/endpoints/queries/index.d.ts +3 -0
- package/build/marketplace-card/endpoints/queries/index.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/queries/index.js +18 -0
- package/build/marketplace-card/enums/index.d.ts +3 -0
- package/build/marketplace-card/enums/index.d.ts.map +1 -0
- package/build/marketplace-card/enums/index.js +18 -0
- package/build/marketplace-card/enums/marketplace-card-style-mode.enum.d.ts +6 -0
- package/build/marketplace-card/enums/marketplace-card-style-mode.enum.d.ts.map +1 -0
- package/build/marketplace-card/enums/marketplace-card-style-mode.enum.js +9 -0
- package/build/marketplace-card/enums/marketplace-card-type.enum.d.ts +5 -0
- package/build/marketplace-card/enums/marketplace-card-type.enum.d.ts.map +1 -0
- package/build/marketplace-card/enums/marketplace-card-type.enum.js +8 -0
- package/build/marketplace-card/index.d.ts +4 -0
- package/build/marketplace-card/index.d.ts.map +1 -0
- package/build/marketplace-card/index.js +19 -0
- package/build/marketplace-card/models/index.d.ts +3 -0
- package/build/marketplace-card/models/index.d.ts.map +1 -0
- package/build/marketplace-card/models/index.js +18 -0
- package/build/marketplace-card/models/marketplace-card-job-response.schema.d.ts +29 -0
- package/build/marketplace-card/models/marketplace-card-job-response.schema.d.ts.map +1 -0
- package/build/marketplace-card/models/marketplace-card-job-response.schema.js +28 -0
- package/build/marketplace-card/models/marketplace-card-output.schema.d.ts +7 -0
- package/build/marketplace-card/models/marketplace-card-output.schema.d.ts.map +1 -0
- package/build/marketplace-card/models/marketplace-card-output.schema.js +8 -0
- package/build/scripts/generate-openapi.js +53 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +42 -0
- package/index.ts +1 -0
- package/marketplace-card/endpoints/commands/create-marketplace-card.command.ts +76 -0
- package/marketplace-card/endpoints/commands/delete-marketplace-card.command.ts +24 -0
- package/marketplace-card/endpoints/commands/index.ts +3 -0
- package/marketplace-card/endpoints/commands/update-marketplace-card.command.ts +32 -0
- package/marketplace-card/endpoints/index.ts +3 -0
- package/marketplace-card/endpoints/marketplace-card.ts +10 -0
- package/marketplace-card/endpoints/queries/get-marketplace-card-history.query.ts +31 -0
- package/marketplace-card/endpoints/queries/get-marketplace-card.query.ts +25 -0
- package/marketplace-card/endpoints/queries/index.ts +2 -0
- package/marketplace-card/enums/index.ts +2 -0
- package/marketplace-card/enums/marketplace-card-style-mode.enum.ts +5 -0
- package/marketplace-card/enums/marketplace-card-type.enum.ts +4 -0
- package/marketplace-card/index.ts +3 -0
- package/marketplace-card/models/index.ts +2 -0
- package/marketplace-card/models/marketplace-card-job-response.schema.ts +29 -0
- package/marketplace-card/models/marketplace-card-output.schema.ts +8 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +76 -0
package/errors/errors.ts
CHANGED
|
@@ -322,6 +322,48 @@ export const ERRORS = {
|
|
|
322
322
|
message: 'Задача генерации уже завершена и не может быть отменена',
|
|
323
323
|
},
|
|
324
324
|
},
|
|
325
|
+
MARKETPLACE_CARD: {
|
|
326
|
+
NOT_FOUND: {
|
|
327
|
+
httpCode: 404,
|
|
328
|
+
code: 'MARKETPLACE_CARD.NOT_FOUND',
|
|
329
|
+
message: 'Задача генерации карточки не найдена',
|
|
330
|
+
},
|
|
331
|
+
CREATE_ERROR: {
|
|
332
|
+
httpCode: 500,
|
|
333
|
+
code: 'MARKETPLACE_CARD.CREATE_ERROR',
|
|
334
|
+
message: 'Не удалось создать задачу генерации карточки',
|
|
335
|
+
},
|
|
336
|
+
UPDATE_ERROR: {
|
|
337
|
+
httpCode: 500,
|
|
338
|
+
code: 'MARKETPLACE_CARD.UPDATE_ERROR',
|
|
339
|
+
message: 'Не удалось обновить задачу генерации карточки',
|
|
340
|
+
},
|
|
341
|
+
DELETE_ERROR: {
|
|
342
|
+
httpCode: 500,
|
|
343
|
+
code: 'MARKETPLACE_CARD.DELETE_ERROR',
|
|
344
|
+
message: 'Не удалось удалить задачу генерации карточки',
|
|
345
|
+
},
|
|
346
|
+
FIND_ERROR: {
|
|
347
|
+
httpCode: 500,
|
|
348
|
+
code: 'MARKETPLACE_CARD.FIND_ERROR',
|
|
349
|
+
message: 'Не удалось найти задачу генерации карточки',
|
|
350
|
+
},
|
|
351
|
+
NOT_CANCELABLE: {
|
|
352
|
+
httpCode: 400,
|
|
353
|
+
code: 'MARKETPLACE_CARD.NOT_CANCELABLE',
|
|
354
|
+
message: 'Задача генерации карточки уже завершена и не может быть отменена',
|
|
355
|
+
},
|
|
356
|
+
ALREADY_STARTED: {
|
|
357
|
+
httpCode: 400,
|
|
358
|
+
code: 'MARKETPLACE_CARD.ALREADY_STARTED',
|
|
359
|
+
message: 'Задача генерации карточки уже запущена',
|
|
360
|
+
},
|
|
361
|
+
NO_FILES: {
|
|
362
|
+
httpCode: 400,
|
|
363
|
+
code: 'MARKETPLACE_CARD.NO_FILES',
|
|
364
|
+
message: 'К задаче не прикреплены файлы',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
325
367
|
BILLING: {
|
|
326
368
|
QUOTE_ERROR: {
|
|
327
369
|
httpCode: 500,
|
package/index.ts
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { MarketplaceCardStyleModeSchema, MarketplaceCardTypeSchema } from '../../models';
|
|
4
|
+
import { MarketplaceCardJobResponseSchema } from '../../models/marketplace-card-job-response.schema';
|
|
5
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
6
|
+
|
|
7
|
+
export const CreateMarketplaceCardCommandBody = z
|
|
8
|
+
.object({
|
|
9
|
+
type: MarketplaceCardTypeSchema,
|
|
10
|
+
description: z.string().min(1),
|
|
11
|
+
advantages: z.string().optional(),
|
|
12
|
+
styleMode: MarketplaceCardStyleModeSchema,
|
|
13
|
+
styleText: z.string().optional(),
|
|
14
|
+
stylePresetKey: z.string().optional(),
|
|
15
|
+
styleReferenceFileId: z.uuid().optional(),
|
|
16
|
+
variantCount: z.number().int().min(1),
|
|
17
|
+
fileIds: z.array(z.uuid()).min(1).max(20),
|
|
18
|
+
})
|
|
19
|
+
.superRefine((data, ctx) => {
|
|
20
|
+
if (data.styleMode === 'TEXT' && !data.styleText) {
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: 'custom',
|
|
23
|
+
path: ['styleText'],
|
|
24
|
+
message: 'Style text is required when style mode is TEXT',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (data.styleMode === 'PRESET' && !data.stylePresetKey) {
|
|
29
|
+
ctx.addIssue({
|
|
30
|
+
code: 'custom',
|
|
31
|
+
path: ['stylePresetKey'],
|
|
32
|
+
message: 'Style preset key is required when style mode is PRESET',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (data.styleMode === 'REFERENCE' && !data.styleReferenceFileId) {
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: 'custom',
|
|
39
|
+
path: ['styleReferenceFileId'],
|
|
40
|
+
message: 'Reference file is required when style mode is REFERENCE',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (data.type === 'MAIN_CARD' && data.variantCount > 3) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: 'custom',
|
|
47
|
+
path: ['variantCount'],
|
|
48
|
+
message: 'Variant count must be 1-3 for main card',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (data.type === 'ADDITIONAL_IMAGES' && data.variantCount > 10) {
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: 'custom',
|
|
55
|
+
path: ['variantCount'],
|
|
56
|
+
message: 'Variant count must be 1-10 for additional images',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const CreateMarketplaceCardCommandResponse = MarketplaceCardJobResponseSchema;
|
|
62
|
+
|
|
63
|
+
export const CreateMarketplaceCardCommand = defineContract({
|
|
64
|
+
method: HTTP_METHODS.POST,
|
|
65
|
+
path: MARKETPLACE_CARD_ROUTES.CREATE,
|
|
66
|
+
summary: 'Create marketplace card generation job',
|
|
67
|
+
request: {
|
|
68
|
+
body: CreateMarketplaceCardCommandBody,
|
|
69
|
+
},
|
|
70
|
+
responses: {
|
|
71
|
+
201: CreateMarketplaceCardCommandResponse,
|
|
72
|
+
400: HttpErrorResponseSchema,
|
|
73
|
+
401: HttpErrorResponseSchema,
|
|
74
|
+
500: HttpErrorResponseSchema,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
|
|
3
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
4
|
+
|
|
5
|
+
export const DeleteMarketplaceCardCommandParams = z.object({
|
|
6
|
+
uuid: z.uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const DeleteMarketplaceCardCommandResponse = HttpSuccessResponseSchema;
|
|
10
|
+
|
|
11
|
+
export const DeleteMarketplaceCardCommand = defineContract({
|
|
12
|
+
method: HTTP_METHODS.DELETE,
|
|
13
|
+
path: MARKETPLACE_CARD_ROUTES.DELETE(':uuid'),
|
|
14
|
+
summary: 'Delete marketplace card generation job',
|
|
15
|
+
request: {
|
|
16
|
+
params: DeleteMarketplaceCardCommandParams,
|
|
17
|
+
},
|
|
18
|
+
responses: {
|
|
19
|
+
200: DeleteMarketplaceCardCommandResponse,
|
|
20
|
+
401: HttpErrorResponseSchema,
|
|
21
|
+
404: HttpErrorResponseSchema,
|
|
22
|
+
500: HttpErrorResponseSchema,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { GENERATION_JOB_STATUS } from '../../../generation-job';
|
|
4
|
+
import { MarketplaceCardJobResponseSchema } from '../../models';
|
|
5
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
6
|
+
|
|
7
|
+
export const UpdateMarketplaceCardCommandParams = z.object({
|
|
8
|
+
uuid: z.uuid(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const UpdateMarketplaceCardCommandBody = z.object({
|
|
12
|
+
status: z.literal(GENERATION_JOB_STATUS.CANCELED),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const UpdateMarketplaceCardCommandResponse = MarketplaceCardJobResponseSchema;
|
|
16
|
+
|
|
17
|
+
export const UpdateMarketplaceCardCommand = defineContract({
|
|
18
|
+
method: HTTP_METHODS.PATCH,
|
|
19
|
+
path: MARKETPLACE_CARD_ROUTES.UPDATE(':uuid'),
|
|
20
|
+
summary: 'Cancel marketplace card generation job',
|
|
21
|
+
request: {
|
|
22
|
+
params: UpdateMarketplaceCardCommandParams,
|
|
23
|
+
body: UpdateMarketplaceCardCommandBody,
|
|
24
|
+
},
|
|
25
|
+
responses: {
|
|
26
|
+
200: UpdateMarketplaceCardCommandResponse,
|
|
27
|
+
400: HttpErrorResponseSchema,
|
|
28
|
+
401: HttpErrorResponseSchema,
|
|
29
|
+
404: HttpErrorResponseSchema,
|
|
30
|
+
500: HttpErrorResponseSchema,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const MARKETPLACE_CARD_CONTROLLER = 'marketplace-cards' as const;
|
|
2
|
+
|
|
3
|
+
export const MARKETPLACE_CARD_ROUTES = {
|
|
4
|
+
CREATE: '',
|
|
5
|
+
GET_ALL: '',
|
|
6
|
+
GET_BY_UUID: (uuid: string) => `${uuid}`,
|
|
7
|
+
DOWNLOAD: (uuid: string) => `${uuid}/download`,
|
|
8
|
+
UPDATE: (uuid: string) => `${uuid}`,
|
|
9
|
+
DELETE: (uuid: string) => `${uuid}`,
|
|
10
|
+
} as const;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { GENERATION_JOB_STATUS } from '../../../generation-job';
|
|
4
|
+
import { MarketplaceCardTypeSchema } from '../../models';
|
|
5
|
+
import { MarketplaceCardJobResponseSchema } from '../../models/marketplace-card-job-response.schema';
|
|
6
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
7
|
+
|
|
8
|
+
export const GetMarketplaceCardHistoryQueryQuery = defineCursorPaginationQuery(z.uuid()).extend({
|
|
9
|
+
type: MarketplaceCardTypeSchema.optional(),
|
|
10
|
+
status: z.enum(GENERATION_JOB_STATUS).optional(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const GetMarketplaceCardHistoryQueryResponse = z.object({
|
|
14
|
+
jobs: z.array(MarketplaceCardJobResponseSchema),
|
|
15
|
+
nextCursor: z.uuid().nullable(),
|
|
16
|
+
hasMore: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const GetMarketplaceCardHistoryQuery = defineContract({
|
|
20
|
+
method: HTTP_METHODS.GET,
|
|
21
|
+
path: MARKETPLACE_CARD_ROUTES.GET_ALL,
|
|
22
|
+
summary: 'Get marketplace card generation history with cursor pagination',
|
|
23
|
+
request: {
|
|
24
|
+
query: GetMarketplaceCardHistoryQueryQuery,
|
|
25
|
+
},
|
|
26
|
+
responses: {
|
|
27
|
+
200: GetMarketplaceCardHistoryQueryResponse,
|
|
28
|
+
401: HttpErrorResponseSchema,
|
|
29
|
+
500: HttpErrorResponseSchema,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { MarketplaceCardJobResponseSchema } from '../../models';
|
|
4
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
5
|
+
|
|
6
|
+
export const GetMarketplaceCardQueryParams = z.object({
|
|
7
|
+
uuid: z.uuid(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const GetMarketplaceCardQueryResponse = MarketplaceCardJobResponseSchema;
|
|
11
|
+
|
|
12
|
+
export const GetMarketplaceCardQuery = defineContract({
|
|
13
|
+
method: HTTP_METHODS.GET,
|
|
14
|
+
path: MARKETPLACE_CARD_ROUTES.GET_BY_UUID(':uuid'),
|
|
15
|
+
summary: 'Get marketplace card generation job by uuid',
|
|
16
|
+
request: {
|
|
17
|
+
params: GetMarketplaceCardQueryParams,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: GetMarketplaceCardQueryResponse,
|
|
21
|
+
401: HttpErrorResponseSchema,
|
|
22
|
+
404: HttpErrorResponseSchema,
|
|
23
|
+
500: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GENERATION_JOB_STATUS } from '../../generation-job';
|
|
3
|
+
import { MARKETPLACE_CARD_STYLE_MODE, MARKETPLACE_CARD_TYPE } from '../enums';
|
|
4
|
+
import { MarketplaceCardOutputSchema } from './marketplace-card-output.schema';
|
|
5
|
+
|
|
6
|
+
export const MarketplaceCardTypeSchema = z.enum(MARKETPLACE_CARD_TYPE);
|
|
7
|
+
export const MarketplaceCardStyleModeSchema = z.enum(MARKETPLACE_CARD_STYLE_MODE);
|
|
8
|
+
|
|
9
|
+
export const MarketplaceCardJobResponseSchema = z.object({
|
|
10
|
+
uuid: z.uuid(),
|
|
11
|
+
userId: z.uuid(),
|
|
12
|
+
type: MarketplaceCardTypeSchema,
|
|
13
|
+
description: z.string(),
|
|
14
|
+
advantages: z.string().nullable(),
|
|
15
|
+
styleMode: MarketplaceCardStyleModeSchema,
|
|
16
|
+
styleText: z.string().nullable(),
|
|
17
|
+
stylePresetKey: z.string().nullable(),
|
|
18
|
+
styleReferenceFileId: z.uuid().nullable(),
|
|
19
|
+
variantCount: z.number().int().positive(),
|
|
20
|
+
status: z.enum(GENERATION_JOB_STATUS),
|
|
21
|
+
outputs: z.array(MarketplaceCardOutputSchema).nullable(),
|
|
22
|
+
errorMessage: z.string().nullable(),
|
|
23
|
+
startedAt: z.date().nullable(),
|
|
24
|
+
finishedAt: z.date().nullable(),
|
|
25
|
+
createdAt: z.date(),
|
|
26
|
+
updatedAt: z.date(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type MarketplaceCardJobResponseSchemaType = z.infer<typeof MarketplaceCardJobResponseSchema>;
|
package/package.json
CHANGED
|
@@ -254,6 +254,33 @@ import {
|
|
|
254
254
|
GetGenerationPriceBody,
|
|
255
255
|
GetGenerationPriceResponse,
|
|
256
256
|
} from '../generation-model/endpoints/queries/get-generation-price.query';
|
|
257
|
+
import { MARKETPLACE_CARD_CONTROLLER } from '../marketplace-card/endpoints/marketplace-card';
|
|
258
|
+
import {
|
|
259
|
+
CreateMarketplaceCardCommand,
|
|
260
|
+
CreateMarketplaceCardCommandBody,
|
|
261
|
+
CreateMarketplaceCardCommandResponse,
|
|
262
|
+
} from '../marketplace-card/endpoints/commands/create-marketplace-card.command';
|
|
263
|
+
import {
|
|
264
|
+
DeleteMarketplaceCardCommand,
|
|
265
|
+
DeleteMarketplaceCardCommandParams,
|
|
266
|
+
DeleteMarketplaceCardCommandResponse,
|
|
267
|
+
} from '../marketplace-card/endpoints/commands/delete-marketplace-card.command';
|
|
268
|
+
import {
|
|
269
|
+
UpdateMarketplaceCardCommand,
|
|
270
|
+
UpdateMarketplaceCardCommandBody,
|
|
271
|
+
UpdateMarketplaceCardCommandParams,
|
|
272
|
+
UpdateMarketplaceCardCommandResponse,
|
|
273
|
+
} from '../marketplace-card/endpoints/commands/update-marketplace-card.command';
|
|
274
|
+
import {
|
|
275
|
+
GetMarketplaceCardQuery,
|
|
276
|
+
GetMarketplaceCardQueryParams,
|
|
277
|
+
GetMarketplaceCardQueryResponse,
|
|
278
|
+
} from '../marketplace-card/endpoints/queries/get-marketplace-card.query';
|
|
279
|
+
import {
|
|
280
|
+
GetMarketplaceCardHistoryQuery,
|
|
281
|
+
GetMarketplaceCardHistoryQueryQuery,
|
|
282
|
+
GetMarketplaceCardHistoryQueryResponse,
|
|
283
|
+
} from '../marketplace-card/endpoints/queries/get-marketplace-card-history.query';
|
|
257
284
|
|
|
258
285
|
const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
259
286
|
|
|
@@ -433,6 +460,17 @@ async function main() {
|
|
|
433
460
|
registerSchema('AdminGetUserTransactionsResponse', GetAdminUserTransactionsQueryResponse);
|
|
434
461
|
registerSchema('AdminGetStatsQuery', GetAdminStatsQueryQuery);
|
|
435
462
|
registerSchema('AdminGetStatsResponse', GetAdminStatsQueryResponse);
|
|
463
|
+
registerSchema('MarketplaceCardCreateRequest', CreateMarketplaceCardCommandBody);
|
|
464
|
+
registerSchema('MarketplaceCardCreateResponse', CreateMarketplaceCardCommandResponse);
|
|
465
|
+
registerSchema('MarketplaceCardGetByUuidParams', GetMarketplaceCardQueryParams);
|
|
466
|
+
registerSchema('MarketplaceCardGetByUuidResponse', GetMarketplaceCardQueryResponse);
|
|
467
|
+
registerSchema('MarketplaceCardUpdateParams', UpdateMarketplaceCardCommandParams);
|
|
468
|
+
registerSchema('MarketplaceCardUpdateRequest', UpdateMarketplaceCardCommandBody);
|
|
469
|
+
registerSchema('MarketplaceCardUpdateResponse', UpdateMarketplaceCardCommandResponse);
|
|
470
|
+
registerSchema('MarketplaceCardDeleteParams', DeleteMarketplaceCardCommandParams);
|
|
471
|
+
registerSchema('MarketplaceCardDeleteResponse', DeleteMarketplaceCardCommandResponse);
|
|
472
|
+
registerSchema('MarketplaceCardHistoryQuery', GetMarketplaceCardHistoryQueryQuery);
|
|
473
|
+
registerSchema('MarketplaceCardHistoryResponse', GetMarketplaceCardHistoryQueryResponse);
|
|
436
474
|
|
|
437
475
|
const authContracts: HttpContract[] = [
|
|
438
476
|
RegisterCommand,
|
|
@@ -461,6 +499,13 @@ async function main() {
|
|
|
461
499
|
const fileContracts: HttpContract[] = [UploadFileCommand];
|
|
462
500
|
const walletContracts: HttpContract[] = [GetWalletBalanceQuery, GetWalletTransactionsQuery];
|
|
463
501
|
const paymentContracts: HttpContract[] = [CreatePaymentCommand];
|
|
502
|
+
const marketplaceCardContracts: HttpContract[] = [
|
|
503
|
+
CreateMarketplaceCardCommand,
|
|
504
|
+
GetMarketplaceCardHistoryQuery,
|
|
505
|
+
GetMarketplaceCardQuery,
|
|
506
|
+
UpdateMarketplaceCardCommand,
|
|
507
|
+
DeleteMarketplaceCardCommand,
|
|
508
|
+
];
|
|
464
509
|
const aiModelContracts: HttpContract[] = [GetAllAiModelsQuery, GetAiModelByUuidQuery];
|
|
465
510
|
const generationModelContracts: HttpContract[] = [
|
|
466
511
|
GetGenerationModelsQuery,
|
|
@@ -845,6 +890,37 @@ async function main() {
|
|
|
845
890
|
});
|
|
846
891
|
}
|
|
847
892
|
|
|
893
|
+
for (const contract of marketplaceCardContracts) {
|
|
894
|
+
const method = contract.method.toLowerCase();
|
|
895
|
+
if (!supportedHttpMethods.has(method)) {
|
|
896
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
registry.registerPath({
|
|
900
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
901
|
+
path: toOpenApiPath(MARKETPLACE_CARD_CONTROLLER, contract.path),
|
|
902
|
+
summary: contract.summary,
|
|
903
|
+
tags: ['Marketplace Cards'],
|
|
904
|
+
request: {
|
|
905
|
+
...(contract.request?.body
|
|
906
|
+
? {
|
|
907
|
+
body: {
|
|
908
|
+
required: true,
|
|
909
|
+
content: {
|
|
910
|
+
'application/json': {
|
|
911
|
+
schema: resolveSchema(contract.request.body),
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
},
|
|
915
|
+
}
|
|
916
|
+
: {}),
|
|
917
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
918
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
919
|
+
},
|
|
920
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
|
|
848
924
|
const generator = new OpenApiGeneratorV3(registry.definitions);
|
|
849
925
|
const document = generator.generateDocument({
|
|
850
926
|
openapi: '3.0.0',
|