Skip to content
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
50 changes: 35 additions & 15 deletions src/main/java/org/fontory/fontorybe/font/domain/Font.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,40 @@ public Font update(FontUpdateDTO fontUpdateDTO) {
.build();
}

public Font updateProgress(FontProgressUpdateDTO fontProgressUpdateDTO) {
return Font.builder()
.name(this.getName())
.example(this.getExample())
.id(this.id)
.status(fontProgressUpdateDTO.getStatus())
.downloadCount(this.downloadCount)
.bookmarkCount(this.bookmarkCount)
.ttf(this.ttf)
.woff(this.woff)
.memberId(this.memberId)
.templateURL(this.templateURL)
.createdAt(this.createdAt)
.updatedAt(this.updatedAt)
.build();
public Font updateProgress(FontProgressUpdateDTO fontProgressUpdateDTO, Long fontId) {
String ttf = "https://fontory-font.s3.ap-northeast-2.amazonaws.com/" + fontId + ".ttf";
String woff = "https://fontory-font.s3.ap-northeast-2.amazonaws.com/" + fontId + ".woff";

if (fontProgressUpdateDTO.getStatus() == FontStatus.DONE) {
return Font.builder()
.name(this.getName())
.example(this.getExample())
.id(this.id)
.status(fontProgressUpdateDTO.getStatus())
.downloadCount(this.downloadCount)
.bookmarkCount(this.bookmarkCount)
.ttf(ttf)
.woff(woff)
.memberId(this.memberId)
.templateURL(this.templateURL)
.createdAt(this.createdAt)
.updatedAt(this.updatedAt)
.build();
} else {
return Font.builder()
.name(this.getName())
.example(this.getExample())
.id(this.id)
.status(fontProgressUpdateDTO.getStatus())
.downloadCount(this.downloadCount)
.bookmarkCount(this.bookmarkCount)
.ttf(this.ttf)
.woff(this.woff)
.memberId(this.memberId)
.templateURL(this.templateURL)
.createdAt(this.createdAt)
.updatedAt(this.updatedAt)
.build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
@AllArgsConstructor
public enum FontStatus {
PROGRESS("제작 중"),
DONE("제작 완료");
DONE("제작 완료"),
FAILED("제작 실패");

private final String key;
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public Font updateProgress(Long fontId, FontProgressUpdateDTO fontProgressUpdate
log.info("Service executing: Updating font ID: {}", fontId);
Font targetFont = getOrThrowById(fontId);

Font updatedFont = fontRepository.save(targetFont.updateProgress(fontProgressUpdateDTO));
Font updatedFont = fontRepository.save(targetFont.updateProgress(fontProgressUpdateDTO, fontId));
log.info("Service completed: Font ID: {} updated successfully", fontId);
return updatedFont;
}
Expand Down
Loading