diff --git a/src/main/java/com/moabam/api/application/room/RoomService.java b/src/main/java/com/moabam/api/application/room/RoomService.java index 63179715..d79c8db8 100644 --- a/src/main/java/com/moabam/api/application/room/RoomService.java +++ b/src/main/java/com/moabam/api/application/room/RoomService.java @@ -75,12 +75,6 @@ public void modifyRoom(Long memberId, Long roomId, ModifyRoomRequest modifyRoomR room.changePassword(modifyRoomRequest.password()); room.changeCertifyTime(modifyRoomRequest.certifyTime()); room.changeMaxCount(modifyRoomRequest.maxUserCount()); - - List routines = routineRepository.findAllByRoomId(roomId); - routineRepository.deleteAll(routines); - - List newRoutines = RoutineMapper.toRoutineEntities(room, modifyRoomRequest.routines()); - routineRepository.saveAll(newRoutines); } @Transactional diff --git a/src/main/java/com/moabam/api/dto/room/ModifyRoomRequest.java b/src/main/java/com/moabam/api/dto/room/ModifyRoomRequest.java index 5d5fd558..28d5cdb1 100644 --- a/src/main/java/com/moabam/api/dto/room/ModifyRoomRequest.java +++ b/src/main/java/com/moabam/api/dto/room/ModifyRoomRequest.java @@ -1,19 +1,14 @@ package com.moabam.api.dto.room; -import java.util.List; - import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Range; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; -import jakarta.validation.constraints.Size; public record ModifyRoomRequest( @NotBlank @Length(max = 20) String title, @Length(max = 100, message = "방 공지의 길이 100자 이하여야 합니다.") String announcement, - @NotNull @Size(min = 1, max = 4) List routines, @Pattern(regexp = "^(|\\d{4,8})$") String password, @Range(min = 0, max = 23) int certifyTime, @Range(min = 0, max = 10) int maxUserCount diff --git a/src/test/java/com/moabam/api/presentation/RoomControllerTest.java b/src/test/java/com/moabam/api/presentation/RoomControllerTest.java index 765d6f38..a0b0eb99 100644 --- a/src/test/java/com/moabam/api/presentation/RoomControllerTest.java +++ b/src/test/java/com/moabam/api/presentation/RoomControllerTest.java @@ -299,15 +299,11 @@ void modify_room_success() throws Exception { Participant participant = RoomFixture.participant(room, 1L); participant.enableManager(); - List newRoutines = new ArrayList<>(); - newRoutines.add("물 마시기"); - newRoutines.add("코테 풀기"); - roomRepository.save(room); routineRepository.saveAll(routines); participantRepository.save(participant); - ModifyRoomRequest modifyRoomRequest = new ModifyRoomRequest("수정할 방임!", "공지공지", newRoutines, "4567", 10, 7); + ModifyRoomRequest modifyRoomRequest = new ModifyRoomRequest("수정할 방임!", "공지공지", "4567", 10, 7); String json = objectMapper.writeValueAsString(modifyRoomRequest); // expected @@ -343,13 +339,9 @@ void unauthorized_modify_room_fail() throws Exception { Participant participant = RoomFixture.participant(room, 1L); - List routines = new ArrayList<>(); - routines.add("물 마시기"); - routines.add("코테 풀기"); - roomRepository.save(room); participantRepository.save(participant); - ModifyRoomRequest modifyRoomRequest = new ModifyRoomRequest("수정할 방임!", "방 공지", routines, "1234", 9, 7); + ModifyRoomRequest modifyRoomRequest = new ModifyRoomRequest("수정할 방임!", "방 공지", "1234", 9, 7); String json = objectMapper.writeValueAsString(modifyRoomRequest); String message = "{\"message\":\"방장이 아닌 사용자는 방을 수정할 수 없습니다.\"}";