From a90a9cb5950ecf34d2922cbc9fbd9900798556db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EB=8F=99=ED=98=84?= Date: Tue, 19 Dec 2023 10:12:32 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=EC=82=AC=EC=9A=A9=EB=90=98=EC=A7=80?= =?UTF-8?q?=20=EC=95=8A=EB=8A=94=20=ED=95=84=EB=93=9C=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20(#418)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 비밀번호는 보관함에서 생성하기 때문에 필드 삭제 --- .../be/store/dto/request/CreateStoreRequest.java | 1 - .../be/store/dto/request/UpdateStoreRequest.java | 1 - .../be/store/dto/response/SingleStoreResponse.java | 5 +---- .../java/upbrella/be/store/entity/StoreMeta.java | 4 ---- .../be/store/controller/StoreControllerTest.java | 12 +----------- .../java/upbrella/be/store/entity/StoreMetaTest.java | 1 - .../be/store/service/StoreDetailServiceTest.java | 9 +-------- .../be/store/service/StoreMetaServiceTest.java | 4 ---- 8 files changed, 3 insertions(+), 34 deletions(-) diff --git a/src/main/java/upbrella/be/store/dto/request/CreateStoreRequest.java b/src/main/java/upbrella/be/store/dto/request/CreateStoreRequest.java index 4f0e8083..50cf7fe3 100644 --- a/src/main/java/upbrella/be/store/dto/request/CreateStoreRequest.java +++ b/src/main/java/upbrella/be/store/dto/request/CreateStoreRequest.java @@ -35,6 +35,5 @@ public class CreateStoreRequest { @Range(min = -180, max = 180) private double longitude; private String content; - private String password; private List businessHours; } \ No newline at end of file diff --git a/src/main/java/upbrella/be/store/dto/request/UpdateStoreRequest.java b/src/main/java/upbrella/be/store/dto/request/UpdateStoreRequest.java index f54d3c4b..7e47329c 100644 --- a/src/main/java/upbrella/be/store/dto/request/UpdateStoreRequest.java +++ b/src/main/java/upbrella/be/store/dto/request/UpdateStoreRequest.java @@ -33,6 +33,5 @@ public class UpdateStoreRequest { @Range(min = -180, max = 180) private double longitude; private String content; - private String password; private List businessHours; } diff --git a/src/main/java/upbrella/be/store/dto/response/SingleStoreResponse.java b/src/main/java/upbrella/be/store/dto/response/SingleStoreResponse.java index c9c7ec84..d711db5c 100644 --- a/src/main/java/upbrella/be/store/dto/response/SingleStoreResponse.java +++ b/src/main/java/upbrella/be/store/dto/response/SingleStoreResponse.java @@ -2,7 +2,6 @@ import com.querydsl.core.annotations.QueryProjection; import lombok.*; -import upbrella.be.store.entity.StoreDetail; import java.io.Serializable; @@ -26,10 +25,9 @@ public class SingleStoreResponse implements Serializable { private double latitude; private double longitude; private String content; - private String password; @QueryProjection - public SingleStoreResponse(long id, String name, String category, SingleClassificationResponse classification, SingleSubClassificationResponse subClassification, boolean activateStatus, String address, String addressDetail, String umbrellaLocation, String businessHour, String contactNumber, String instagramId, double latitude, double longitude, String content, String password) { + public SingleStoreResponse(long id, String name, String category, SingleClassificationResponse classification, SingleSubClassificationResponse subClassification, boolean activateStatus, String address, String addressDetail, String umbrellaLocation, String businessHour, String contactNumber, String instagramId, double latitude, double longitude, String content) { this.id = id; this.name = name; this.category = category; @@ -45,6 +43,5 @@ public SingleStoreResponse(long id, String name, String category, SingleClassifi this.latitude = latitude; this.longitude = longitude; this.content = content; - this.password = password; } } diff --git a/src/main/java/upbrella/be/store/entity/StoreMeta.java b/src/main/java/upbrella/be/store/entity/StoreMeta.java index 2a9f1cd0..62395be3 100644 --- a/src/main/java/upbrella/be/store/entity/StoreMeta.java +++ b/src/main/java/upbrella/be/store/entity/StoreMeta.java @@ -31,7 +31,6 @@ public class StoreMeta { private String category; private double latitude; private double longitude; - private String password; @OneToMany(mappedBy = "storeMeta") private List businessHours; @@ -46,7 +45,6 @@ public static StoreMeta createStoreMetaForSave(CreateStoreRequest request, Class .category(request.getCategory()) .latitude(request.getLatitude()) .longitude(request.getLongitude()) - .password(request.getPassword()) .build(); } @@ -60,7 +58,6 @@ public static StoreMeta createStoreMetaForUpdate(UpdateStoreRequest request, Cla .category(request.getCategory()) .latitude(request.getLatitude()) .longitude(request.getLongitude()) - .password(request.getPassword()) .build(); } @@ -73,7 +70,6 @@ public void updateStoreMeta(StoreMeta storeMeta) { this.category = storeMeta.getCategory(); this.latitude = storeMeta.getLatitude(); this.longitude = storeMeta.getLongitude(); - this.password = storeMeta.getPassword(); } public void delete() { diff --git a/src/test/java/upbrella/be/store/controller/StoreControllerTest.java b/src/test/java/upbrella/be/store/controller/StoreControllerTest.java index b1b685c3..ca99b104 100644 --- a/src/test/java/upbrella/be/store/controller/StoreControllerTest.java +++ b/src/test/java/upbrella/be/store/controller/StoreControllerTest.java @@ -238,7 +238,6 @@ void findAllStoreTest() throws Exception { .instagramId("instagramId") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .build())); // when @@ -302,9 +301,7 @@ void findAllStoreTest() throws Exception { fieldWithPath("stores[].longitude").type(JsonFieldType.NUMBER) .description("경도"), fieldWithPath("stores[].content").type(JsonFieldType.STRING) - .description("내용"), - fieldWithPath("stores[].password").type(JsonFieldType.STRING) - .description("비밀번호") + .description("내용") ))); } @@ -327,7 +324,6 @@ void createStoreTest() throws Exception { .latitude(33.33) .longitude(33.33) .content("내용") - .password("비밀번호") .businessHours( List.of( SingleBusinessHourRequest.builder() @@ -409,8 +405,6 @@ void createStoreTest() throws Exception { .description("경도"), fieldWithPath("content").type(JsonFieldType.STRING) .description("내용"), - fieldWithPath("password").type(JsonFieldType.STRING) - .description("비밀번호"), fieldWithPath("businessHours").type(JsonFieldType.ARRAY) .description("영업 시간"), fieldWithPath("businessHours[].date").type(JsonFieldType.STRING) @@ -440,7 +434,6 @@ void updateStoreTest() throws Exception { .latitude(33.33) .longitude(33.33) .content("내용") - .password("비밀번호") .businessHours(List.of( SingleBusinessHourRequest.builder() .date(DayOfWeek.MONDAY) @@ -497,9 +490,6 @@ void updateStoreTest() throws Exception { .description("경도"), fieldWithPath("content").type(JsonFieldType.STRING) .description("내용"), - fieldWithPath("password").type(JsonFieldType.STRING) - .description("비밀번호") - .optional(), fieldWithPath("businessHours").type(JsonFieldType.ARRAY) .description("영업 시간") .optional(), diff --git a/src/test/java/upbrella/be/store/entity/StoreMetaTest.java b/src/test/java/upbrella/be/store/entity/StoreMetaTest.java index dee120f2..d9b23ee9 100644 --- a/src/test/java/upbrella/be/store/entity/StoreMetaTest.java +++ b/src/test/java/upbrella/be/store/entity/StoreMetaTest.java @@ -48,7 +48,6 @@ void test() { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(List.of(businessHour)) .build(); diff --git a/src/test/java/upbrella/be/store/service/StoreDetailServiceTest.java b/src/test/java/upbrella/be/store/service/StoreDetailServiceTest.java index e6b4b476..982b0eb9 100644 --- a/src/test/java/upbrella/be/store/service/StoreDetailServiceTest.java +++ b/src/test/java/upbrella/be/store/service/StoreDetailServiceTest.java @@ -182,7 +182,6 @@ class StoreDetailNestedTest { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(businessHours) .build(); @@ -217,7 +216,6 @@ class StoreDetailNestedTest { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .umbrellaLocation("우산 위치") .businessHour("근무 시간") .instagramId("인스타그램 주소") @@ -253,7 +251,6 @@ void findAllTest() { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .umbrellaLocation("우산 위치") .businessHour("근무 시간") .instagramId("인스타그램 주소") @@ -342,7 +339,6 @@ class findStoreDetail { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(businessHours) .build(); @@ -481,7 +477,6 @@ void updateStoreTest() { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(businessHours) .build(); @@ -572,7 +567,6 @@ void updateStoreTest() { .latitude(44.44) .longitude(44.44) .content("내용 수정") - .password("비밀번호 수정") .build(); @@ -598,8 +592,7 @@ void updateStoreTest() { .hasFieldOrPropertyWithValue("category", request.getCategory()) .hasFieldOrPropertyWithValue("latitude", request.getLatitude()) .hasFieldOrPropertyWithValue("longitude", request.getLongitude()) - .hasFieldOrPropertyWithValue("category", request.getCategory()) - .hasFieldOrPropertyWithValue("password", request.getPassword()), + .hasFieldOrPropertyWithValue("category", request.getCategory()), () -> assertThat(foundStoreDetail) .hasFieldOrPropertyWithValue("umbrellaLocation", request.getUmbrellaLocation()) diff --git a/src/test/java/upbrella/be/store/service/StoreMetaServiceTest.java b/src/test/java/upbrella/be/store/service/StoreMetaServiceTest.java index b6f36494..32ec0a0c 100644 --- a/src/test/java/upbrella/be/store/service/StoreMetaServiceTest.java +++ b/src/test/java/upbrella/be/store/service/StoreMetaServiceTest.java @@ -329,7 +329,6 @@ class createStoreTest { .latitude(33.33) .longitude(33.33) .content("내용") - .password("비밀번호") .businessHours( List.of( SingleBusinessHourRequest.builder() @@ -398,7 +397,6 @@ void createNewStoreTest() { .category(store.getCategory()) .latitude(store.getLatitude()) .longitude(store.getLongitude()) - .password(store.getPassword()) .build(); StoreDetail storeDetail = StoreDetail.createForSave(store, storeMeta); @@ -458,7 +456,6 @@ void deleteStoreMetaTest() { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(List.of(businessHour)) .build(); @@ -520,7 +517,6 @@ void test() { .category("카테고리") .latitude(33.33) .longitude(33.33) - .password("비밀번호") .businessHours(List.of(businessHour)) .build(); From dbdf5aee2b46f161605827b864aeb89a79fa31aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EB=8F=99=ED=98=84?= Date: Tue, 19 Dec 2023 10:27:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EC=82=AC=EC=9A=A9=EB=90=98=EC=A7=80?= =?UTF-8?q?=20=EC=95=8A=EB=8A=94=20=ED=95=84=EB=93=9C=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20(#420)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 비밀번호는 보관함에서 생성하기 때문에 필드 삭제 --- .../be/store/repository/StoreDetailRepositoryImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/upbrella/be/store/repository/StoreDetailRepositoryImpl.java b/src/main/java/upbrella/be/store/repository/StoreDetailRepositoryImpl.java index 02a23710..9ac674b9 100644 --- a/src/main/java/upbrella/be/store/repository/StoreDetailRepositoryImpl.java +++ b/src/main/java/upbrella/be/store/repository/StoreDetailRepositoryImpl.java @@ -75,8 +75,7 @@ public List findAllStoresForAdmin() { storeDetail.instaUrl, storeDetail.storeMeta.latitude, storeDetail.storeMeta.longitude, - storeDetail.content, - storeDetail.storeMeta.password + storeDetail.content )) .from(storeDetail) .join(storeDetail.storeMeta, storeMeta) From 72325b7df9c874c4687c63f538d5f192f83a5e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EB=8F=99=ED=98=84?= Date: Tue, 19 Dec 2023 16:14:20 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20secret=20key=20=EC=B5=9C=EC=86=8C=20?= =?UTF-8?q?=EA=B8=B8=EC=9D=B4=20=EC=B6=94=EA=B0=80=20(#421)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit secret key 최소 길이 제한을 통해 우산 대여시 비밀번호로 인해 생기는 에러 제거 --- .../java/upbrella/be/store/controller/LockerController.java | 6 ++++-- .../upbrella/be/store/dto/request/CreateLockerRequest.java | 3 +++ .../upbrella/be/store/dto/request/UpdateLockerRequest.java | 3 +++ .../upbrella/be/store/controller/LockerControllerTest.java | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/upbrella/be/store/controller/LockerController.java b/src/main/java/upbrella/be/store/controller/LockerController.java index 997c444f..e1133a7a 100644 --- a/src/main/java/upbrella/be/store/controller/LockerController.java +++ b/src/main/java/upbrella/be/store/controller/LockerController.java @@ -9,6 +9,8 @@ import upbrella.be.store.dto.response.AllLockerResponse; import upbrella.be.util.CustomResponse; +import javax.validation.Valid; + @RestController @RequiredArgsConstructor public class LockerController { @@ -30,7 +32,7 @@ public ResponseEntity> getLockers() { } @PostMapping("/admin/lockers") - public ResponseEntity> createLocker(@RequestBody CreateLockerRequest request) { + public ResponseEntity> createLocker(@RequestBody @Valid CreateLockerRequest request) { lockerService.createLocker(request); @@ -44,7 +46,7 @@ public ResponseEntity> createLocker(@RequestBody CreateLock } @PatchMapping("/admin/lockers/{lockerId}") - public ResponseEntity> updateLocker(@PathVariable Long lockerId, @RequestBody UpdateLockerRequest request) { + public ResponseEntity> updateLocker(@PathVariable Long lockerId, @RequestBody @Valid UpdateLockerRequest request) { lockerService.updateLocker(lockerId, request); diff --git a/src/main/java/upbrella/be/store/dto/request/CreateLockerRequest.java b/src/main/java/upbrella/be/store/dto/request/CreateLockerRequest.java index 6b20884f..0b609a97 100644 --- a/src/main/java/upbrella/be/store/dto/request/CreateLockerRequest.java +++ b/src/main/java/upbrella/be/store/dto/request/CreateLockerRequest.java @@ -5,6 +5,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; +import javax.validation.constraints.Size; + @Getter @Builder @NoArgsConstructor @@ -12,5 +14,6 @@ public class CreateLockerRequest { private long storeId; + @Size(min = 32) private String secretKey; } diff --git a/src/main/java/upbrella/be/store/dto/request/UpdateLockerRequest.java b/src/main/java/upbrella/be/store/dto/request/UpdateLockerRequest.java index d090b4f2..9330aa58 100644 --- a/src/main/java/upbrella/be/store/dto/request/UpdateLockerRequest.java +++ b/src/main/java/upbrella/be/store/dto/request/UpdateLockerRequest.java @@ -5,6 +5,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; +import javax.validation.constraints.Size; + @Getter @Builder @NoArgsConstructor @@ -12,5 +14,6 @@ public class UpdateLockerRequest { private long storeId; + @Size(min = 32) private String secretKey; } diff --git a/src/test/java/upbrella/be/store/controller/LockerControllerTest.java b/src/test/java/upbrella/be/store/controller/LockerControllerTest.java index 5ab96ffc..06d8bb05 100644 --- a/src/test/java/upbrella/be/store/controller/LockerControllerTest.java +++ b/src/test/java/upbrella/be/store/controller/LockerControllerTest.java @@ -76,7 +76,7 @@ void createLockerTest() throws Exception { // given CreateLockerRequest request = CreateLockerRequest.builder() .storeId(1L) - .secretKey("secretKey") + .secretKey("12345678901234567890123456789012") .build(); // then @@ -102,7 +102,7 @@ void updateLockerTest() throws Exception { // given UpdateLockerRequest request = UpdateLockerRequest.builder() .storeId(1L) - .secretKey("secretKey") + .secretKey("12345678901234567890123456789012") .build(); Long lockerId = 1L;