-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from boostcampwm-2024/dev-be
[MERGE] dev-be to dev
- Loading branch information
Showing
23 changed files
with
486 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { WsException } from '@nestjs/websockets'; | ||
|
||
class ChatException extends WsException { | ||
statusCode: number; | ||
constructor({ statusCode, message } : ChatError , public roomId?: string) { | ||
super({ statusCode, message, roomId }); | ||
this.statusCode = statusCode; | ||
} | ||
|
||
getError() { | ||
return { | ||
statusCode: this.statusCode, | ||
msg: this.message, | ||
roomId: this.roomId || null, | ||
}; | ||
} | ||
} | ||
|
||
interface ChatError { | ||
statusCode: number; | ||
message: string; | ||
} | ||
|
||
const CHATTING_SOCKET_ERROR = { | ||
ROOM_EMPTY: { | ||
statusCode: HttpStatus.BAD_REQUEST, | ||
message: '유저가 참여하고 있는 채팅방이 없습니다.' | ||
}, | ||
|
||
ROOM_EXISTED: { | ||
statusCode: HttpStatus.BAD_REQUEST, | ||
message: '이미 존재하는 방입니다.' | ||
}, | ||
|
||
INVALID_USER: { | ||
statusCode: HttpStatus.UNAUTHORIZED, | ||
message: '유효하지 않는 유저입니다.' | ||
}, | ||
|
||
UNAUTHORIZED: { | ||
statusCode: HttpStatus.UNAUTHORIZED, | ||
message: '해당 명령에 대한 권한이 없습니다.' | ||
}, | ||
|
||
QUESTION_EMPTY: { | ||
statusCode: HttpStatus.BAD_REQUEST, | ||
message: '유효하지 않은 질문입니다.' | ||
}, | ||
|
||
BAN_USER: { | ||
statusCode: HttpStatus.FORBIDDEN, | ||
message: '호스트에 의해 밴 당한 유저입니다.' | ||
}, | ||
|
||
MSG_TOO_LONG:{ | ||
statusCode: HttpStatus.NOT_ACCEPTABLE, | ||
message: '메세지의 내용이 없거나, 길이가 150자를 초과했습니다.' | ||
} | ||
|
||
|
||
}; | ||
export { CHATTING_SOCKET_ERROR, ChatException }; | ||
|
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ChatGateway } from './chat.gateway'; | ||
import { RoomModule } from '../room/room.module'; | ||
import { MessageGuard } from './chat.guard'; | ||
import { BlacklistGuard, HostGuard, MessageGuard } from './chat.guard'; | ||
|
||
@Module({ | ||
imports: [RoomModule], | ||
providers: [ChatGateway, MessageGuard], | ||
providers: [ChatGateway, MessageGuard, BlacklistGuard, HostGuard], | ||
}) | ||
export class ChatModule {} |
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
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
Oops, something went wrong.