-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 프로필 이미지 저장 시 Storage 내 별도의 폴더에 저장
- Loading branch information
Showing
5 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/j9/bestmoments/util/FileNameGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.j9.bestmoments.util; | ||
|
||
import com.j9.bestmoments.domain.Member; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public final class FileNameGenerator { | ||
|
||
public static String generateProfileImageFileName(Member member) { | ||
String memberId = member.getId().toString(); | ||
String dateString = generateDateString(); | ||
return String.format("profile/%s/%s", memberId, dateString); | ||
} | ||
|
||
private static String generateDateString() { | ||
LocalDateTime now = LocalDateTime.now(); | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); | ||
return now.format(formatter); | ||
} | ||
|
||
} |