Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
validation 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Feb 29, 2024
1 parent 8d05967 commit 412992d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.daemawiki.domain.content.dto.WriteContentRequest;
import com.example.daemawiki.domain.content.service.AddContentTable;
import com.example.daemawiki.domain.content.service.WriteContent;
import jakarta.validation.Valid;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
Expand All @@ -21,7 +22,7 @@ public DocumentContentController(WriteContent writeContentService, AddContentTab

@PatchMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
public Mono<Void> writeContent(@RequestBody WriteContentRequest request) {
public Mono<Void> writeContent(@Valid @RequestBody WriteContentRequest request) {
return writeContentService.execute(request);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package com.example.daemawiki.domain.content.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public record WriteContentRequest(
@NotBlank(message = "문서의 id를 입력해주세요.")
String documentId,
@NotBlank(message = "내용을 추가하고 싶은 index를 입력해주세요.")
String index,
@NotNull(message = "null은 내용이 될 수 없습니다.")
String content,
@NotNull(message = "문서의 버전을 입력해주세요.")
Integer version
) {
}

0 comments on commit 412992d

Please sign in to comment.