@ai-grator/api 0.1.24 → 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 +22 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +22 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/scripts/generate-openapi.js +64 -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 +22 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +98 -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
|
@@ -801,4 +801,26 @@ export const ERRORS = {
|
|
|
801
801
|
message: 'Запрос провайдера генерации не удался',
|
|
802
802
|
},
|
|
803
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
|
+
},
|
|
804
826
|
} as const;
|
package/index.ts
CHANGED
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,
|
|
@@ -469,6 +510,22 @@ async function main() {
|
|
|
469
510
|
registerSchema('AdminGetStatsQuery', GetAdminStatsQueryQuery);
|
|
470
511
|
registerSchema('AdminGetStatsResponse', GetAdminStatsQueryResponse);
|
|
471
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);
|
|
472
529
|
registerSchema('MarketplaceCardCreateRequest', CreateMarketplaceCardCommandBody);
|
|
473
530
|
registerSchema('MarketplaceCardCreateResponse', CreateMarketplaceCardCommandResponse);
|
|
474
531
|
registerSchema('MarketplaceCardGetByUuidParams', GetMarketplaceCardQueryParams);
|
|
@@ -507,6 +564,12 @@ async function main() {
|
|
|
507
564
|
DeleteMessageCommand,
|
|
508
565
|
];
|
|
509
566
|
const fileContracts: HttpContract[] = [UploadFileCommand];
|
|
567
|
+
const supportContracts: HttpContract[] = [
|
|
568
|
+
SendSupportMessageCommand,
|
|
569
|
+
GetSupportHistoryQuery,
|
|
570
|
+
GetSupportUnreadCountQuery,
|
|
571
|
+
MarkSupportChatReadByUserCommand,
|
|
572
|
+
];
|
|
510
573
|
const walletContracts: HttpContract[] = [GetWalletBalanceQuery, GetWalletTransactionsQuery];
|
|
511
574
|
const paymentContracts: HttpContract[] = [CreatePaymentCommand];
|
|
512
575
|
const marketplaceCardContracts: HttpContract[] = [
|
|
@@ -556,6 +619,10 @@ async function main() {
|
|
|
556
619
|
GetAdminUserTransactionsQuery,
|
|
557
620
|
GetAdminStatsQuery,
|
|
558
621
|
GetAdminKieBalanceQuery,
|
|
622
|
+
GetAdminSupportChatsQuery,
|
|
623
|
+
GetAdminSupportChatMessagesQuery,
|
|
624
|
+
SendAdminSupportReplyCommand,
|
|
625
|
+
MarkAdminSupportChatReadCommand,
|
|
559
626
|
];
|
|
560
627
|
|
|
561
628
|
for (const contract of authContracts) {
|
|
@@ -685,6 +752,37 @@ async function main() {
|
|
|
685
752
|
});
|
|
686
753
|
}
|
|
687
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
|
+
|
|
688
786
|
for (const contract of walletContracts) {
|
|
689
787
|
const method = contract.method.toLowerCase();
|
|
690
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';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SupportMessageResponseSchema } from '../models';
|
|
3
|
+
|
|
4
|
+
export const SUPPORT_SOCKET_NAMESPACE = '/support' as const;
|
|
5
|
+
|
|
6
|
+
export const SUPPORT_SOCKET_EVENTS = {
|
|
7
|
+
MESSAGE: 'support:message',
|
|
8
|
+
UNREAD_COUNT: 'support:unread-count',
|
|
9
|
+
CHAT_UPDATED: 'support:chat-updated',
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export const SupportSocketMessagePayloadSchema = z.object({
|
|
13
|
+
userId: z.uuid(),
|
|
14
|
+
message: SupportMessageResponseSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type SupportSocketMessagePayloadSchemaType = z.infer<typeof SupportSocketMessagePayloadSchema>;
|
|
18
|
+
|
|
19
|
+
export const SupportSocketUnreadCountPayloadSchema = z.object({
|
|
20
|
+
unreadCount: z.number().int().nonnegative(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type SupportSocketUnreadCountPayloadSchemaType = z.infer<typeof SupportSocketUnreadCountPayloadSchema>;
|
|
24
|
+
|
|
25
|
+
export const SupportSocketChatUpdatedPayloadSchema = z.object({
|
|
26
|
+
userId: z.uuid(),
|
|
27
|
+
userEmail: z.email(),
|
|
28
|
+
userName: z.string().nullable(),
|
|
29
|
+
lastMessage: z.string().nullable(),
|
|
30
|
+
lastMessageHasAttachment: z.boolean(),
|
|
31
|
+
lastMessageAt: z.iso.datetime(),
|
|
32
|
+
unreadCount: z.number().int().nonnegative(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type SupportSocketChatUpdatedPayloadSchemaType = z.infer<typeof SupportSocketChatUpdatedPayloadSchema>;
|