Skip to content

Commit

Permalink
[feat] #66 validation 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdwns414 committed Jun 6, 2024
1 parent a00f0d5 commit 6f2fe6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.telepigeon.server.dto.worry.request.WorryCreateDto;
import com.telepigeon.server.dto.worry.response.WorriesDto;
import com.telepigeon.server.service.worry.WorryService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand All @@ -29,7 +30,7 @@ public ResponseEntity<WorriesDto> getWorries(
public ResponseEntity<Void> createWorry(
@UserId final Long userId,
@PathVariable final Long roomId,
@RequestBody final WorryCreateDto request
@RequestBody @Valid final WorryCreateDto request
) {
worryService.createWorry(userId, roomId, request);
return ResponseEntity.created(URI.create("/rooms/"+ roomId + "/worries")).build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.telepigeon.server.dto.worry.request;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import java.util.List;

public record WorryCreateDto (
@NotBlank
String name,
@NotBlank
String content,
@Size(min = 1)
List<String> times
) {
}

0 comments on commit 6f2fe6b

Please sign in to comment.