-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DDING-15] presignedUrl contentType 지정 로직 추가 (#143)
- Loading branch information
Showing
20 changed files
with
307 additions
and
108 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
6 changes: 3 additions & 3 deletions
6
...ain/java/ddingdong/ddingdongBE/domain/filemetadata/service/FacadeFileMetaDataService.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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package ddingdong.ddingdongBE.domain.filemetadata.service; | ||
|
||
import ddingdong.ddingdongBE.domain.filemetadata.entity.FileMetaData; | ||
import java.util.UUID; | ||
import ddingdong.ddingdongBE.domain.filemetadata.service.dto.CreateFileMetaDataCommand; | ||
|
||
public interface FacadeFileMetaDataService { | ||
|
||
FileMetaData getFileUrlWithMetaData(UUID fileId); | ||
void create(CreateFileMetaDataCommand command); | ||
|
||
} |
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
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
56 changes: 56 additions & 0 deletions
56
src/main/java/ddingdong/ddingdongBE/file/service/ContentType.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,56 @@ | ||
package ddingdong.ddingdongBE.file.service; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ContentType { | ||
JPEG("image/jpeg", false, "jpg", "jpeg", "jpe", "jif", "jfif", "jfi"), | ||
PNG("image/png", false, "png"), | ||
GIF("image/gif", false, "gif"), | ||
WEBP("image/webp", false, "webp"), | ||
TIFF("image/tiff", false, "tiff", "tif"), | ||
BMP("image/bmp", false, "bmp"), | ||
SVG("image/svg+xml", false, "svg", "svgz"), | ||
ICO("image/x-icon", false, "ico"), | ||
HEIC("image/heic", false, "heic"), | ||
HEIF("image/heif", false, "heif"), | ||
RAW("image/x-raw", false, "raw", "arw", "cr2", "nrw", "k25"), | ||
PSD("image/vnd.adobe.photoshop", false, "psd"), | ||
PDF("application/pdf", false, "pdf"), | ||
MSWORD("application/msword", false, "doc"), | ||
DOCX("application/vnd.openxmlformats-officedocument.wordprocessingml.document", false, "docx"), | ||
EXCEL("application/vnd.ms-excel", false, "xls"), | ||
XLSX("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", false, "xlsx"), | ||
TEXT("text/plain", false, "txt"), | ||
HTML("text/html", false, "html"), | ||
MP4("video/mp4", true, "mp4"), | ||
WEBM("video/webm", true, "webm"), | ||
MOV("video/quicktime", true, "mov"), | ||
OCTET_STREAM("application/octet-stream", false); | ||
|
||
private final String mimeType; | ||
private final boolean isVideo; | ||
private final List<String> extensions; | ||
|
||
ContentType(String mimeType, boolean isVideo, String... extensions) { | ||
this.mimeType = mimeType; | ||
this.isVideo = isVideo; | ||
this.extensions = Arrays.asList(extensions); | ||
} | ||
|
||
public static ContentType fromExtension(String extension) { | ||
String lowerExtension = extension.toLowerCase(); | ||
for (ContentType contentType : values()) { | ||
if (contentType.extensions.contains(lowerExtension)) { | ||
return contentType; | ||
} | ||
} | ||
return OCTET_STREAM; | ||
} | ||
|
||
public boolean isVideo() { | ||
return this.isVideo; | ||
} | ||
} |
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
Oops, something went wrong.