-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat/#68/AddChattingServerAPIs get channel hist / edit doce
- Loading branch information
Showing
6 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ import { | |
} from '@nestjs/swagger'; | ||
import { AuthAccessGuard } from '../auth/gql-auth.guard'; | ||
import { CurrentUser, ICurrentUser } from '../auth/gql-user.param'; | ||
import { ChattingRoomService } from './chatting-server.service'; | ||
import { ChattingServerService } from './chatting-server.service'; | ||
import { | ||
ChattingRoomResult, | ||
MyChattingRoomList, | ||
|
@@ -33,7 +33,7 @@ import { UpdateChattingRoomDto } from './dto/update-chatting-room.dto'; | |
@Controller('chatting-server') | ||
@ApiTags('채팅 서버 API') | ||
export class ChattingServerController { | ||
constructor(private readonly chattingRoomService: ChattingRoomService) {} | ||
constructor(private readonly chattingServerService: ChattingServerService) {} | ||
|
||
@UseGuards(AuthAccessGuard) | ||
@Post() | ||
|
@@ -51,7 +51,7 @@ export class ChattingServerController { | |
@Body() createChattingRoomDto: CreateChattingRoomDto, | ||
@CurrentUser() currentUser: ICurrentUser, | ||
) { | ||
return this.chattingRoomService | ||
return this.chattingServerService | ||
.createChattingServer(createChattingRoomDto, currentUser) | ||
.then((result) => { | ||
res.status(HttpStatus.OK).json({ success: true, result: result }); | ||
|
@@ -70,8 +70,8 @@ export class ChattingServerController { | |
type: MyChattingRoomList, | ||
}) | ||
fetchMyChattingRoom(@Res() res, @CurrentUser() currentUser: ICurrentUser) { | ||
return this.chattingRoomService | ||
.fetchMyChattingRoom(currentUser) | ||
return this.chattingServerService | ||
.fetchMyChattingServer(currentUser) | ||
.then((result) => { | ||
res.status(HttpStatus.OK).json({ success: true, result: result }); | ||
}); | ||
|
@@ -86,14 +86,67 @@ export class ChattingServerController { | |
}) | ||
@ApiOkResponse({ | ||
description: '채팅 서버 조회 성공', | ||
type: MyChattingRoomList, | ||
schema: { | ||
example: { | ||
success: true, | ||
id: '5a360b2a-289e-40ae-a99d-3be8830b6ba2', | ||
name: '테스트', | ||
image: | ||
'https://storage.googleapis.com/wthchat/3c31dec5-9528-4017-8613-3e44fa51431a.png', | ||
users: [ | ||
{ | ||
id: '50893644-5292-471a-a970-dbc651a592fc', | ||
email: '[email protected]', | ||
name: 'asd', | ||
picture: '', | ||
nickName: '최총123', | ||
createdAt: '2022-05-16T05:36:40.938Z', | ||
updatedAt: '2022-05-28T07:21:37.259Z', | ||
}, | ||
{ | ||
id: '1f5a82f3-5860-4fff-bcaa-a0fb310bff0d', | ||
email: '[email protected]', | ||
name: '김재민', | ||
picture: null, | ||
nickName: '~제이민', | ||
createdAt: '2022-05-27T21:29:06.250Z', | ||
updatedAt: '2022-06-01T08:42:03.067Z', | ||
}, | ||
{ | ||
id: '05f37505-9f62-4a22-9e76-ae9f9932adee', | ||
email: '[email protected]', | ||
name: '최건', | ||
picture: null, | ||
nickName: '최총테스트123123', | ||
createdAt: '2022-06-05T06:50:20.134Z', | ||
updatedAt: '2022-06-05T06:50:41.384Z', | ||
}, | ||
], | ||
channels: [ | ||
{ | ||
id: '4a7f7eaa-1bd2-4628-8e59-cb7ebc7da3f3', | ||
name: '스터디룸', | ||
createdAt: '2022-06-01T07:14:41.270Z', | ||
updatedAt: '2022-06-01T07:14:41.270Z', | ||
deletedAt: null, | ||
}, | ||
{ | ||
id: 'bb28bbff-52bb-4c37-8eda-740b4704d946', | ||
name: '스터디룸2', | ||
createdAt: '2022-06-01T07:14:55.985Z', | ||
updatedAt: '2022-06-01T07:14:55.985Z', | ||
deletedAt: null, | ||
}, | ||
], | ||
}, | ||
}, | ||
}) | ||
fetchChattingServerDetail( | ||
@Res() res, | ||
@CurrentUser() currentUser: ICurrentUser, | ||
@Param('serverId') serverId: string, | ||
) { | ||
return this.chattingRoomService | ||
return this.chattingServerService | ||
.fetchChattingServerDetail(currentUser, serverId) | ||
.then((result) => { | ||
res.status(HttpStatus.OK).json({ success: true, ...result }); | ||
|
@@ -114,7 +167,7 @@ export class ChattingServerController { | |
@Body() updateUserDto: UpdateChattingRoomDto, | ||
@CurrentUser() currentUser: ICurrentUser, | ||
) { | ||
return this.chattingRoomService | ||
return this.chattingServerService | ||
.updateChattingRoom(updateUserDto, currentUser) | ||
.then((result) => { | ||
if (!result) throw new ConflictException('채팅 서버 수정 실패'); | ||
|
@@ -139,7 +192,7 @@ export class ChattingServerController { | |
@Query('roomId') roomId: string, | ||
@CurrentUser() currentUser: ICurrentUser, | ||
) { | ||
return this.chattingRoomService | ||
return this.chattingServerService | ||
.deleteChattingRoom(roomId, currentUser) | ||
.then((result) => { | ||
if (!result) throw new ConflictException('채팅 서버 삭제 실패'); | ||
|
@@ -164,7 +217,7 @@ export class ChattingServerController { | |
@Body() grantUserAuthorityDto: GrantUserAuthorityDto, | ||
@CurrentUser() currentUser: ICurrentUser, | ||
) { | ||
return this.chattingRoomService | ||
return this.chattingServerService | ||
.grantUserAuthority(grantUserAuthorityDto, currentUser) | ||
.then((result) => { | ||
if (!result) throw new ConflictException('권한 부여 실패'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters