-
Notifications
You must be signed in to change notification settings - Fork 170
[5기 - 송인재] Spring Boot Part3 Weekly Mission 제출합니다. #971
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
base: IjjS
Are you sure you want to change the base?
Conversation
import java.util.UUID; | ||
|
||
public class Voucher { | ||
private final UUID voucherId; | ||
private final LocalDateTime createdAt; | ||
private final BigDecimal discountValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int,long으로 할수 없엇을까요?
import com.programmers.vouchermanagement.advice.annotation.AdminController; | ||
|
||
@ControllerAdvice(annotations = AdminController.class) | ||
public class GeneralAdvice { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공통된 애가 있으면 좋을거 같아요!
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice(annotations = RestController.class) | ||
public class RestAdvice { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeException으로 예상치 못한 예외를 방어해보면 어떨까요?
return "redirect:/customers/" + customer.customerId(); | ||
} | ||
|
||
@PostMapping("/{customerId}/delete") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete를 쓰시면 어떨까요?
return "customers/customer"; | ||
} | ||
|
||
@PostMapping("/update") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put이여야 하지 않을까요?
} | ||
|
||
@PostMapping | ||
@ResponseStatus(HttpStatus.CREATED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResponseEntity를 찾아보시고 한번 해보시면 어떨까요?
} | ||
|
||
@DeleteMapping("/{voucherId}") | ||
@ResponseStatus(HttpStatus.ACCEPTED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
내려줄 응답이 없다면 no_content가 status에 맞습니다.
|
||
@GetMapping | ||
@ResponseStatus(HttpStatus.OK) | ||
public List<VoucherResponse> readAllVouchers(String typeName, LocalDate startDate, LocalDate endDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 값들을 dto로 받으면 어떨까요?
validate도 자연스럽게 될꺼에요!
public record CreateVoucherRequest(BigDecimal discountValue, VoucherType voucherType) { | ||
public record CreateVoucherRequest( | ||
@Positive(message = "Discount value must be greater than 0.") long discountValue, | ||
@NotBlank(message = "Voucher type cannot be blank.") String voucherType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null인 경우 어떻게 될까요?
📌 과제 설명
바우처와 고객 서비스 관리페이지를 thymeleaf를 이용하여 개발했습니다.
프로젝트 디렉터리에 Dockerfile을 추가해두었습니다. 프로젝트 디렉터리에서 도커 이미지 빌드 후 실행 부탁드립니다.
테스트를 제외하고 4개의 프로파일이 있습니다.
콘솔 애플리케이션
웹 애플리케이션
👩💻 요구 사항과 구현 내용
(기본) 바우처 서비스 관리페이지 개발하기
(기본) 바우처 서비스의 API 개발하기
Spring MVC를 적용해서 JSON과 XML을 지원하는 REST API를 개발해보세요
(보너스) 바우처 지갑용 관리페이지를 만들어보세요.
Advice
Configuration
Customer
Voucher
✅ 피드백 반영사항
✅ PR 포인트 & 궁금한 점
라이브 리뷰 해주실 때 여쭤보겠습니다!!