feat: Add endpoint and service logic to delete conversations and their associated messages.
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
Get,
|
||||
Post,
|
||||
Patch,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
@@ -196,6 +197,28 @@ export class MessagesController {
|
||||
return this.messagesService.markMessagesAsRead(conversationId, userId);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// DELETE CONVERSATION
|
||||
// ==========================================
|
||||
@Delete('conversations/:id')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Delete a conversation and all its messages' })
|
||||
@ApiParam({ name: 'id', description: 'Conversation ID' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Conversation deleted',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: 404,
|
||||
description: 'Conversation not found',
|
||||
})
|
||||
async deleteConversation(
|
||||
@Param('id') conversationId: string,
|
||||
@CurrentUser('id') userId: string,
|
||||
) {
|
||||
return this.messagesService.deleteConversation(conversationId, userId);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// GET UNREAD COUNT
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user