@ai-grator/api 0.1.23 → 0.1.25
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/admin/endpoints/admin.ts +6 -0
- package/admin/endpoints/commands/index.ts +2 -0
- package/admin/endpoints/commands/mark-admin-support-chat-read.command.ts +25 -0
- package/admin/endpoints/commands/send-admin-support-reply.command.ts +38 -0
- package/admin/endpoints/queries/get-admin-support-chat-messages.query.ts +33 -0
- package/admin/endpoints/queries/get-admin-support-chats.query.ts +27 -0
- package/admin/endpoints/queries/index.ts +6 -4
- package/admin/models/admin-support-chat-list-item.schema.ts +13 -0
- package/admin/models/index.ts +1 -0
- package/build/admin/endpoints/admin.d.ts +4 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +5 -0
- package/build/admin/endpoints/commands/index.d.ts +2 -0
- package/build/admin/endpoints/commands/index.d.ts.map +1 -1
- package/build/admin/endpoints/commands/index.js +2 -0
- package/build/admin/endpoints/commands/mark-admin-support-chat-read.command.d.ts +24 -0
- package/build/admin/endpoints/commands/mark-admin-support-chat-read.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/mark-admin-support-chat-read.command.js +25 -0
- package/build/admin/endpoints/commands/send-admin-support-reply.command.d.ts +79 -0
- package/build/admin/endpoints/commands/send-admin-support-reply.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/send-admin-support-reply.command.js +37 -0
- package/build/admin/endpoints/queries/get-admin-support-chat-messages.query.d.ts +86 -0
- package/build/admin/endpoints/queries/get-admin-support-chat-messages.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-support-chat-messages.query.js +32 -0
- package/build/admin/endpoints/queries/get-admin-support-chats.query.d.ts +49 -0
- package/build/admin/endpoints/queries/get-admin-support-chats.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-support-chats.query.js +27 -0
- package/build/admin/endpoints/queries/index.d.ts +6 -4
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +6 -4
- package/build/admin/models/admin-support-chat-list-item.schema.d.ts +12 -0
- package/build/admin/models/admin-support-chat-list-item.schema.d.ts.map +1 -0
- package/build/admin/models/admin-support-chat-list-item.schema.js +13 -0
- package/build/admin/models/index.d.ts +1 -0
- package/build/admin/models/index.d.ts.map +1 -1
- package/build/admin/models/index.js +1 -0
- package/build/chat/endpoints/commands/create-chat.command.d.ts +2 -0
- package/build/chat/endpoints/commands/create-chat.command.d.ts.map +1 -1
- package/build/chat/endpoints/commands/update-chat.command.d.ts +2 -0
- package/build/chat/endpoints/commands/update-chat.command.d.ts.map +1 -1
- package/build/chat/endpoints/queries/get-chat-by-uuid.query.d.ts +2 -0
- package/build/chat/endpoints/queries/get-chat-by-uuid.query.d.ts.map +1 -1
- package/build/chat/endpoints/queries/get-chats.query.d.ts +2 -0
- package/build/chat/endpoints/queries/get-chats.query.d.ts.map +1 -1
- package/build/chat/models/chat-response.schema.d.ts +1 -0
- package/build/chat/models/chat-response.schema.d.ts.map +1 -1
- package/build/chat/models/chat-response.schema.js +1 -0
- package/build/errors/errors.d.ts +28 -1
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +28 -1
- package/build/file/enums/file.enum.d.ts +1 -0
- package/build/file/enums/file.enum.d.ts.map +1 -1
- package/build/file/enums/file.enum.js +59 -59
- package/build/file/helpers/allowed-file-formats.helper.d.ts +4 -0
- package/build/file/helpers/allowed-file-formats.helper.d.ts.map +1 -0
- package/build/file/helpers/allowed-file-formats.helper.js +15 -0
- package/build/file/helpers/index.d.ts +2 -0
- package/build/file/helpers/index.d.ts.map +1 -0
- package/build/file/helpers/index.js +17 -0
- package/build/file/index.d.ts +1 -0
- package/build/file/index.d.ts.map +1 -1
- package/build/file/index.js +1 -0
- package/build/file/models/file-format-list.schema.d.ts +8 -0
- package/build/file/models/file-format-list.schema.d.ts.map +1 -0
- package/build/file/models/file-format-list.schema.js +9 -0
- package/build/file/models/index.d.ts +1 -0
- package/build/file/models/index.d.ts.map +1 -1
- package/build/file/models/index.js +1 -0
- package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts +20 -2
- package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts.map +1 -1
- package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts +20 -2
- package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts.map +1 -1
- package/build/generation-model/models/generation-model-response.schema.d.ts +31 -1
- package/build/generation-model/models/generation-model-response.schema.d.ts.map +1 -1
- package/build/generation-model/models/generation-model-response.schema.js +10 -2
- 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/marketplace-card.d.ts +1 -0
- package/build/marketplace-card/endpoints/marketplace-card.d.ts.map +1 -1
- package/build/marketplace-card/endpoints/marketplace-card.js +1 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-config.query.d.ts +27 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-config.query.d.ts.map +1 -0
- package/build/marketplace-card/endpoints/queries/get-marketplace-card-config.query.js +20 -0
- package/build/marketplace-card/endpoints/queries/index.d.ts +1 -0
- package/build/marketplace-card/endpoints/queries/index.d.ts.map +1 -1
- package/build/marketplace-card/endpoints/queries/index.js +1 -0
- package/build/scripts/generate-openapi.js +67 -0
- package/build/support/endpoints/commands/index.d.ts +3 -0
- package/build/support/endpoints/commands/index.d.ts.map +1 -0
- package/build/support/endpoints/commands/index.js +18 -0
- package/build/support/endpoints/commands/mark-support-chat-read-by-user.command.d.ts +12 -0
- package/build/support/endpoints/commands/mark-support-chat-read-by-user.command.d.ts.map +1 -0
- package/build/support/endpoints/commands/mark-support-chat-read-by-user.command.js +15 -0
- package/build/support/endpoints/commands/send-support-message.command.d.ts +70 -0
- package/build/support/endpoints/commands/send-support-message.command.d.ts.map +1 -0
- package/build/support/endpoints/commands/send-support-message.command.js +30 -0
- package/build/support/endpoints/index.d.ts +4 -0
- package/build/support/endpoints/index.d.ts.map +1 -0
- package/build/support/endpoints/index.js +19 -0
- package/build/support/endpoints/queries/get-support-history.query.d.ts +77 -0
- package/build/support/endpoints/queries/get-support-history.query.d.ts.map +1 -0
- package/build/support/endpoints/queries/get-support-history.query.js +25 -0
- package/build/support/endpoints/queries/get-support-unread-count.query.d.ts +17 -0
- package/build/support/endpoints/queries/get-support-unread-count.query.d.ts.map +1 -0
- package/build/support/endpoints/queries/get-support-unread-count.query.js +18 -0
- package/build/support/endpoints/queries/index.d.ts +3 -0
- package/build/support/endpoints/queries/index.d.ts.map +1 -0
- package/build/support/endpoints/queries/index.js +18 -0
- package/build/support/endpoints/support.d.ts +8 -0
- package/build/support/endpoints/support.d.ts.map +1 -0
- package/build/support/endpoints/support.js +10 -0
- package/build/support/enums/index.d.ts +2 -0
- package/build/support/enums/index.d.ts.map +1 -0
- package/build/support/enums/index.js +17 -0
- package/build/support/enums/support-message-author-type.enum.d.ts +5 -0
- package/build/support/enums/support-message-author-type.enum.d.ts.map +1 -0
- package/build/support/enums/support-message-author-type.enum.js +8 -0
- package/build/support/index.d.ts +5 -0
- package/build/support/index.d.ts.map +1 -0
- package/build/support/index.js +20 -0
- package/build/support/models/index.d.ts +2 -0
- package/build/support/models/index.d.ts.map +1 -0
- package/build/support/models/index.js +17 -0
- package/build/support/models/support-message-response.schema.d.ts +28 -0
- package/build/support/models/support-message-response.schema.d.ts.map +1 -0
- package/build/support/models/support-message-response.schema.js +14 -0
- package/build/support/websocket/index.d.ts +2 -0
- package/build/support/websocket/index.d.ts.map +1 -0
- package/build/support/websocket/index.js +17 -0
- package/build/support/websocket/support-socket-events.d.ts +50 -0
- package/build/support/websocket/support-socket-events.d.ts.map +1 -0
- package/build/support/websocket/support-socket-events.js +27 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/chat/models/chat-response.schema.ts +1 -0
- package/errors/errors.ts +28 -1
- package/file/enums/file.enum.ts +60 -59
- package/file/helpers/allowed-file-formats.helper.ts +16 -0
- package/file/helpers/index.ts +1 -0
- package/file/index.ts +1 -0
- package/file/models/file-format-list.schema.ts +9 -0
- package/file/models/index.ts +1 -0
- package/generation-model/models/generation-model-response.schema.ts +11 -1
- package/index.ts +1 -0
- package/marketplace-card/endpoints/marketplace-card.ts +1 -0
- package/marketplace-card/endpoints/queries/get-marketplace-card-config.query.ts +21 -0
- package/marketplace-card/endpoints/queries/index.ts +1 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +104 -0
- package/support/endpoints/commands/index.ts +2 -0
- package/support/endpoints/commands/mark-support-chat-read-by-user.command.ts +14 -0
- package/support/endpoints/commands/send-support-message.command.ts +30 -0
- package/support/endpoints/index.ts +3 -0
- package/support/endpoints/queries/get-support-history.query.ts +25 -0
- package/support/endpoints/queries/get-support-unread-count.query.ts +17 -0
- package/support/endpoints/queries/index.ts +2 -0
- package/support/endpoints/support.ts +8 -0
- package/support/enums/index.ts +1 -0
- package/support/enums/support-message-author-type.enum.ts +4 -0
- package/support/index.ts +4 -0
- package/support/models/index.ts +1 -0
- package/support/models/support-message-response.schema.ts +14 -0
- package/support/websocket/index.ts +1 -0
- package/support/websocket/support-socket-events.ts +35 -0
|
@@ -19,6 +19,7 @@ export const ChatResponseSchema = z.object({
|
|
|
19
19
|
lastModel: ChatLastModelSchema.nullable(),
|
|
20
20
|
createdAt: z.iso.datetime(),
|
|
21
21
|
updatedAt: z.iso.datetime(),
|
|
22
|
+
lastMessageAt: z.iso.datetime(),
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
export type ChatResponseSchemaType = z.infer<typeof ChatResponseSchema>;
|
package/errors/errors.ts
CHANGED
|
@@ -328,10 +328,15 @@ export const ERRORS = {
|
|
|
328
328
|
code: 'GENERATION_JOB.INVALID_ATTACHMENT_FILE_TYPE',
|
|
329
329
|
message: 'Один или несколько прикреплённых файлов имеют тип файла, не принятый слотом',
|
|
330
330
|
},
|
|
331
|
+
INVALID_ATTACHMENT_FILE_FORMAT: {
|
|
332
|
+
httpCode: 400,
|
|
333
|
+
code: 'GENERATION_JOB.INVALID_ATTACHMENT_FILE_FORMAT',
|
|
334
|
+
message: 'Один или несколько прикреплённых файлов имеют формат, не поддерживаемый этой моделью',
|
|
335
|
+
},
|
|
331
336
|
ATTACHMENT_SLOT_NOT_MULTIPLE: {
|
|
332
337
|
httpCode: 400,
|
|
333
338
|
code: 'GENERATION_JOB.ATTACHMENT_SLOT_NOT_MULTIPLE',
|
|
334
|
-
message: '
|
|
339
|
+
message: 'Превышено максимальное количество файлов для этого слота вложения',
|
|
335
340
|
},
|
|
336
341
|
CHAT_MODEL_MISMATCH: {
|
|
337
342
|
httpCode: 400,
|
|
@@ -796,4 +801,26 @@ export const ERRORS = {
|
|
|
796
801
|
message: 'Запрос провайдера генерации не удался',
|
|
797
802
|
},
|
|
798
803
|
},
|
|
804
|
+
SUPPORT: {
|
|
805
|
+
CHAT_NOT_FOUND: {
|
|
806
|
+
httpCode: 404,
|
|
807
|
+
code: 'SUPPORT.CHAT_NOT_FOUND',
|
|
808
|
+
message: 'Чат поддержки не найден',
|
|
809
|
+
},
|
|
810
|
+
SEND_MESSAGE_ERROR: {
|
|
811
|
+
httpCode: 500,
|
|
812
|
+
code: 'SUPPORT.SEND_MESSAGE_ERROR',
|
|
813
|
+
message: 'Не удалось отправить сообщение в поддержку',
|
|
814
|
+
},
|
|
815
|
+
FIND_ERROR: {
|
|
816
|
+
httpCode: 500,
|
|
817
|
+
code: 'SUPPORT.FIND_ERROR',
|
|
818
|
+
message: 'Не удалось получить историю переписки с поддержкой',
|
|
819
|
+
},
|
|
820
|
+
MARK_READ_ERROR: {
|
|
821
|
+
httpCode: 500,
|
|
822
|
+
code: 'SUPPORT.MARK_READ_ERROR',
|
|
823
|
+
message: 'Не удалось отметить сообщения поддержки как прочитанные',
|
|
824
|
+
},
|
|
825
|
+
},
|
|
799
826
|
} as const;
|
package/file/enums/file.enum.ts
CHANGED
|
@@ -19,84 +19,85 @@ export const SUPPORTED_FILES = new Map<
|
|
|
19
19
|
{
|
|
20
20
|
type: FILE_TYPE;
|
|
21
21
|
size: number;
|
|
22
|
+
extension: string;
|
|
22
23
|
}
|
|
23
24
|
>([
|
|
24
|
-
['application/json', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
25
|
-
['application/x-ndjson', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
26
|
-
['application/x-yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
27
|
-
['application/toml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
28
|
-
['application/xml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
29
|
-
['application/graphql', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
25
|
+
['application/json', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'json' }],
|
|
26
|
+
['application/x-ndjson', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'ndjson' }],
|
|
27
|
+
['application/x-yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'yaml' }],
|
|
28
|
+
['application/toml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'toml' }],
|
|
29
|
+
['application/xml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'xml' }],
|
|
30
|
+
['application/graphql', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'graphql' }],
|
|
30
31
|
|
|
31
|
-
['text/csv', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
32
|
-
['text/tab-separated-values', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
33
|
-
['text/markdown', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
34
|
-
['text/x-markdown', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
35
|
-
['text/yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
36
|
-
['text/x-yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
37
|
-
['text/xml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
32
|
+
['text/csv', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'csv' }],
|
|
33
|
+
['text/tab-separated-values', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'tsv' }],
|
|
34
|
+
['text/markdown', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'md' }],
|
|
35
|
+
['text/x-markdown', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'md' }],
|
|
36
|
+
['text/yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'yaml' }],
|
|
37
|
+
['text/x-yaml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'yaml' }],
|
|
38
|
+
['text/xml', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'xml' }],
|
|
38
39
|
|
|
39
|
-
['text/plain', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
40
|
-
['text/html', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
41
|
-
['text/css', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
42
|
-
['text/x-scss', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
43
|
-
['text/javascript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
44
|
-
['application/javascript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
45
|
-
['text/typescript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
46
|
-
['application/typescript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
40
|
+
['text/plain', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'txt' }],
|
|
41
|
+
['text/html', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'html' }],
|
|
42
|
+
['text/css', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'css' }],
|
|
43
|
+
['text/x-scss', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'scss' }],
|
|
44
|
+
['text/javascript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'js' }],
|
|
45
|
+
['application/javascript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'js' }],
|
|
46
|
+
['text/typescript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'ts' }],
|
|
47
|
+
['application/typescript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'ts' }],
|
|
47
48
|
|
|
48
|
-
['text/x-python', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
49
|
-
['text/x-go', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
50
|
-
['text/x-ruby', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
51
|
-
['text/x-php', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
52
|
-
['text/x-c', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
53
|
-
['text/x-c++', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
54
|
-
['text/x-java-source', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
55
|
-
['text/x-sql', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
49
|
+
['text/x-python', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'py' }],
|
|
50
|
+
['text/x-go', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'go' }],
|
|
51
|
+
['text/x-ruby', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'rb' }],
|
|
52
|
+
['text/x-php', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'php' }],
|
|
53
|
+
['text/x-c', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'c' }],
|
|
54
|
+
['text/x-c++', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'cpp' }],
|
|
55
|
+
['text/x-java-source', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'java' }],
|
|
56
|
+
['text/x-sql', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'sql' }],
|
|
56
57
|
|
|
57
|
-
['application/x-sh', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
58
|
-
['text/x-shellscript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
59
|
-
['text/x-ini', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
60
|
-
['text/x-properties', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
61
|
-
['text/x-config', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE }],
|
|
58
|
+
['application/x-sh', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'sh' }],
|
|
59
|
+
['text/x-shellscript', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'sh' }],
|
|
60
|
+
['text/x-ini', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'ini' }],
|
|
61
|
+
['text/x-properties', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'properties' }],
|
|
62
|
+
['text/x-config', { type: FILE_TYPE.TEXT, size: MAX_TEXT_UPLOAD_SIZE, extension: 'conf' }],
|
|
62
63
|
|
|
63
|
-
['image/png', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
64
|
-
['image/jpeg', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
65
|
-
['image/webp', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
66
|
-
['image/avif', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
67
|
-
['image/gif', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
68
|
-
['image/svg+xml', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
64
|
+
['image/png', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'png' }],
|
|
65
|
+
['image/jpeg', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'jpg' }],
|
|
66
|
+
['image/webp', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'webp' }],
|
|
67
|
+
['image/avif', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'avif' }],
|
|
68
|
+
['image/gif', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'gif' }],
|
|
69
|
+
['image/svg+xml', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE, extension: 'svg' }],
|
|
69
70
|
|
|
70
|
-
['application/pdf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE }],
|
|
71
|
+
['application/pdf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'pdf' }],
|
|
71
72
|
[
|
|
72
73
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
73
|
-
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE },
|
|
74
|
+
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'docx' },
|
|
74
75
|
],
|
|
75
|
-
['application/vnd.ms-excel', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE }],
|
|
76
|
+
['application/vnd.ms-excel', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'xls' }],
|
|
76
77
|
[
|
|
77
78
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
78
|
-
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE },
|
|
79
|
+
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'xlsx' },
|
|
79
80
|
],
|
|
80
81
|
[
|
|
81
82
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
82
|
-
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE },
|
|
83
|
+
{ type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'pptx' },
|
|
83
84
|
],
|
|
84
|
-
['application/rtf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE }],
|
|
85
|
-
['text/rtf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE }],
|
|
85
|
+
['application/rtf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'rtf' }],
|
|
86
|
+
['text/rtf', { type: FILE_TYPE.DOCUMENT, size: MAX_DOCUMENT_UPLOAD_SIZE, extension: 'rtf' }],
|
|
86
87
|
|
|
87
|
-
['audio/mpeg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
88
|
-
['audio/mp4', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
89
|
-
['audio/wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
90
|
-
['audio/x-wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
91
|
-
['audio/webm', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
92
|
-
['audio/ogg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
93
|
-
['audio/aac', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
88
|
+
['audio/mpeg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'mp3' }],
|
|
89
|
+
['audio/mp4', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'm4a' }],
|
|
90
|
+
['audio/wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'wav' }],
|
|
91
|
+
['audio/x-wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'wav' }],
|
|
92
|
+
['audio/webm', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'weba' }],
|
|
93
|
+
['audio/ogg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'ogg' }],
|
|
94
|
+
['audio/aac', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE, extension: 'aac' }],
|
|
94
95
|
|
|
95
|
-
['video/mp4', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
|
|
96
|
-
['video/mpeg', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
|
|
97
|
-
['video/webm', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
|
|
98
|
-
['video/quicktime', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
|
|
99
|
-
['video/ogg', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE }],
|
|
96
|
+
['video/mp4', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE, extension: 'mp4' }],
|
|
97
|
+
['video/mpeg', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE, extension: 'mpeg' }],
|
|
98
|
+
['video/webm', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE, extension: 'webm' }],
|
|
99
|
+
['video/quicktime', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE, extension: 'mov' }],
|
|
100
|
+
['video/ogg', { type: FILE_TYPE.VIDEO, size: MAX_VIDEO_UPLOAD_SIZE, extension: 'ogv' }],
|
|
100
101
|
]);
|
|
101
102
|
|
|
102
103
|
export const DELETE_UNUSED_FILES_AFTER_HOURS = 12;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FILE_TYPE, SUPPORTED_FILES } from '../enums';
|
|
2
|
+
import { FileFormatListSchemaType } from '../models';
|
|
3
|
+
|
|
4
|
+
export function getAllowedFileFormats(fileType: FILE_TYPE): FileFormatListSchemaType {
|
|
5
|
+
const entries = [...SUPPORTED_FILES.entries()].filter(([, value]) => value.type === fileType);
|
|
6
|
+
|
|
7
|
+
if (entries.length === 0) {
|
|
8
|
+
throw new Error(`No SUPPORTED_FILES entries registered for FILE_TYPE.${fileType}`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
mimeTypes: entries.map(([mimeType]) => mimeType),
|
|
13
|
+
extensions: [...new Set(entries.map(([, value]) => value.extension))],
|
|
14
|
+
maxSize: Math.min(...entries.map(([, value]) => value.size)),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './allowed-file-formats.helper';
|
package/file/index.ts
CHANGED
package/file/models/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { FILE_TYPE, FileFormatListSchema } from '../../file';
|
|
2
3
|
import { IconSchema } from '../../_common';
|
|
3
4
|
import { GENERATION_TYPE } from '../enums';
|
|
4
5
|
import { PricingPolicySchema } from './pricing-policy.schema';
|
|
@@ -7,6 +8,15 @@ const JsonObjectSchema = z.record(z.string(), z.unknown());
|
|
|
7
8
|
|
|
8
9
|
export const GenerationTypeSchema = z.enum(GENERATION_TYPE);
|
|
9
10
|
|
|
11
|
+
export const AttachmentSlotSchema = z.object({
|
|
12
|
+
fileType: z.enum(FILE_TYPE),
|
|
13
|
+
required: z.boolean(),
|
|
14
|
+
maxCount: z.int().positive(),
|
|
15
|
+
allowedFormats: FileFormatListSchema,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const AttachmentPolicySchema = z.record(z.string(), AttachmentSlotSchema);
|
|
19
|
+
|
|
10
20
|
export const GenerationModelResponseSchema = z.object({
|
|
11
21
|
uuid: z.uuid(),
|
|
12
22
|
titleModel: z.string().min(1),
|
|
@@ -17,7 +27,7 @@ export const GenerationModelResponseSchema = z.object({
|
|
|
17
27
|
providerTitle: z.string().min(1),
|
|
18
28
|
order: z.int(),
|
|
19
29
|
isActive: z.boolean(),
|
|
20
|
-
attachmentPolicy:
|
|
30
|
+
attachmentPolicy: AttachmentPolicySchema,
|
|
21
31
|
paramsSchema: JsonObjectSchema,
|
|
22
32
|
pricingPolicy: PricingPolicySchema,
|
|
23
33
|
});
|
package/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export const MARKETPLACE_CARD_CONTROLLER = 'marketplace-cards' as const;
|
|
|
3
3
|
export const MARKETPLACE_CARD_ROUTES = {
|
|
4
4
|
CREATE: '',
|
|
5
5
|
GET_ALL: '',
|
|
6
|
+
GET_CONFIG: 'config',
|
|
6
7
|
GET_BY_UUID: (uuid: string) => `${uuid}`,
|
|
7
8
|
DOWNLOAD: (uuid: string) => `${uuid}/download`,
|
|
8
9
|
UPDATE: (uuid: string) => `${uuid}`,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FileFormatListSchema } from '../../../file';
|
|
3
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
4
|
+
import { MARKETPLACE_CARD_ROUTES } from '../marketplace-card';
|
|
5
|
+
|
|
6
|
+
export const GetMarketplaceCardConfigResponse = z.object({
|
|
7
|
+
styleReferenceFile: FileFormatListSchema,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type GetMarketplaceCardConfigResponseType = z.infer<typeof GetMarketplaceCardConfigResponse>;
|
|
11
|
+
|
|
12
|
+
export const GetMarketplaceCardConfigQuery = defineContract({
|
|
13
|
+
method: HTTP_METHODS.GET,
|
|
14
|
+
path: MARKETPLACE_CARD_ROUTES.GET_CONFIG,
|
|
15
|
+
summary: 'Get marketplace card generation config (allowed file formats)',
|
|
16
|
+
responses: {
|
|
17
|
+
200: GetMarketplaceCardConfigResponse,
|
|
18
|
+
401: HttpErrorResponseSchema,
|
|
19
|
+
500: HttpErrorResponseSchema,
|
|
20
|
+
},
|
|
21
|
+
});
|
package/package.json
CHANGED
|
@@ -157,6 +157,47 @@ import {
|
|
|
157
157
|
UploadFileCommandBody,
|
|
158
158
|
UploadFileCommandResponse,
|
|
159
159
|
} from '../file/endpoints/commands/upload-file.command';
|
|
160
|
+
import { SUPPORT_CONTROLLER } from '../support/endpoints/support';
|
|
161
|
+
import {
|
|
162
|
+
SendSupportMessageCommand,
|
|
163
|
+
SendSupportMessageCommandBody,
|
|
164
|
+
SendSupportMessageCommandResponse,
|
|
165
|
+
} from '../support/endpoints/commands/send-support-message.command';
|
|
166
|
+
import {
|
|
167
|
+
MarkSupportChatReadByUserCommand,
|
|
168
|
+
MarkSupportChatReadByUserCommandResponse,
|
|
169
|
+
} from '../support/endpoints/commands/mark-support-chat-read-by-user.command';
|
|
170
|
+
import {
|
|
171
|
+
GetSupportHistoryQuery,
|
|
172
|
+
GetSupportHistoryQueryQuery,
|
|
173
|
+
GetSupportHistoryQueryResponse,
|
|
174
|
+
} from '../support/endpoints/queries/get-support-history.query';
|
|
175
|
+
import {
|
|
176
|
+
GetSupportUnreadCountQuery,
|
|
177
|
+
GetSupportUnreadCountQueryResponse,
|
|
178
|
+
} from '../support/endpoints/queries/get-support-unread-count.query';
|
|
179
|
+
import {
|
|
180
|
+
SendAdminSupportReplyCommand,
|
|
181
|
+
SendAdminSupportReplyCommandBody,
|
|
182
|
+
SendAdminSupportReplyCommandParams,
|
|
183
|
+
SendAdminSupportReplyCommandResponse,
|
|
184
|
+
} from '../admin/endpoints/commands/send-admin-support-reply.command';
|
|
185
|
+
import {
|
|
186
|
+
MarkAdminSupportChatReadCommand,
|
|
187
|
+
MarkAdminSupportChatReadCommandParams,
|
|
188
|
+
MarkAdminSupportChatReadCommandResponse,
|
|
189
|
+
} from '../admin/endpoints/commands/mark-admin-support-chat-read.command';
|
|
190
|
+
import {
|
|
191
|
+
GetAdminSupportChatsQuery,
|
|
192
|
+
GetAdminSupportChatsQueryQuery,
|
|
193
|
+
GetAdminSupportChatsQueryResponse,
|
|
194
|
+
} from '../admin/endpoints/queries/get-admin-support-chats.query';
|
|
195
|
+
import {
|
|
196
|
+
GetAdminSupportChatMessagesQuery,
|
|
197
|
+
GetAdminSupportChatMessagesQueryParams,
|
|
198
|
+
GetAdminSupportChatMessagesQueryQuery,
|
|
199
|
+
GetAdminSupportChatMessagesQueryResponse,
|
|
200
|
+
} from '../admin/endpoints/queries/get-admin-support-chat-messages.query';
|
|
160
201
|
import { WALLET_CONTROLLER } from '../wallet/endpoints/wallet';
|
|
161
202
|
import {
|
|
162
203
|
GetWalletBalanceQuery,
|
|
@@ -285,6 +326,10 @@ import {
|
|
|
285
326
|
GetMarketplaceCardHistoryQueryQuery,
|
|
286
327
|
GetMarketplaceCardHistoryQueryResponse,
|
|
287
328
|
} from '../marketplace-card/endpoints/queries/get-marketplace-card-history.query';
|
|
329
|
+
import {
|
|
330
|
+
GetMarketplaceCardConfigQuery,
|
|
331
|
+
GetMarketplaceCardConfigResponse,
|
|
332
|
+
} from '../marketplace-card/endpoints/queries/get-marketplace-card-config.query';
|
|
288
333
|
|
|
289
334
|
const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
290
335
|
|
|
@@ -465,6 +510,22 @@ async function main() {
|
|
|
465
510
|
registerSchema('AdminGetStatsQuery', GetAdminStatsQueryQuery);
|
|
466
511
|
registerSchema('AdminGetStatsResponse', GetAdminStatsQueryResponse);
|
|
467
512
|
registerSchema('AdminGetKieBalanceResponse', GetAdminKieBalanceQueryResponse);
|
|
513
|
+
registerSchema('AdminGetSupportChatsQuery', GetAdminSupportChatsQueryQuery);
|
|
514
|
+
registerSchema('AdminGetSupportChatsResponse', GetAdminSupportChatsQueryResponse);
|
|
515
|
+
registerSchema('AdminGetSupportChatMessagesParams', GetAdminSupportChatMessagesQueryParams);
|
|
516
|
+
registerSchema('AdminGetSupportChatMessagesQuery', GetAdminSupportChatMessagesQueryQuery);
|
|
517
|
+
registerSchema('AdminGetSupportChatMessagesResponse', GetAdminSupportChatMessagesQueryResponse);
|
|
518
|
+
registerSchema('AdminSendSupportReplyParams', SendAdminSupportReplyCommandParams);
|
|
519
|
+
registerSchema('AdminSendSupportReplyRequest', SendAdminSupportReplyCommandBody);
|
|
520
|
+
registerSchema('AdminSendSupportReplyResponse', SendAdminSupportReplyCommandResponse);
|
|
521
|
+
registerSchema('AdminMarkSupportChatReadParams', MarkAdminSupportChatReadCommandParams);
|
|
522
|
+
registerSchema('AdminMarkSupportChatReadResponse', MarkAdminSupportChatReadCommandResponse);
|
|
523
|
+
registerSchema('SupportSendMessageRequest', SendSupportMessageCommandBody);
|
|
524
|
+
registerSchema('SupportSendMessageResponse', SendSupportMessageCommandResponse);
|
|
525
|
+
registerSchema('SupportGetHistoryQuery', GetSupportHistoryQueryQuery);
|
|
526
|
+
registerSchema('SupportGetHistoryResponse', GetSupportHistoryQueryResponse);
|
|
527
|
+
registerSchema('SupportGetUnreadCountResponse', GetSupportUnreadCountQueryResponse);
|
|
528
|
+
registerSchema('SupportMarkReadResponse', MarkSupportChatReadByUserCommandResponse);
|
|
468
529
|
registerSchema('MarketplaceCardCreateRequest', CreateMarketplaceCardCommandBody);
|
|
469
530
|
registerSchema('MarketplaceCardCreateResponse', CreateMarketplaceCardCommandResponse);
|
|
470
531
|
registerSchema('MarketplaceCardGetByUuidParams', GetMarketplaceCardQueryParams);
|
|
@@ -476,6 +537,7 @@ async function main() {
|
|
|
476
537
|
registerSchema('MarketplaceCardDeleteResponse', DeleteMarketplaceCardCommandResponse);
|
|
477
538
|
registerSchema('MarketplaceCardHistoryQuery', GetMarketplaceCardHistoryQueryQuery);
|
|
478
539
|
registerSchema('MarketplaceCardHistoryResponse', GetMarketplaceCardHistoryQueryResponse);
|
|
540
|
+
registerSchema('MarketplaceCardConfigResponse', GetMarketplaceCardConfigResponse);
|
|
479
541
|
|
|
480
542
|
const authContracts: HttpContract[] = [
|
|
481
543
|
RegisterCommand,
|
|
@@ -502,11 +564,18 @@ async function main() {
|
|
|
502
564
|
DeleteMessageCommand,
|
|
503
565
|
];
|
|
504
566
|
const fileContracts: HttpContract[] = [UploadFileCommand];
|
|
567
|
+
const supportContracts: HttpContract[] = [
|
|
568
|
+
SendSupportMessageCommand,
|
|
569
|
+
GetSupportHistoryQuery,
|
|
570
|
+
GetSupportUnreadCountQuery,
|
|
571
|
+
MarkSupportChatReadByUserCommand,
|
|
572
|
+
];
|
|
505
573
|
const walletContracts: HttpContract[] = [GetWalletBalanceQuery, GetWalletTransactionsQuery];
|
|
506
574
|
const paymentContracts: HttpContract[] = [CreatePaymentCommand];
|
|
507
575
|
const marketplaceCardContracts: HttpContract[] = [
|
|
508
576
|
CreateMarketplaceCardCommand,
|
|
509
577
|
GetMarketplaceCardHistoryQuery,
|
|
578
|
+
GetMarketplaceCardConfigQuery,
|
|
510
579
|
GetMarketplaceCardQuery,
|
|
511
580
|
UpdateMarketplaceCardCommand,
|
|
512
581
|
DeleteMarketplaceCardCommand,
|
|
@@ -550,6 +619,10 @@ async function main() {
|
|
|
550
619
|
GetAdminUserTransactionsQuery,
|
|
551
620
|
GetAdminStatsQuery,
|
|
552
621
|
GetAdminKieBalanceQuery,
|
|
622
|
+
GetAdminSupportChatsQuery,
|
|
623
|
+
GetAdminSupportChatMessagesQuery,
|
|
624
|
+
SendAdminSupportReplyCommand,
|
|
625
|
+
MarkAdminSupportChatReadCommand,
|
|
553
626
|
];
|
|
554
627
|
|
|
555
628
|
for (const contract of authContracts) {
|
|
@@ -679,6 +752,37 @@ async function main() {
|
|
|
679
752
|
});
|
|
680
753
|
}
|
|
681
754
|
|
|
755
|
+
for (const contract of supportContracts) {
|
|
756
|
+
const method = contract.method.toLowerCase();
|
|
757
|
+
if (!supportedHttpMethods.has(method)) {
|
|
758
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
registry.registerPath({
|
|
762
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
763
|
+
path: toOpenApiPath(SUPPORT_CONTROLLER, contract.path),
|
|
764
|
+
summary: contract.summary,
|
|
765
|
+
tags: ['Support'],
|
|
766
|
+
request: {
|
|
767
|
+
...(contract.request?.body
|
|
768
|
+
? {
|
|
769
|
+
body: {
|
|
770
|
+
required: true,
|
|
771
|
+
content: {
|
|
772
|
+
'application/json': {
|
|
773
|
+
schema: resolveSchema(contract.request.body),
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
}
|
|
778
|
+
: {}),
|
|
779
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
780
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
781
|
+
},
|
|
782
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
|
|
682
786
|
for (const contract of walletContracts) {
|
|
683
787
|
const method = contract.method.toLowerCase();
|
|
684
788
|
if (!supportedHttpMethods.has(method)) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
|
|
2
|
+
import { SUPPORT_ROUTES } from '../support';
|
|
3
|
+
|
|
4
|
+
export const MarkSupportChatReadByUserCommandResponse = HttpSuccessResponseSchema;
|
|
5
|
+
|
|
6
|
+
export const MarkSupportChatReadByUserCommand = defineContract({
|
|
7
|
+
method: HTTP_METHODS.POST,
|
|
8
|
+
path: SUPPORT_ROUTES.MARK_READ,
|
|
9
|
+
summary: 'Mark support chat as read by the current user',
|
|
10
|
+
responses: {
|
|
11
|
+
200: MarkSupportChatReadByUserCommandResponse,
|
|
12
|
+
500: HttpErrorResponseSchema,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { SUPPORT_ROUTES } from '../support';
|
|
4
|
+
import { SupportMessageResponseSchema } from '../../models';
|
|
5
|
+
|
|
6
|
+
export const SendSupportMessageCommandBody = z
|
|
7
|
+
.object({
|
|
8
|
+
text: z.string().trim().min(1).optional(),
|
|
9
|
+
fileIds: z.array(z.uuid()).optional(),
|
|
10
|
+
})
|
|
11
|
+
.refine(({ text, fileIds }) => Boolean(text) || Boolean(fileIds?.length), {
|
|
12
|
+
message: 'text or fileIds is required',
|
|
13
|
+
path: ['text'],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const SendSupportMessageCommandResponse = SupportMessageResponseSchema;
|
|
17
|
+
|
|
18
|
+
export const SendSupportMessageCommand = defineContract({
|
|
19
|
+
method: HTTP_METHODS.POST,
|
|
20
|
+
path: SUPPORT_ROUTES.SEND_MESSAGE,
|
|
21
|
+
summary: 'Send a message to support (creates the chat on the first message)',
|
|
22
|
+
request: {
|
|
23
|
+
body: SendSupportMessageCommandBody,
|
|
24
|
+
},
|
|
25
|
+
responses: {
|
|
26
|
+
201: SendSupportMessageCommandResponse,
|
|
27
|
+
400: HttpErrorResponseSchema,
|
|
28
|
+
500: HttpErrorResponseSchema,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { SUPPORT_ROUTES } from '../support';
|
|
4
|
+
import { SupportMessageResponseSchema } from '../../models';
|
|
5
|
+
|
|
6
|
+
export const GetSupportHistoryQueryQuery = defineCursorPaginationQuery(z.uuid());
|
|
7
|
+
|
|
8
|
+
export const GetSupportHistoryQueryResponse = z.object({
|
|
9
|
+
messages: z.array(SupportMessageResponseSchema),
|
|
10
|
+
nextCursor: z.uuid().nullable(),
|
|
11
|
+
hasMore: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const GetSupportHistoryQuery = defineContract({
|
|
15
|
+
method: HTTP_METHODS.GET,
|
|
16
|
+
path: SUPPORT_ROUTES.GET_HISTORY,
|
|
17
|
+
summary: 'Get support chat history for the current user',
|
|
18
|
+
request: {
|
|
19
|
+
query: GetSupportHistoryQueryQuery,
|
|
20
|
+
},
|
|
21
|
+
responses: {
|
|
22
|
+
200: GetSupportHistoryQueryResponse,
|
|
23
|
+
500: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { SUPPORT_ROUTES } from '../support';
|
|
4
|
+
|
|
5
|
+
export const GetSupportUnreadCountQueryResponse = z.object({
|
|
6
|
+
unreadCount: z.number().int().nonnegative(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const GetSupportUnreadCountQuery = defineContract({
|
|
10
|
+
method: HTTP_METHODS.GET,
|
|
11
|
+
path: SUPPORT_ROUTES.GET_UNREAD_COUNT,
|
|
12
|
+
summary: 'Get the count of unread support replies for the current user',
|
|
13
|
+
responses: {
|
|
14
|
+
200: GetSupportUnreadCountQueryResponse,
|
|
15
|
+
500: HttpErrorResponseSchema,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './support-message-author-type.enum';
|
package/support/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './support-message-response.schema';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SUPPORT_MESSAGE_AUTHOR_TYPE } from '../enums';
|
|
3
|
+
import { FileResponseSchema } from '../../file';
|
|
4
|
+
|
|
5
|
+
export const SupportMessageResponseSchema = z.object({
|
|
6
|
+
uuid: z.uuid(),
|
|
7
|
+
chatId: z.uuid(),
|
|
8
|
+
authorType: z.enum(SUPPORT_MESSAGE_AUTHOR_TYPE),
|
|
9
|
+
text: z.string().nullable(),
|
|
10
|
+
files: z.array(FileResponseSchema),
|
|
11
|
+
createdAt: z.iso.datetime(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type SupportMessageResponseSchemaType = z.infer<typeof SupportMessageResponseSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './support-socket-events';
|