Add mentions, pin messages and conversations, and search within chats

This commit is contained in:
2026-09-30 10:40:29 +03:30
parent 7c4b24fad6
commit f71e78f3a7
9 changed files with 1152 additions and 31 deletions
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, Post, Query, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { CurrentUser } from '../auth/current-user.decorator';
import { RequireOrgModule } from '../billing/org-module.decorator';
@@ -7,6 +7,9 @@ import {
CreateConversationDmDto,
CreateConversationGroupDto,
HideConversationMessagesDto,
PinConversationMessageDto,
PinConversationRoomDto,
UnpinConversationMessageDto,
} from './dto';
import { ConversationsService } from './conversations.service';
@@ -63,6 +66,20 @@ export class ConversationsController {
);
}
@Post('rooms/pin')
pinRoom(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@Body() dto: PinConversationRoomDto,
) {
return this.conversations.setRoomPinned(
user.userId,
user.organizationId,
user.role,
dto.externalRoomId,
dto.pinned,
);
}
@Post('messages/hide')
hideMessages(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@@ -90,4 +107,58 @@ export class ConversationsController {
externalRoomId || '',
);
}
@Get('messages/pin')
getPinnedMessage(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@Query('externalRoomId') externalRoomId: string,
) {
return this.conversations.getPinnedMessage(
user.userId,
user.organizationId,
user.role,
externalRoomId || '',
);
}
@Post('messages/pin')
pinMessage(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@Body() dto: PinConversationMessageDto,
) {
return this.conversations.pinMessage(
user.userId,
user.organizationId,
user.role,
dto.externalRoomId,
dto.messageId,
dto.preview,
);
}
@Post('messages/unpin')
unpinMessage(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@Body() dto: UnpinConversationMessageDto,
) {
return this.conversations.unpinMessage(
user.userId,
user.organizationId,
user.role,
dto.externalRoomId,
);
}
@Delete('messages/pin')
unpinMessageDelete(
@CurrentUser() user: { userId: string; organizationId: string; role: string },
@Query('externalRoomId') externalRoomId: string,
) {
return this.conversations.unpinMessage(
user.userId,
user.organizationId,
user.role,
externalRoomId || '',
);
}
}