Add mentions, pin messages and conversations, and search within chats
This commit is contained in:
@@ -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 || '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user