11package org .dfbf .soundlink .domain .chat .service ;
22
33import lombok .RequiredArgsConstructor ;
4+ import org .dfbf .soundlink .domain .chat .dto .ChatRoomWithVideoResDto ;
45import org .dfbf .soundlink .domain .chat .entity .redis .ChatRequest ;
56import org .dfbf .soundlink .domain .chat .dto .ChatReqDto ;
67import org .dfbf .soundlink .domain .chat .entity .ChatRoom ;
1617import org .dfbf .soundlink .global .comm .enums .RoomStatus ;
1718import org .dfbf .soundlink .global .exception .ErrorCode ;
1819import org .dfbf .soundlink .global .exception .ResponseResult ;
19- import org .springframework .dao .DataIntegrityViolationException ;
2020import org .springframework .data .redis .core .RedisTemplate ;
2121import org .springframework .security .core .annotation .AuthenticationPrincipal ;
2222import org .springframework .stereotype .Service ;
@@ -111,6 +111,9 @@ public ResponseResult createChatRoom(Long userId, Long recordId) {
111111
112112 Long responseUserId = emotionRecord .getUser ().getUserId ();
113113
114+ //비디오아이디 추가
115+ String videoId = emotionRecord .getSpotifyMusic ().getVideoId ();
116+
114117 ChatRoom chatRoom = ChatRoom .builder ()
115118 .requestUserId (requestUserId )
116119 .recordId (emotionRecord )
@@ -123,11 +126,12 @@ public ResponseResult createChatRoom(Long userId, Long recordId) {
123126 chatRoomRepository .save (chatRoom );
124127
125128 ChatReqDto chatReqDto = new ChatReqDto (userId , responseUserId );
126-
129+
130+ ChatRoomWithVideoResDto responseDto = new ChatRoomWithVideoResDto (chatRoom .getChatRoomId (), videoId );
131+
127132 // 레디스에 저장
128133 redisTemplate .opsForValue ().set ("Room::" +chatRoom .getChatRoomId (), String .valueOf (chatReqDto ));
129-
130- return new ResponseResult (ErrorCode .SUCCESS , chatRoom );
134+ return new ResponseResult (ErrorCode .SUCCESS , responseDto );
131135 } catch (Exception e ) {
132136 return new ResponseResult (ErrorCode .INTERNAL_SERVER_ERROR , e .getMessage ());
133137 }
0 commit comments