-
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.
Merge pull request #226 from Kernel360/refactor/file
Refactor: 파일 반환 dto optional로 변경
- Loading branch information
Showing
19 changed files
with
121 additions
and
137 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
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
46 changes: 0 additions & 46 deletions
46
Common/src/main/java/com/seveneleven/util/file/dto/FileMetadataDto.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Common/src/main/java/com/seveneleven/util/file/dto/FileMetadataResponse.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,44 @@ | ||
package com.seveneleven.util.file.dto; | ||
|
||
import com.seveneleven.entity.file.FileMetadata; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Optional; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class FileMetadataResponse { | ||
private Long id; //통합 파일 id | ||
private String category; //파일 카테고리 | ||
private Long referenceId; //참조 ID | ||
private String displayTitle; //유저에게 보여질 파일 이름 | ||
private String title; //저장된 파일 이름(UUID) | ||
private String contentType; //MIME 타입 | ||
private String format; //파일 확장자(포맷) | ||
private Double size; //파일 사이즈 | ||
private String path; //파일 경로 | ||
private Long createdBy; //등록자 ID | ||
private LocalDateTime createdAt; //등록일시 | ||
|
||
//Entity -> DTO | ||
public static Optional<FileMetadataResponse> toDto(FileMetadata metadata) { | ||
return Optional.ofNullable(metadata) | ||
.map(m -> { | ||
FileMetadataResponse dto = new FileMetadataResponse(); | ||
dto.id = m.getId(); | ||
dto.category = m.getCategory().name(); | ||
dto.referenceId = m.getReferenceId(); | ||
dto.displayTitle = m.getDisplayTitle(); | ||
dto.title = m.getTitle(); | ||
dto.contentType = m.getContentType(); | ||
dto.format = m.getFileFormat(); | ||
dto.size = m.getFileSize(); | ||
dto.path = m.getFilePath(); | ||
dto.createdBy = m.getCreatedBy(); | ||
dto.createdAt = m.getCreatedAt(); | ||
return dto; | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.