11package hansung .hansung_connect .domain .link .controller ;
22
3+ import hansung .hansung_connect .common .response .ApiResponse ;
34import hansung .hansung_connect .domain .link .dto .LinkRequestDTO ;
45import hansung .hansung_connect .domain .link .dto .LinkResponseDTO ;
5- import hansung .hansung_connect .domain .link .service .LinkService ;
6+ import hansung .hansung_connect .domain .link .service .LinkCommandService ;
67import io .swagger .v3 .oas .annotations .Operation ;
78import io .swagger .v3 .oas .annotations .tags .Tag ;
89import jakarta .validation .Valid ;
2223@ RequestMapping ("/links" )
2324public class LinkController {
2425
25- private final LinkService linkService ;
26+ private final LinkCommandService linkCommandService ;
2627
2728 @ Operation (
2829 summary = "링크 추가" ,
@@ -42,7 +43,7 @@ public ResponseEntity<LinkResponseDTO.LinkResultDTO> createLink(
4243 // 현재 개발 단계이므로 userId 고정함. 추후 수정 예정
4344 Long userId = 1L ;
4445
45- LinkResponseDTO .LinkResultDTO result = linkService .createLink (userId , request );
46+ LinkResponseDTO .LinkResultDTO result = linkCommandService .createLink (userId , request );
4647 return ResponseEntity .status (HttpStatus .CREATED ).body (result );
4748 }
4849
@@ -67,7 +68,25 @@ public ResponseEntity<LinkResponseDTO.LinkResultDTO> updateLink(
6768 @ Valid @ RequestBody LinkRequestDTO .UpdateLinkDTO request
6869 ) {
6970 Long userId = 1L ; // 개발 단계라 userId 고정
70- LinkResponseDTO .LinkResultDTO result = linkService .updateLink (userId , linkId , request );
71+ LinkResponseDTO .LinkResultDTO result = linkCommandService .updateLink (userId , linkId , request );
7172 return ResponseEntity .ok (result );
7273 }
74+
75+ @ Operation (
76+ summary = "외부링크 일괄 추가" ,
77+ description = """
78+ 여러 개의 외부 링크를 한 번에 추가합니다.
79+ - type: 링크 종류 (LINKEDIN, INSTAGRAM, GITHUB, NOTION, GOOGLE_DRIVE)
80+ - url: 유효한 링크 주소 (예: https://github.com/username)
81+ """
82+ )
83+ @ PostMapping ("/batch" )
84+ public ApiResponse <LinkResponseDTO .LinkResultListDTO > createLinksBatch (
85+ @ Valid @ RequestBody LinkRequestDTO .CreateLinksDTO request
86+ ) {
87+ // 임시로 userId 고정
88+ Long userId = 1L ;
89+ return ApiResponse .onSuccess (linkCommandService .createLinks (userId , request ));
90+ }
91+
7392}
0 commit comments