Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Mar 19, 2024
1 parent 2190f9d commit 307ea13
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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();

}
Original file line number Diff line number Diff line change
@@ -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));
}

}

0 comments on commit 307ea13

Please sign in to comment.