12
12
import org .springframework .transaction .annotation .Transactional ;
13
13
import yeonba .be .chatting .dto .request .ChatPublishRequest ;
14
14
import yeonba .be .chatting .dto .response .ChatMessageResponse ;
15
+ import yeonba .be .chatting .dto .response .ChatRequestAcceptResponse ;
15
16
import yeonba .be .chatting .dto .response .ChatRoomResponse ;
16
17
import yeonba .be .chatting .entity .ChatMessage ;
17
18
import yeonba .be .chatting .entity .ChatRoom ;
@@ -145,7 +146,7 @@ public void requestChat(long senderId, long receiverId) {
145
146
}
146
147
147
148
@ Transactional
148
- public void acceptRequestedChat (long userId , long notificationId ) {
149
+ public ChatRequestAcceptResponse acceptRequestedChat (long userId , long notificationId ) {
149
150
150
151
Notification notification = notificationQuery .findById (notificationId );
151
152
@@ -159,7 +160,7 @@ public void acceptRequestedChat(long userId, long notificationId) {
159
160
User receiver = userQuery .findById (notification .getReceiver ().getId ());
160
161
161
162
// 본인에게 온 채팅 요청인지 검증
162
- if (receiver .equals (userQuery .findById (userId ))) {
163
+ if (! receiver .equals (userQuery .findById (userId ))) {
163
164
164
165
throw new GeneralException (
165
166
NotificationException .NOT_YOUR_CHATTING_REQUEST_NOTIFICATION );
@@ -183,6 +184,8 @@ public void acceptRequestedChat(long userId, long notificationId) {
183
184
LocalDateTime .now ());
184
185
185
186
eventPublisher .publishEvent (notificationSendEvent );
187
+
188
+ return new ChatRequestAcceptResponse (chatRoom .getId ());
186
189
}
187
190
188
191
@ Transactional
0 commit comments