Spring Boot 3 + JPA 기반 가게(Store) CRUD 구현기 (with JWT, S3 업로드)
StoreRequest.java
)public record StoreRequest(
@Size(max = 30) String name,
@Size(max = 20) String category,
@Size(max = 255) String description,
@Pattern(regexp = "\\d{2,3}-\\d{3,4}-\\d{4}") String phone,
@Min(0) Integer minPrice,
@Pattern(regexp = "^\\d{2}:\\d{2}$") String shopOpen,
@Pattern(regexp = "^\\d{2}:\\d{2}$") String shopClose,
String address,
String storeImgUrl,
String status // "OPEN", "CLOSED", "TERMINATED"
) { ... }
StoreController
)@Operation(summary = "가게 생성", security = {@SecurityRequirement(name = "bearer-key")})
@PostMapping
public ResponseEntity<StoreResponse> createStore(
@Valid @RequestBody StoreRequest request,
Authentication authentication) {
User user = getUser(authentication);
StoreResponse response = storeService.createStore(request, user);
return ResponseEntity.ok(response);
}
NO_AUTH_FOR_STORE_CREATION
→ 사장님 권한 아님TOO_MANY_STORES
→ 3개 초과 운영 시Spring Boot 3로 넘어오면서 S3 SDK 버전도 바뀌면서 다시 기억을 되새길 수 있어 좋앗습니다.
Swagger를 활용한 문서화, Redis 블랙리스트 검사 등도 함께 다뤄볼 수 있어 유익했습니다.