Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.3.1 release #423

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -30,7 +32,7 @@ public ResponseEntity<CustomResponse<AllLockerResponse>> getLockers() {
}

@PostMapping("/admin/lockers")
public ResponseEntity<CustomResponse<Void>> createLocker(@RequestBody CreateLockerRequest request) {
public ResponseEntity<CustomResponse<Void>> createLocker(@RequestBody @Valid CreateLockerRequest request) {

lockerService.createLocker(request);

Expand All @@ -44,7 +46,7 @@ public ResponseEntity<CustomResponse<Void>> createLocker(@RequestBody CreateLock
}

@PatchMapping("/admin/lockers/{lockerId}")
public ResponseEntity<CustomResponse<Void>> updateLocker(@PathVariable Long lockerId, @RequestBody UpdateLockerRequest request) {
public ResponseEntity<CustomResponse<Void>> updateLocker(@PathVariable Long lockerId, @RequestBody @Valid UpdateLockerRequest request) {

lockerService.updateLocker(lockerId, request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Size;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateLockerRequest {

private long storeId;
@Size(min = 32)
private String secretKey;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ public class CreateStoreRequest {
@Range(min = -180, max = 180)
private double longitude;
private String content;
private String password;
private List<SingleBusinessHourRequest> businessHours;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Size;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UpdateLockerRequest {

private long storeId;
@Size(min = 32)
private String secretKey;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ public class UpdateStoreRequest {
@Range(min = -180, max = 180)
private double longitude;
private String content;
private String password;
private List<SingleBusinessHourRequest> businessHours;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.querydsl.core.annotations.QueryProjection;
import lombok.*;
import upbrella.be.store.entity.StoreDetail;

import java.io.Serializable;

Expand All @@ -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;
Expand All @@ -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;
}
}
4 changes: 0 additions & 4 deletions src/main/java/upbrella/be/store/entity/StoreMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class StoreMeta {
private String category;
private double latitude;
private double longitude;
private String password;
@OneToMany(mappedBy = "storeMeta")
private List<BusinessHour> businessHours;

Expand All @@ -46,7 +45,6 @@ public static StoreMeta createStoreMetaForSave(CreateStoreRequest request, Class
.category(request.getCategory())
.latitude(request.getLatitude())
.longitude(request.getLongitude())
.password(request.getPassword())
.build();
}

Expand All @@ -60,7 +58,6 @@ public static StoreMeta createStoreMetaForUpdate(UpdateStoreRequest request, Cla
.category(request.getCategory())
.latitude(request.getLatitude())
.longitude(request.getLongitude())
.password(request.getPassword())
.build();
}

Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public List<SingleStoreResponse> findAllStoresForAdmin() {
storeDetail.instaUrl,
storeDetail.storeMeta.latitude,
storeDetail.storeMeta.longitude,
storeDetail.content,
storeDetail.storeMeta.password
storeDetail.content
))
.from(storeDetail)
.join(storeDetail.storeMeta, storeMeta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void createLockerTest() throws Exception {
// given
CreateLockerRequest request = CreateLockerRequest.builder()
.storeId(1L)
.secretKey("secretKey")
.secretKey("12345678901234567890123456789012")
.build();

// then
Expand All @@ -102,7 +102,7 @@ void updateLockerTest() throws Exception {
// given
UpdateLockerRequest request = UpdateLockerRequest.builder()
.storeId(1L)
.secretKey("secretKey")
.secretKey("12345678901234567890123456789012")
.build();
Long lockerId = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ void findAllStoreTest() throws Exception {
.instagramId("instagramId")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.build()));

// when
Expand Down Expand Up @@ -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("내용")
)));
}

Expand All @@ -327,7 +324,6 @@ void createStoreTest() throws Exception {
.latitude(33.33)
.longitude(33.33)
.content("내용")
.password("비밀번호")
.businessHours(
List.of(
SingleBusinessHourRequest.builder()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -440,7 +434,6 @@ void updateStoreTest() throws Exception {
.latitude(33.33)
.longitude(33.33)
.content("내용")
.password("비밀번호")
.businessHours(List.of(
SingleBusinessHourRequest.builder()
.date(DayOfWeek.MONDAY)
Expand Down Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion src/test/java/upbrella/be/store/entity/StoreMetaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void test() {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(List.of(businessHour))
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class StoreDetailNestedTest {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(businessHours)
.build();

Expand Down Expand Up @@ -217,7 +216,6 @@ class StoreDetailNestedTest {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.umbrellaLocation("우산 위치")
.businessHour("근무 시간")
.instagramId("인스타그램 주소")
Expand Down Expand Up @@ -253,7 +251,6 @@ void findAllTest() {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.umbrellaLocation("우산 위치")
.businessHour("근무 시간")
.instagramId("인스타그램 주소")
Expand Down Expand Up @@ -342,7 +339,6 @@ class findStoreDetail {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(businessHours)
.build();

Expand Down Expand Up @@ -481,7 +477,6 @@ void updateStoreTest() {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(businessHours)
.build();

Expand Down Expand Up @@ -572,7 +567,6 @@ void updateStoreTest() {
.latitude(44.44)
.longitude(44.44)
.content("내용 수정")
.password("비밀번호 수정")
.build();


Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ class createStoreTest {
.latitude(33.33)
.longitude(33.33)
.content("내용")
.password("비밀번호")
.businessHours(
List.of(
SingleBusinessHourRequest.builder()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -458,7 +456,6 @@ void deleteStoreMetaTest() {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(List.of(businessHour))
.build();

Expand Down Expand Up @@ -520,7 +517,6 @@ void test() {
.category("카테고리")
.latitude(33.33)
.longitude(33.33)
.password("비밀번호")
.businessHours(List.of(businessHour))
.build();

Expand Down