File tree Expand file tree Collapse file tree
src/main/java/com/semosan/api/domain/semofeed Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import com .semosan .api .common .response .PageResponse ;
55import com .semosan .api .common .status .SuccessStatus ;
66import com .semosan .api .domain .semofeed .controller .docs .SemoFeedControllerDocs ;
7+ import com .semosan .api .domain .semofeed .dto .SemoFeedCreateRequest ;
78import com .semosan .api .domain .semofeed .dto .SemoFeedEmojiRequest ;
89import com .semosan .api .domain .semofeed .dto .SemoFeedEmojiToggleResponse ;
910import com .semosan .api .domain .semofeed .dto .SemoFeedResponse ;
@@ -30,11 +31,12 @@ public class SemoFeedController implements SemoFeedControllerDocs {
3031
3132 @ PostMapping
3233 @ Override
34+ // @RequestBody String 대신 DTO를 사용해 Jackson이 JSON 따옴표를 제거한 뒤 imageUrl을 전달합니다.
3335 public ResponseEntity <ApiResponse <SemoFeedResponse >> create (
3436 @ AuthenticationPrincipal Long userId ,
35- @ RequestBody String imageUrl
37+ @ Valid @ RequestBody SemoFeedCreateRequest request
3638 ) {
37- SemoFeedResponse response = semoFeedService .create (userId , imageUrl );
39+ SemoFeedResponse response = semoFeedService .create (userId , request . imageUrl () );
3840 return ApiResponse .success (SuccessStatus .SEMOFEED_CREATE_SUCCESS , response );
3941 }
4042
Original file line number Diff line number Diff line change 22
33import com .semosan .api .common .response .ApiResponse ;
44import com .semosan .api .common .response .PageResponse ;
5+ import com .semosan .api .domain .semofeed .dto .SemoFeedCreateRequest ;
56import com .semosan .api .domain .semofeed .dto .SemoFeedEmojiRequest ;
67import com .semosan .api .domain .semofeed .dto .SemoFeedEmojiToggleResponse ;
78import com .semosan .api .domain .semofeed .dto .SemoFeedResponse ;
@@ -42,7 +43,7 @@ public interface SemoFeedControllerDocs {
4243 })
4344 ResponseEntity <ApiResponse <SemoFeedResponse >> create (
4445 @ AuthenticationPrincipal Long userId ,
45- @ RequestBody String imageUrl
46+ @ RequestBody SemoFeedCreateRequest request
4647 );
4748
4849 @ Operation (
Original file line number Diff line number Diff line change 1+ package com .semosan .api .domain .semofeed .dto ;
2+
3+ import jakarta .validation .constraints .NotBlank ;
4+
5+ /**
6+ * 세모피드 생성 요청 DTO.
7+ * {@code @RequestBody String} 대신 사용하여 Jackson이 JSON 문자열의 따옴표를 올바르게 제거하도록 한다.
8+ */
9+ public record SemoFeedCreateRequest (
10+ @ NotBlank (message = "imageUrl 은 필수입니다." )
11+ String imageUrl
12+ ) {
13+ }
You can’t perform that action at this time.
0 commit comments