Skip to content

Commit

Permalink
[BE] refactor: dto 에 Nullable, validation 어노테이션 적용 (#410)
Browse files Browse the repository at this point in the history
* refactor: 스프링 validation 어노테이션 추가

* refactor: Nullable 어노테이션 추가

* refactor: NotNull 추가

* refactor: NotNull에 메세지 추가
  • Loading branch information
nayonsoso authored Aug 19, 2024
1 parent 40f5e98 commit 5631b40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package reviewme.review.service.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import java.util.List;

@Schema(name = "리뷰 답변 내용")
public record CreateReviewAnswerRequest(

@Schema(description = "질문 ID")
long questionId,
@NotNull(message = "질문 ID를 입력해주세요.")
Long questionId,

@Schema(description = "선택된 옵션 ID 목록", nullable = true)
@Nullable
List<Long> selectedOptionIds,

@Schema(description = "답변 내용", nullable = true)
@Nullable
String text
) {
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package reviewme.review.service.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;

@Schema(name = "리뷰 생성 요청")
public record CreateReviewRequest(

@Schema(description = "리뷰 요청 코드")
@NotBlank(message = "리뷰 요청 코드를 입력해주세요.")
String reviewRequestCode,

@Schema(description = "답변 목록")
@NotEmpty(message = "답변 내용을 입력해주세요.")
List<CreateReviewAnswerRequest> answers
) {
}

0 comments on commit 5631b40

Please sign in to comment.