From 307ea13a33a586a3b08211b0c678991fb149f400 Mon Sep 17 00:00:00 2001 From: 101 Date: Tue, 19 Mar 2024 23:17:38 +0900 Subject: [PATCH] refactor --- .../auth/usecase/service/SignupService.java | 1 + .../domain/common/DefaultProfile.java | 37 ++-------------- .../domain/common/DefaultProfileImpl.java | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfileImpl.java diff --git a/daemawiki-api/src/main/java/org/daemawiki/domain/auth/usecase/service/SignupService.java b/daemawiki-api/src/main/java/org/daemawiki/domain/auth/usecase/service/SignupService.java index d69f5a56..2653db7d 100644 --- a/daemawiki-api/src/main/java/org/daemawiki/domain/auth/usecase/service/SignupService.java +++ b/daemawiki-api/src/main/java/org/daemawiki/domain/auth/usecase/service/SignupService.java @@ -3,6 +3,7 @@ import org.daemawiki.domain.auth.dto.request.SignupRequest; import org.daemawiki.domain.auth.usecase.SignupUsecase; import org.daemawiki.domain.common.DefaultProfile; +import org.daemawiki.domain.common.DefaultProfileImpl; import org.daemawiki.domain.document.usecase.CreateDocumentUsecase; import org.daemawiki.domain.mail.application.mail.DeleteAuthMailPort; import org.daemawiki.domain.mail.application.mail.GetAuthMailPort; diff --git a/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfile.java b/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfile.java index 7cb299ee..c58fe92b 100644 --- a/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfile.java +++ b/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfile.java @@ -1,40 +1,9 @@ package org.daemawiki.domain.common; import org.daemawiki.domain.file.model.File; -import org.daemawiki.domain.file.model.FileDetail; -import org.daemawiki.domain.file.model.type.FileType; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import java.util.UUID; - -@Component -public class DefaultProfile { - - @Value("${profile.image.url}") - private String defaultImageURL; - - @Value("${profile.image.id}") - private UUID defaultImageId; - - @Value("${profile.image.name}") - private String defaultImageName; - - @Value("${profile.image.type}") - private String defaultImageType; - - public final File defaultProfile() { - return File.create(defaultImageId, - defaultImageName, - defaultImageType, - FileDetail.create(FileType.PROFILE, defaultImageURL)); - } - - public final File defaultDocumentImage() { - return File.create(defaultImageId, - defaultImageName, - defaultImageType, - FileDetail.create(FileType.DOCUMENT, defaultImageURL)); - } +public interface DefaultProfile { + File defaultProfile(); + File defaultDocumentImage(); } diff --git a/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfileImpl.java b/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfileImpl.java new file mode 100644 index 00000000..e5ff110b --- /dev/null +++ b/daemawiki-api/src/main/java/org/daemawiki/domain/common/DefaultProfileImpl.java @@ -0,0 +1,42 @@ +package org.daemawiki.domain.common; + +import org.daemawiki.domain.file.model.File; +import org.daemawiki.domain.file.model.FileDetail; +import org.daemawiki.domain.file.model.type.FileType; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.UUID; + +@Component +public class DefaultProfileImpl implements DefaultProfile { + + @Value("${profile.image.url}") + private String defaultImageURL; + + @Value("${profile.image.id}") + private UUID defaultImageId; + + @Value("${profile.image.name}") + private String defaultImageName; + + @Value("${profile.image.type}") + private String defaultImageType; + + @Override + public final File defaultProfile() { + return File.create(defaultImageId, + defaultImageName, + defaultImageType, + FileDetail.create(FileType.PROFILE, defaultImageURL)); + } + + @Override + public final File defaultDocumentImage() { + return File.create(defaultImageId, + defaultImageName, + defaultImageType, + FileDetail.create(FileType.DOCUMENT, defaultImageURL)); + } + +}