Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 파일 및 스크린샷 업로드 날짜 저장 #137

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public Long createCard(Long memberId, CardCreateRequestDto requestDto) {
.screenshotKey(screenshotService.createKey(memberId, screenshotInfo.getScreenshotUploadDate(), screenshotInfo.getScreenshotUUID().toString(),
screenshotInfo.getScreenshotName()))
.url(screenshotService.findUrl(memberId, screenshotInfo))
.uploadDate(screenshotInfo.getScreenshotUploadDate())
.card(savedCard)
.build();

Expand All @@ -151,6 +152,7 @@ public Long createCard(Long memberId, CardCreateRequestDto requestDto) {
, fileInfo.getFileOriginalName()))
.originalName(fileInfo.getFileOriginalName())
.changedName(fileInfo.getFileChangedName())
.uploadDate(fileInfo.getFileUploadDate())
.size(fileInfo.getSize())
.card(savedCard)
.build();
Expand Down Expand Up @@ -193,6 +195,7 @@ public void updateCard(Long memberId, Long cardId, CardUpdateRequestDto requestD
.screenshotKey(screenshotService.createKey(memberId, screenshotInfo.getScreenshotUploadDate(), screenshotInfo.getScreenshotUUID().toString(),
screenshotInfo.getScreenshotName()))
.url(screenshotService.findUrl(memberId, screenshotInfo))
.uploadDate(screenshotInfo.getScreenshotUploadDate())
.card(card)
.build();

Expand All @@ -206,6 +209,7 @@ public void updateCard(Long memberId, Long cardId, CardUpdateRequestDto requestD
, fileInfo.getFileOriginalName()))
.originalName(fileInfo.getFileOriginalName())
.changedName(fileInfo.getFileChangedName())
.uploadDate(fileInfo.getFileUploadDate())
.size(fileInfo.getSize())
.card(card)
.build();
Expand Down Expand Up @@ -262,13 +266,13 @@ private List<KeywordGetResponseDto> getKeywordDtoList(Long cardId) {
private List<ScreenshotGetResponseDto> getScreenshotDtoList(Long cardId) {
return cardRepository.findByIdOrThrow(cardId).getScreenshots().stream()
.map(screenshot -> ScreenshotGetResponseDto
.of(screenshot.getId(), screenshot.getUrl(), getStickerDtoList(screenshot.getId())))
.of(screenshot.getId(), screenshot.getUrl(), screenshot.getUploadDate(), getStickerDtoList(screenshot.getId())))
.collect(Collectors.toList());
}

private List<FileGetResponseDto> getFileDtoList(Long cardId) {
return cardRepository.findByIdOrThrow(cardId).getFiles().stream()
.map(file -> FileGetResponseDto.of(file.getId(), file.getOriginalName(), file.getChangedName(), file.getSize()))
.map(file -> FileGetResponseDto.of(file.getId(), file.getOriginalName(), file.getChangedName(), file.getUploadDate(), file.getSize()))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class File extends BaseEntity {
@Column(nullable = false, name = "file_key")
private String fileKey;

@Column(nullable = false)
private String uploadDate;

@Column(nullable = false)
private int size;

Expand All @@ -37,11 +40,13 @@ public class File extends BaseEntity {
private Card card;

@Builder
public File(UUID id, String originalName, String changedName, String fileKey, int size, Card card) {
public File(UUID id, String originalName, String changedName, String fileKey,
String uploadDate, int size, Card card) {
this.id = id;
this.originalName = originalName;
this.changedName = changedName;
this.fileKey = fileKey;
this.uploadDate = uploadDate;
this.card = card;
this.size = size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class FileGetResponseDto {
@Schema(description = "파일 변경된 이름", example = "카테고리_업무_세부업무_와이어프레임 사용법.pdf")
private String changedName;

@Schema(description = "파일 업로드 일자", example = "2023/08/23")
private String uploadDate;

@Schema(description = "파일 사이즈 (KB 단위로 저장)", example = "189277")
private int size;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class Screenshot extends BaseEntity {
@Column(nullable = false, name = "screenshot_key")
private String screenshotKey;

@Column(nullable = false)
private String uploadDate;

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "card_id")
private Card card;
Expand All @@ -38,10 +41,11 @@ public class Screenshot extends BaseEntity {
private List<Sticker> sticker = new ArrayList<>();

@Builder
public Screenshot(UUID id, String url, String screenshotKey, Card card) {
public Screenshot(UUID id, String url, String screenshotKey, String uploadDate, Card card) {
this.id = id;
this.url = url;
this.screenshotKey =screenshotKey;
this.uploadDate = uploadDate;
this.card = card;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class ScreenshotGetResponseDto {
@Schema(description = "스크린샷 url", example = "https://abde.s3.ap-northeast-2.amazonaws.com/1.png")
private String url;

@Schema(description = "스크린샷 업로드 일자", example = "2023/08/23")
private String uploadDate;

@Schema(description = "번호 스티커")
private List<StickerGetResponseDto> stickerList;
}
Loading