Skip to content

Commit

Permalink
fix: secret key 최소 길이 추가 (#421)
Browse files Browse the repository at this point in the history
secret key 최소 길이 제한을 통해 우산 대여시 비밀번호로 인해 생기는 에러 제거
  • Loading branch information
birdieHyun authored Dec 19, 2023
1 parent dbdf5ae commit 72325b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
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 @@ -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 @@ -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

0 comments on commit 72325b7

Please sign in to comment.