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

Commit

Permalink
동아리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Feb 18, 2024
1 parent 68ae599 commit b75c99f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "비밀번호 형식이 올바르지 않습니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -51,8 +52,11 @@ public Mono<Void> 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)
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/com/example/daemawiki/domain/user/model/User.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public interface UserRepository extends ReactiveMongoRepository<User, String> {
Mono<User> findByEmail(String email);

Flux<User> findAllByGenOrderByNameAsc(Integer gen);
Flux<User> findAllByDetail_GenOrderByNameAsc(Integer gen);

Flux<User> findAllByMajorOrderByNameAsc(MajorType major);
Flux<User> findAllByDetail_MajorOrderByNameAsc(MajorType major);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public GetUser(UserRepository userRepository, UserMapper userMapper, GetMajorTyp
}

public Flux<GetUserResponse> getUserByGen(Integer gen) {
return userRepository.findAllByGenOrderByNameAsc(gen)
return userRepository.findAllByDetail_GenOrderByNameAsc(gen)
.flatMap(userMapper::userToGetUserResponse);
}

public Flux<GetUserResponse> getUserByMajor(String major) {
return userRepository.findAllByMajorOrderByNameAsc(getMajorType.execute(major))
return userRepository.findAllByDetail_MajorOrderByNameAsc(getMajorType.execute(major))
.flatMap(userMapper::userToGetUserResponse);
}

Expand Down

0 comments on commit b75c99f

Please sign in to comment.