Skip to content

Commit

Permalink
#47 [feat] 게시글 수정 validation
Browse files Browse the repository at this point in the history
#47 [feat] 게시글 수정 validation
  • Loading branch information
sohyundoh authored Jan 11, 2024
2 parents 9379d05 + 9bc50c7 commit f71020f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public SuccessResponse getAuthenticateWrite(
@Override
public SuccessResponse putPost(
@PathVariable final Long postId,
@RequestBody final PostPutRequest putRequest,
@Valid @RequestBody final PostPutRequest putRequest,
final Principal principal
) {
postService.updatePost(postId, Long.valueOf(principal.getName()), putRequest);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
package com.mile.post.service.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;

public record PostPutRequest(

@NotEmpty(message = "글감 id가 입력되지 않았습니다.")
@Schema(description = "글감 Id", example = "1")
Long topicId,

@NotBlank(message = "제목을 입력해주세요.")
@Size(max = 29, message = "제목 최대 글자를 초과했습니다.")
@Schema(description = "글 제목", example = "편안한 글쓰기")
String title,


@NotBlank(message = "내용을 입력해주세요.")
@Size(max = 2500, message = "내용 최대 글자를 초과했습니다.")
@Schema(description = "글 내용", example = "내용입니다.")
String content,

@NotBlank(message = "이미지 url을 입력해주세요.")
@Schema(description = "이미지 url", example = "String https://")
String imageUrl,

@NotEmpty(message = "익명 여부를 입력해주세요.")
@Schema(description = "익명 여부", example = "true")
boolean anonymous
) {
}

0 comments on commit f71020f

Please sign in to comment.