11package com .example .log4u .domain .media .controller ;
22
3- import org .springframework .http .HttpStatus ;
43import org .springframework .http .ResponseEntity ;
54import org .springframework .security .core .annotation .AuthenticationPrincipal ;
6- import org .springframework .web .bind .annotation .DeleteMapping ;
7- import org .springframework .web .bind .annotation .GetMapping ;
8- import org .springframework .web .bind .annotation .PathVariable ;
95import org .springframework .web .bind .annotation .PostMapping ;
106import org .springframework .web .bind .annotation .RequestBody ;
117import org .springframework .web .bind .annotation .RequestMapping ;
128import org .springframework .web .bind .annotation .RestController ;
139
1410import com .example .log4u .common .oauth2 .dto .CustomOAuth2User ;
15- import com .example .log4u .domain .media .dto .MediaResponseDto ;
1611import com .example .log4u .domain .media .dto .PresignedUrlRequestDto ;
1712import com .example .log4u .domain .media .dto .PresignedUrlResponseDto ;
18- import com .example .log4u .domain .media .entity .Media ;
1913import com .example .log4u .domain .media .service .MediaService ;
2014import com .example .log4u .domain .media .service .S3Service ;
2115
@@ -39,22 +33,4 @@ public ResponseEntity<PresignedUrlResponseDto> getPresignedUrl(
3933 PresignedUrlResponseDto response = presignedUrlService .generatePresignedUrl (request );
4034 return ResponseEntity .ok (response );
4135 }
42-
43- @ GetMapping ("/{mediaId}" )
44- public ResponseEntity <MediaResponseDto > getMedia (
45- @ AuthenticationPrincipal CustomOAuth2User customOAuth2User ,
46- @ PathVariable Long mediaId
47- ) {
48- Media media = mediaService .getMediaById (mediaId );
49- return ResponseEntity .ok (MediaResponseDto .of (media ));
50- }
51-
52- @ DeleteMapping ("/{mediaId}" )
53- public ResponseEntity <Void > deleteMedia (
54- @ AuthenticationPrincipal CustomOAuth2User customOAuth2User ,
55- @ PathVariable Long mediaId
56- ) {
57- mediaService .deleteMediaById (mediaId );
58- return ResponseEntity .status (HttpStatus .NO_CONTENT ).build ();
59- }
6036}
0 commit comments