From 6eec958d21d10f3b3fc4605c5b0787126ebf2124 Mon Sep 17 00:00:00 2001 From: Youngmyung Kim <83266154+ymkim97@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:01:18 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=A9=20=EC=88=98=EC=A0=95=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=A3=A8=ED=8B=B4=20=EC=88=98=EC=A0=95=20=EC=A0=9C?= =?UTF-8?q?=EC=99=B8=20(#217)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/moabam/api/application/room/RoomService.java | 6 ------ .../com/moabam/api/dto/room/ModifyRoomRequest.java | 5 ----- .../moabam/api/presentation/RoomControllerTest.java | 12 ++---------- 3 files changed, 2 insertions(+), 21 deletions(-) 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\":\"방장이 아닌 사용자는 방을 수정할 수 없습니다.\"}";