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 Apr 2, 2024
1 parent a6673d1 commit 3fd5ec8
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 66 deletions.
9 changes: 1 addition & 8 deletions daemawiki-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,4 @@ cloud:
region:
static: ap-northeast-2
stack:
auto: false

profile:
image:
url: ${DEFAULT_PROFILE_IMAGE}
id: ${DEFAULT_PROFILE_ID}
name: ${DEFAULT_PROFILE_NAME}
type: ${DEFAULT_PROFILE_TYPE}
auto: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.daemawiki.config;

import lombok.Getter;
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.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.UUID;

@Getter
@Component
@ConfigurationProperties(prefix = "profile.image")
public class DefaultProfileConfig {
private String url;
private UUID id;
private String name;
private String type;

public final File defaultUserProfile() {
return File.create(id,
name,
type,
FileDetail.create(FileType.PROFILE, url));
}

public final File defaultDocumentImage() {
return File.create(id,
name,
type,
FileDetail.create(FileType.DOCUMENT, url));
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.daemawiki.domain.auth.usecase.service;

import org.daemawiki.config.DefaultProfileConfig;
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.document.usecase.CreateDocumentUsecase;
import org.daemawiki.domain.mail.application.mail.DeleteAuthMailPort;
import org.daemawiki.domain.mail.application.mail.GetAuthMailPort;
Expand All @@ -27,9 +27,9 @@ public class SignupService implements SignupUsecase {
private final PasswordEncoder passwordEncoder;
private final GetMajorType getMajorType;
private final CreateDocumentUsecase createDocumentUsecase;
private final DefaultProfile defaultProfile;
private final DefaultProfileConfig defaultProfile;

public SignupService(GetUserPort getUserPort, SaveUserPort saveUserPort, GetAuthMailPort getAuthMailPort, DeleteAuthMailPort deleteAuthMailPort, PasswordEncoder passwordEncoder, GetMajorType getMajorType, CreateDocumentUsecase createDocumentUsecase, DefaultProfile defaultProfile) {
public SignupService(GetUserPort getUserPort, SaveUserPort saveUserPort, GetAuthMailPort getAuthMailPort, DeleteAuthMailPort deleteAuthMailPort, PasswordEncoder passwordEncoder, GetMajorType getMajorType, CreateDocumentUsecase createDocumentUsecase, DefaultProfileConfig defaultProfile) {
this.getUserPort = getUserPort;
this.saveUserPort = saveUserPort;
this.getAuthMailPort = getAuthMailPort;
Expand Down Expand Up @@ -90,7 +90,7 @@ private Mono<User> createUser(SignupRequest request, String password) {
.name(request.name())
.email(request.email())
.password(password)
.profile(defaultProfile.defaultProfile())
.profile(defaultProfile.defaultUserProfile())
.detail(UserDetail.builder()
.gen(request.gen())
.major(getMajorType.execute(request.major().toLowerCase()))
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.daemawiki.domain.document.component.facade;

import org.daemawiki.config.DefaultProfileConfig;
import org.daemawiki.datetime.model.EditDateTime;
import org.daemawiki.domain.common.DefaultProfile;
import org.daemawiki.domain.content.model.Content;
import org.daemawiki.domain.document.dto.request.SaveDocumentRequest;
import org.daemawiki.domain.document.model.DefaultDocument;
Expand All @@ -20,9 +20,9 @@

@Component
public class CreateDocumentFacadeImpl implements CreateDocumentFacade{
private final DefaultProfile defaultProfile;
private final DefaultProfileConfig defaultProfile;

public CreateDocumentFacadeImpl(DefaultProfile defaultProfile) {
public CreateDocumentFacadeImpl(DefaultProfileConfig defaultProfile) {
this.defaultProfile = defaultProfile;
}

Expand Down
6 changes: 6 additions & 0 deletions daemawiki-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
profile:
image:
url: ${DEFAULT_PROFILE_IMAGE}
id: ${DEFAULT_PROFILE_ID}
name: ${DEFAULT_PROFILE_NAME}
type: ${DEFAULT_PROFILE_TYPE}

0 comments on commit 3fd5ec8

Please sign in to comment.