From 1181e73217ea2e23a4829dde545079fcdc58ba20 Mon Sep 17 00:00:00 2001 From: Jin Hyuk Date: Sun, 30 Jun 2024 21:13:41 +0900 Subject: [PATCH] =?UTF-8?q?feat/#331=20:=20CreateFoodRequest=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exceed/dto/request/CreateFoodRequest.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/dto/request/CreateFoodRequest.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/dto/request/CreateFoodRequest.java index 71b0336c..27fe3e2f 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/dto/request/CreateFoodRequest.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/dto/request/CreateFoodRequest.java @@ -1,17 +1,22 @@ package com.gaebaljip.exceed.dto.request; +import com.gaebaljip.exceed.common.ValidationMessage; import lombok.Builder; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + public record CreateFoodRequest( - String name, - Double sugars, - Double dietaryFiber, - Double sodium, - Double calorie, - Double carbohydrate, - Double protein, - Double fat, - Double servingSize) { + @NotBlank(message = "이름을 " + ValidationMessage.NOT_BLANK) String name, + @NotNull(message = "당을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "당은" + ValidationMessage.MIN_0) Double sugars, + @NotNull(message = "식이섬유를 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "식이섬유는 " + ValidationMessage.MIN_0)Double dietaryFiber, + @NotNull(message = "나트륨을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "나트륨은 " + ValidationMessage.MIN_0)Double sodium, + @NotNull(message = "칼로리를 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "칼로리는 " + ValidationMessage.MIN_0)Double calorie, + @NotNull(message = "탄수화물을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "탄수화물은 " + ValidationMessage.MIN_0)Double carbohydrate, + @NotNull(message = "단백질을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "단백질은 " + ValidationMessage.MIN_0)Double protein, + @NotNull(message = "지방을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "지방은 " + ValidationMessage.MIN_0)Double fat, + @NotNull(message = "1회 제공량을 " + ValidationMessage.NOT_NULL) @Min(value = 0, message = "1회 제공량은 " + ValidationMessage.MIN_0)Double servingSize) { @Builder public CreateFoodRequest {} }