feat: add get chatbot conversation by id endpoint

This commit is contained in:
2026-11-14 23:58:34 +03:30
parent d572f6b7a2
commit 88b4a99908
6 changed files with 117 additions and 0 deletions
@@ -38,6 +38,27 @@ export class ChatbotService {
}));
}
public async getConversation(user: User, conversationId: number) {
const conversation = await this.conversationService.findConversationById(
conversationId,
user,
);
const messages = await this.conversationService.getMessages(conversation);
return {
conversationId: conversation.id,
title: conversation.title,
createdAt: conversation.createdAt,
updatedAt: conversation.updatedAt,
messages: messages.map((message) => ({
messageId: message.id,
role: message.role,
content: message.content,
createdAt: message.createdAt,
})),
};
}
private async getConversationMessages(
user: User,
message: string,