diff --git a/src/main/java/com/meetup/teame/backend/domain/activity/entity/Activity.java b/src/main/java/com/meetup/teame/backend/domain/activity/entity/Activity.java index 63ed6a7..2a58dd5 100644 --- a/src/main/java/com/meetup/teame/backend/domain/activity/entity/Activity.java +++ b/src/main/java/com/meetup/teame/backend/domain/activity/entity/Activity.java @@ -80,4 +80,8 @@ public static Activity of(String title, String description, String location, Loc .imageUrl(imageUrl) .build(); } + + public void incrementCurrentParticipants() { + this.currentParticipants++; + } } \ No newline at end of file diff --git a/src/main/java/com/meetup/teame/backend/domain/chatroom/service/ChatRoomService.java b/src/main/java/com/meetup/teame/backend/domain/chatroom/service/ChatRoomService.java index c044bd0..ae8e748 100644 --- a/src/main/java/com/meetup/teame/backend/domain/chatroom/service/ChatRoomService.java +++ b/src/main/java/com/meetup/teame/backend/domain/chatroom/service/ChatRoomService.java @@ -75,18 +75,19 @@ public ReadDirectChatRoomsRes readDirectChatRooms() { @Transactional public Long joinGroupChatRoom(Long activityId) { + Activity activity = activityRepository.findById(activityId) + .orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_ACTIVITY)); Long userId = SecurityContextProvider.getAuthenticatedUserId(); User user = userRepository.findById(userId) .orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_USER)); GroupChatRoom groupChatRoom = groupChatRoomRepository.findByActivityId(activityId) .orElseGet(() -> { - Activity activity = activityRepository.findById(activityId) - .orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_ACTIVITY)); return groupChatRoomRepository.save(GroupChatRoom.of(activity)); }); if (userChatRoomRepository.existsByChatRoomIdAndUserId(groupChatRoom.getId(), user.getId())) throw new CustomException(ExceptionContent.BAD_REQUEST_ALREADY_JOIN_CHATROOM); userChatRoomRepository.save(UserChatRoom.of(groupChatRoom, user)); + activity.incrementCurrentParticipants(); return groupChatRoom.getId(); } diff --git a/src/main/java/com/meetup/teame/backend/domain/experience/dto/response/ExperienceRes.java b/src/main/java/com/meetup/teame/backend/domain/experience/dto/response/ExperienceRes.java index db34b82..c29260e 100644 --- a/src/main/java/com/meetup/teame/backend/domain/experience/dto/response/ExperienceRes.java +++ b/src/main/java/com/meetup/teame/backend/domain/experience/dto/response/ExperienceRes.java @@ -28,7 +28,7 @@ public static ExperienceRes of(Experience experience) { .age(experience.getUser().getAge()) .gender(experience.getUser().getGender().getDescription()) .location(experience.getUser().getLocation()) - .message(experience.getDescription()) + .message(experience.getDetail()) .build(); } }