diff --git a/src/main/java/com/example/daemawiki/domain/auth/dto/request/SignupRequest.java b/src/main/java/com/example/daemawiki/domain/auth/dto/request/SignupRequest.java index a22b7644..3c5ba0b0 100644 --- a/src/main/java/com/example/daemawiki/domain/auth/dto/request/SignupRequest.java +++ b/src/main/java/com/example/daemawiki/domain/auth/dto/request/SignupRequest.java @@ -17,6 +17,8 @@ public record SignupRequest( Integer gen, @NotBlank(message = "전공을 입력해주세요.") String major, + @NotBlank(message = "동아리를 입력해주세요.") + String club, @NotBlank(message = "비밀번호를 입력해주세요.") @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d!@#$%^&*()-=_+]*$", message = "비밀번호 형식이 올바르지 않습니다.") diff --git a/src/main/java/com/example/daemawiki/domain/auth/service/Signup.java b/src/main/java/com/example/daemawiki/domain/auth/service/Signup.java index b458a182..16c8f390 100644 --- a/src/main/java/com/example/daemawiki/domain/auth/service/Signup.java +++ b/src/main/java/com/example/daemawiki/domain/auth/service/Signup.java @@ -5,6 +5,7 @@ import com.example.daemawiki.domain.file.model.DefaultProfile; import com.example.daemawiki.domain.mail.repository.AuthMailRepository; import com.example.daemawiki.domain.user.model.User; +import com.example.daemawiki.domain.user.model.UserDetail; import com.example.daemawiki.domain.user.model.type.major.component.GetMajorType; import com.example.daemawiki.domain.user.repository.UserRepository; import com.example.daemawiki.global.exception.h403.UnVerifiedEmailException; @@ -51,8 +52,11 @@ public Mono execute(SignupRequest request) { .email(request.email()) .password(password) .profile(defaultProfile.defaultProfile()) - .gen(request.gen()) - .major(getMajorType.execute(request.major())) + .detail(UserDetail.builder() + .gen(request.gen()) + .major(getMajorType.execute(request.major())) + .club(request.club()) + .build()) .build(); return userRepository.save(user) diff --git a/src/main/java/com/example/daemawiki/domain/user/model/User.java b/src/main/java/com/example/daemawiki/domain/user/model/User.java index e8c60258..a02c6c32 100644 --- a/src/main/java/com/example/daemawiki/domain/user/model/User.java +++ b/src/main/java/com/example/daemawiki/domain/user/model/User.java @@ -1,7 +1,6 @@ package com.example.daemawiki.domain.user.model; import com.example.daemawiki.domain.file.model.File; -import com.example.daemawiki.domain.user.model.type.major.MajorType; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Builder; import lombok.Getter; @@ -28,20 +27,17 @@ public class User { private File profile; - private Integer gen; - - private MajorType major; + private UserDetail detail; private String documentId; @Builder - public User(String name, String email, String password, File profile, Integer gen, MajorType major, String documentId) { + public User(String name, String email, String password, File profile, UserDetail detail, String documentId) { this.name = name; this.email = email; this.password = password; this.profile = profile; - this.gen = gen; - this.major = major; + this.detail = detail; this.documentId = documentId; } diff --git a/src/main/java/com/example/daemawiki/domain/user/repository/UserRepository.java b/src/main/java/com/example/daemawiki/domain/user/repository/UserRepository.java index 90b9dcfb..f0ed7f1d 100644 --- a/src/main/java/com/example/daemawiki/domain/user/repository/UserRepository.java +++ b/src/main/java/com/example/daemawiki/domain/user/repository/UserRepository.java @@ -9,7 +9,7 @@ public interface UserRepository extends ReactiveMongoRepository { Mono findByEmail(String email); - Flux findAllByGenOrderByNameAsc(Integer gen); + Flux findAllByDetail_GenOrderByNameAsc(Integer gen); - Flux findAllByMajorOrderByNameAsc(MajorType major); + Flux findAllByDetail_MajorOrderByNameAsc(MajorType major); } diff --git a/src/main/java/com/example/daemawiki/domain/user/service/GetUser.java b/src/main/java/com/example/daemawiki/domain/user/service/GetUser.java index fa186bdf..ba9de89e 100644 --- a/src/main/java/com/example/daemawiki/domain/user/service/GetUser.java +++ b/src/main/java/com/example/daemawiki/domain/user/service/GetUser.java @@ -27,12 +27,12 @@ public GetUser(UserRepository userRepository, UserMapper userMapper, GetMajorTyp } public Flux getUserByGen(Integer gen) { - return userRepository.findAllByGenOrderByNameAsc(gen) + return userRepository.findAllByDetail_GenOrderByNameAsc(gen) .flatMap(userMapper::userToGetUserResponse); } public Flux getUserByMajor(String major) { - return userRepository.findAllByMajorOrderByNameAsc(getMajorType.execute(major)) + return userRepository.findAllByDetail_MajorOrderByNameAsc(getMajorType.execute(major)) .flatMap(userMapper::userToGetUserResponse); }