@@ -85,13 +85,13 @@ export class RoomService implements OnModuleInit, OnModuleDestroy {
85
85
// 방 삭제
86
86
async deleteRoom ( roomId : string ) {
87
87
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
88
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
88
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
89
89
await this . redisRepository . deleteRoom ( roomId ) ;
90
90
}
91
91
92
92
async addQuestion ( roomId : string , question : Omit < QuestionDto , 'questionId' > ) {
93
93
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
94
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
94
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
95
95
96
96
return await this . redisRepository . addQuestionToRoom ( roomId , question ) ;
97
97
}
@@ -102,40 +102,40 @@ export class RoomService implements OnModuleInit, OnModuleDestroy {
102
102
question : Omit < QuestionDto , 'questionId' > ,
103
103
) : Promise < QuestionDto > {
104
104
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
105
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
105
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
106
106
107
107
return await this . redisRepository . addQuestionToRoom ( roomId , question ) ;
108
108
}
109
109
110
110
// 특정 질문 완료 처리
111
111
async markQuestionAsDone ( roomId : string , questionId : number ) {
112
112
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
113
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
113
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
114
114
115
115
const markedQuestion = await this . redisRepository . markQuestionAsDone ( roomId , questionId ) ;
116
- if ( ! markedQuestion ) throw new ChatException ( CHATTING_SOCKET_ERROR . QUESTION_EMPTY ) ;
116
+ if ( ! markedQuestion ) throw new ChatException ( CHATTING_SOCKET_ERROR . QUESTION_EMPTY , roomId ) ;
117
117
return markedQuestion ;
118
118
}
119
119
120
120
// 방에 속한 모든 질문 조회
121
121
async getQuestions ( roomId : string ) : Promise < QuestionDto [ ] > {
122
122
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
123
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
123
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
124
124
125
125
return this . redisRepository . getQuestionsAll ( roomId ) ;
126
126
}
127
127
128
128
async getQuestionsNotDone ( roomId : string ) : Promise < QuestionDto [ ] > {
129
129
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
130
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
130
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
131
131
132
132
return this . redisRepository . getQuestionsUnmarked ( roomId ) ;
133
133
}
134
134
135
135
// 특정 질문 조회
136
136
async getQuestion ( roomId : string , questionId : number ) : Promise < QuestionDto > {
137
137
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
138
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
138
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
139
139
return this . redisRepository . getQuestion ( roomId , questionId ) ;
140
140
}
141
141
@@ -163,7 +163,7 @@ export class RoomService implements OnModuleInit, OnModuleDestroy {
163
163
164
164
async getHostOfRoom ( roomId : string ) {
165
165
const roomExists = await this . redisRepository . isRoomExisted ( roomId ) ;
166
- if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY ) ;
166
+ if ( ! roomExists ) throw new ChatException ( CHATTING_SOCKET_ERROR . ROOM_EMPTY , roomId ) ;
167
167
return await this . redisRepository . getHost ( roomId ) ;
168
168
}
169
169
0 commit comments