File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export class ChatController extends Controller {
5959 public async makeChatRoom (
6060 @Request ( ) req : ExpressRequest ,
6161 @Body ( )
62- body : {
62+ body : {
6363 userId : number ;
6464 }
6565 ) : Promise < ITsoaSuccessResponse < { chatRoomId : string } > > {
@@ -187,8 +187,8 @@ export class ChatController extends Controller {
187187 ) : Promise < ITsoaSuccessResponse < string > > {
188188 const userId = req . user . index ;
189189 const chatRoomId = body . chatRoomId ;
190- await this . chatService . readMessage ( chatRoomId , userId ) ;
191- return new TsoaSuccessResponse < string > ( '메시지 읽음 처리 성공' ) ;
190+ const message = await this . chatService . readMessage ( chatRoomId , userId ) ;
191+ return new TsoaSuccessResponse < string > ( message ) ;
192192 }
193193
194194 /**
Original file line number Diff line number Diff line change @@ -106,10 +106,14 @@ export class ChatService {
106106 chatRoomId : string ,
107107 userId : number
108108 ) : Promise < string > {
109+ const chatRoom = await this . chatModel . getChatRoom ( userId ) ;
110+ if ( ! chatRoom . some ( ( room ) => room . chatroomId === chatRoomId ) ) {
111+ throw new ChatRoomNotFound ( chatRoomId ) ;
112+ }
109113 const result = await this . chatModel . readMessage ( chatRoomId , userId ) ;
110114
111115 if ( ! result ) {
112- throw new ChatRoomNotFound ( chatRoomId ) ;
116+ return '읽을 채팅이 없습니다.' ;
113117 }
114118
115119 return '채팅 읽기 성공' ;
You can’t perform that action at this time.
0 commit comments