1
1
package cmf .commitField .domain .chat .chatRoom .service ;
2
2
3
3
import cmf .commitField .domain .chat .chatMessage .repository .ChatMessageRepository ;
4
+ import cmf .commitField .domain .chat .chatRoom .controller .request .ChatRoomJoinRequest ;
4
5
import cmf .commitField .domain .chat .chatRoom .controller .request .ChatRoomRequest ;
5
6
import cmf .commitField .domain .chat .chatRoom .controller .request .ChatRoomUpdateRequest ;
6
7
import cmf .commitField .domain .chat .chatRoom .dto .ChatRoomDto ;
@@ -72,6 +73,7 @@ public void createRoom(ChatRoomRequest chatRoomRequest, Long userId, String imag
72
73
.imageUrl (imageUrl ) // 이미지 URL 추가
73
74
.build ();
74
75
if (password != null ) {
76
+ System .out .println ("Setting password: " + password );
75
77
chatRoom .setPassword (password );
76
78
chatRoom .setIsPrivate (true );
77
79
}
@@ -127,7 +129,7 @@ public List<ChatRoomDto> getUserByRoomPartList(Long userId, Pageable pageable) {
127
129
128
130
@ Override
129
131
@ Transactional
130
- public void joinRoom (Long roomId , Long userId , ChatRoomRequest chatRoomRequest ) {
132
+ public void joinRoom (Long roomId , Long userId , ChatRoomJoinRequest chatRoomJoinRequest ) {
131
133
RLock lock = redissonClient .getLock ("joinRoomLock:" + roomId );
132
134
try {
133
135
boolean available = lock .tryLock (1 , TimeUnit .SECONDS );
@@ -145,13 +147,13 @@ public void joinRoom(Long roomId, Long userId, ChatRoomRequest chatRoomRequest)
145
147
// user_chatroom 현재 인원 카운트 (비즈니스 로직)
146
148
Long currentUserCount = userChatRoomRepository .countNonLockByChatRoomId (roomId ); // lock (기존)
147
149
148
- if (chatRoom .getIsPrivate () && chatRoomRequest .getPassword () == null ) {
150
+ if (chatRoom .getIsPrivate () && chatRoomJoinRequest .getPassword () == null ) {
149
151
throw new CustomException (ErrorCode .NEED_TO_PASSWORD );
150
152
151
153
152
154
153
155
}
154
- if (chatRoom .getIsPrivate () && !chatRoomRequest .getPassword ().equals (chatRoom .getPassword ())) {
156
+ if (chatRoom .getIsPrivate () && !chatRoomJoinRequest .getPassword ().equals (chatRoom .getPassword ())) {
155
157
throw new CustomException (ErrorCode .ROOM_PASSWORD_MISMATCH );
156
158
}
157
159
List <Long > userChatRoomByChatRoomId = userChatRoomRepository
0 commit comments