File tree Expand file tree Collapse file tree
src/main/java/team/marco/voucher_management_system/web_app Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package team .marco .voucher_management_system .web_app .controller ;
22
3+ import jakarta .validation .Valid ;
34import java .time .LocalDateTime ;
45import java .util .List ;
56import java .util .Optional ;
@@ -38,7 +39,7 @@ public List<Voucher> findAll() {
3839 }
3940
4041 @ PostMapping
41- public ResponseEntity <Voucher > create (CreateVoucherRequest createVoucherRequest ) {
42+ public ResponseEntity <Voucher > create (@ Valid CreateVoucherRequest createVoucherRequest ) {
4243 Voucher voucher = voucherService .create (createVoucherRequest );
4344
4445 return ResponseEntity .ok (voucher );
Original file line number Diff line number Diff line change 11package team .marco .voucher_management_system .web_app .dto ;
22
3+ import jakarta .validation .constraints .NotNull ;
4+ import jakarta .validation .constraints .Positive ;
35import team .marco .voucher_management_system .type_enum .VoucherType ;
46
57public record CreateVoucherRequest (
8+ @ NotNull
69 VoucherType type ,
10+ @ Positive
711 int data ) {
812}
You can’t perform that action at this time.
0 commit comments