6
6
7
7
import org .springframework .http .HttpStatus ;
8
8
import org .springframework .http .ResponseEntity ;
9
+ import org .springframework .validation .annotation .Validated ;
9
10
import org .springframework .web .bind .annotation .DeleteMapping ;
10
11
import org .springframework .web .bind .annotation .GetMapping ;
11
12
import org .springframework .web .bind .annotation .PatchMapping ;
23
24
import com .moco .moco .service .post .PostService ;
24
25
25
26
import jakarta .validation .Valid ;
27
+ import jakarta .validation .constraints .Max ;
26
28
import lombok .AllArgsConstructor ;
27
29
import lombok .extern .slf4j .Slf4j ;
28
30
29
31
@ Slf4j
30
32
@ AllArgsConstructor
31
33
@ RestController
34
+ @ Validated
32
35
public class PostController {
33
36
private final PostService postService ;
34
37
@@ -39,7 +42,7 @@ public class PostController {
39
42
@ GetMapping ("/public/posts" )
40
43
public ResponseEntity <PostDto .Response > getPosts (
41
44
@ RequestParam (value = "offset" , required = false , defaultValue = OFFSET ) Integer offset ,
42
- @ RequestParam (value = "limit" , required = false , defaultValue = LIMIT ) Integer limit ,
45
+ @ RequestParam (value = "limit" , required = false , defaultValue = LIMIT ) @ Max ( value = 100 ) Integer limit ,
43
46
@ RequestParam (value = "recruit" , required = false , defaultValue = RECRUIT ) String recruit ,
44
47
@ RequestParam (value = "username" , required = false ) String username ,
45
48
@ RequestParam (value = "type" , required = false ) String type ,
@@ -55,7 +58,7 @@ public ResponseEntity<PostDto.Response> getPosts(
55
58
@ GetMapping ("/private/posts" )
56
59
public ResponseEntity <PostDto .Response > getMyBookmarkPosts (
57
60
@ RequestParam (value = "offset" , required = false , defaultValue = OFFSET ) Integer offset ,
58
- @ RequestParam (value = "limit" , required = false , defaultValue = LIMIT ) Integer limit ,
61
+ @ RequestParam (value = "limit" , required = false , defaultValue = LIMIT ) @ Max ( 100 ) Integer limit ,
59
62
@ RequestParam (value = "recruit" , required = false , defaultValue = RECRUIT ) String recruit ,
60
63
@ CurrentLoginUser UserInfo userInfo ) {
61
64
PostDto .Response postDto = postService .getMyBookmarkPosts (offset , limit , recruit , userInfo .getId ());
0 commit comments