diff --git a/src/main/java/com/j9/bestmoments/util/FileNameGenerator.java b/src/main/java/com/j9/bestmoments/service/FileNameProvider.java similarity index 96% rename from src/main/java/com/j9/bestmoments/util/FileNameGenerator.java rename to src/main/java/com/j9/bestmoments/service/FileNameProvider.java index 918d0dd..728b5e8 100644 --- a/src/main/java/com/j9/bestmoments/util/FileNameGenerator.java +++ b/src/main/java/com/j9/bestmoments/service/FileNameProvider.java @@ -1,4 +1,4 @@ -package com.j9.bestmoments.util; +package com.j9.bestmoments.service; import com.j9.bestmoments.domain.Member; import com.j9.bestmoments.domain.Video; @@ -6,7 +6,7 @@ import java.time.format.DateTimeFormatter; import org.springframework.web.multipart.MultipartFile; -public final class FileNameGenerator { +public final class FileNameProvider { public static String generateProfileImageFileName(Member member, MultipartFile file) { String memberId = member.getId().toString(); diff --git a/src/main/java/com/j9/bestmoments/service/MemberService.java b/src/main/java/com/j9/bestmoments/service/MemberService.java index b5fe1bc..133aae5 100644 --- a/src/main/java/com/j9/bestmoments/service/MemberService.java +++ b/src/main/java/com/j9/bestmoments/service/MemberService.java @@ -6,9 +6,7 @@ import com.j9.bestmoments.domain.Member; import com.j9.bestmoments.repository.MemberRepository; import com.j9.bestmoments.service.storageService.StorageService; -import com.j9.bestmoments.util.FileNameGenerator; import jakarta.persistence.EntityNotFoundException; -import java.util.Optional; import java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -68,7 +66,7 @@ public Member update(Member member, MemberUpdateDto memberUpdateDto) { member.setDescription(memberUpdateDto.description()); } if (memberUpdateDto.file() != null) { - String fileName = FileNameGenerator.generateProfileImageFileName(member, memberUpdateDto.file()); + String fileName = FileNameProvider.generateProfileImageFileName(member, memberUpdateDto.file()); String profileImageUrl = googleCloudStorageService.uploadFile(memberUpdateDto.file(), fileName); member.setProfileImageUrl(profileImageUrl); } diff --git a/src/main/java/com/j9/bestmoments/service/VideoService.java b/src/main/java/com/j9/bestmoments/service/VideoService.java index eef68b0..c5fe77b 100644 --- a/src/main/java/com/j9/bestmoments/service/VideoService.java +++ b/src/main/java/com/j9/bestmoments/service/VideoService.java @@ -7,7 +7,6 @@ import com.j9.bestmoments.dto.request.VideoUpdateDto; import com.j9.bestmoments.repository.VideoRepository; import com.j9.bestmoments.service.storageService.LocalStorageService; -import com.j9.bestmoments.util.FileNameGenerator; import jakarta.persistence.EntityNotFoundException; import java.util.Arrays; import java.util.List; @@ -38,12 +37,12 @@ public Video upload(Member member, VideoCreateDto createDto) { .build(); // 원본 영상 - String originVideoName = FileNameGenerator.generateVideoFileName(video, createDto.video()); + String originVideoName = FileNameProvider.generateVideoFileName(video, createDto.video()); String originVideoUrl = storageService.uploadFile(createDto.video(), originVideoName); video.setVideoUrl(originVideoUrl); // 썸네일 이미지 - String thumbnailName = FileNameGenerator.generateThumbnailImageFileName(video, createDto.thumbnail()); + String thumbnailName = FileNameProvider.generateThumbnailImageFileName(video, createDto.thumbnail()); String thumbnailUrl = storageService.uploadFile(createDto.thumbnail(), thumbnailName); video.setThumbnailUrl(thumbnailUrl); @@ -72,7 +71,7 @@ public Video upload(Member member, VideoCreateDto createDto) { } private String uploadEncodedVideo(String videoUrl, String resolution) { - String encodedVideoUrl = FileNameGenerator.generateEncodedVideoFileName(videoUrl, resolution); + String encodedVideoUrl = FileNameProvider.generateEncodedVideoFileName(videoUrl, resolution); ffmpegService.encodeVideo(videoUrl, encodedVideoUrl, resolution); return encodedVideoUrl; } @@ -109,7 +108,7 @@ public Video findPublicById(UUID id) { @Transactional public Video update(Video video, VideoUpdateDto updateDto) { if (updateDto.thumbnail() != null) { - String thumbnailName = FileNameGenerator.generateThumbnailImageFileName(video, updateDto.thumbnail()); + String thumbnailName = FileNameProvider.generateThumbnailImageFileName(video, updateDto.thumbnail()); String thumbnailUrl = storageService.uploadFile(updateDto.thumbnail(), thumbnailName); video.setThumbnailUrl(thumbnailUrl); }