feat: implement conversation mute and favorite functionality with corresponding notification suppression.
This commit is contained in:
@@ -218,6 +218,36 @@ export class MessagesController {
|
||||
return this.messagesService.markMessagesAsRead(conversationId, userId);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// TOGGLE MUTE
|
||||
// ==========================================
|
||||
@Patch('conversations/:id/mute')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Mute or unmute conversation notifications' })
|
||||
@ApiParam({ name: 'id', description: 'Conversation ID' })
|
||||
async toggleMute(
|
||||
@Param('id') conversationId: string,
|
||||
@CurrentUser('id') userId: string,
|
||||
@Body() dto: { muted: boolean },
|
||||
) {
|
||||
return this.messagesService.toggleMute(conversationId, userId, dto.muted);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// TOGGLE FAVORITE
|
||||
// ==========================================
|
||||
@Patch('conversations/:id/favorite')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Star or unstar a conversation' })
|
||||
@ApiParam({ name: 'id', description: 'Conversation ID' })
|
||||
async toggleFavorite(
|
||||
@Param('id') conversationId: string,
|
||||
@CurrentUser('id') userId: string,
|
||||
@Body() dto: { favorited: boolean },
|
||||
) {
|
||||
return this.messagesService.toggleFavorite(conversationId, userId, dto.favorited);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// CLEAR CHAT (delete messages, keep conversation)
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user