diff --git a/src/main/java/com/groupD/server/controller/AuthController.java b/src/main/java/com/groupD/server/controller/AuthController.java index 21faf21..3ab9906 100644 --- a/src/main/java/com/groupD/server/controller/AuthController.java +++ b/src/main/java/com/groupD/server/controller/AuthController.java @@ -22,7 +22,7 @@ public class AuthController { @PostMapping("/signUp") @ResponseStatus(HttpStatus.OK) public void signUp(@Valid @RequestBody SignUpRequestDto dto) { - authService.signUp(dto.getEmail(), dto.getPassword(), dto.getRole(), "IN_APP", null); + authService.signUp(dto); } @ApiOperation("로그인") diff --git a/src/main/java/com/groupD/server/domain/Disability.java b/src/main/java/com/groupD/server/domain/Disability.java new file mode 100644 index 0000000..25f4f31 --- /dev/null +++ b/src/main/java/com/groupD/server/domain/Disability.java @@ -0,0 +1,21 @@ +package com.groupD.server.domain; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum Disability { + PhysicalDisability("지체 장애"), + IntellectualDisability("시각 장애"), + HearingImpairment("청각 장애"), + SpeechDisorder("언어 장애"), + CognitiveImpairment("지적 정애"), + FacialDisability("안면 장애"); + private final String displayName; + + + public String getDisplayName() { + return displayName; + } +} diff --git a/src/main/java/com/groupD/server/domain/PreferJob.java b/src/main/java/com/groupD/server/domain/PreferJob.java new file mode 100644 index 0000000..921b01f --- /dev/null +++ b/src/main/java/com/groupD/server/domain/PreferJob.java @@ -0,0 +1,23 @@ +package com.groupD.server.domain; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum PreferJob { + ManagementandAdministration("경영 사무"), + SalesandMarketing("영업 판매"), + EducationandWelfare("교육 복지"), + HealthcareandMedical("보건 의료 "), + ArtsandSports("예술 스포츠 "), + InstallationandMaintenance("설치 정비"), + AgricultureForestryandFisheries("농림 어업" ); + + private final String displayName; + + + public String getDisplayName() { + return displayName; + } +} diff --git a/src/main/java/com/groupD/server/domain/dto/SignUpRequestDto.java b/src/main/java/com/groupD/server/domain/dto/SignUpRequestDto.java index bec3789..0fabe18 100644 --- a/src/main/java/com/groupD/server/domain/dto/SignUpRequestDto.java +++ b/src/main/java/com/groupD/server/domain/dto/SignUpRequestDto.java @@ -1,10 +1,14 @@ package com.groupD.server.domain.dto; +import com.groupD.server.domain.Disability; +import com.groupD.server.domain.PreferJob; import com.groupD.server.domain.Role; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -20,4 +24,21 @@ public class SignUpRequestDto { private String password; @NotNull private Role role; + @NotBlank + private String phonenum; + + @Enumerated(EnumType.STRING) + private Disability disability; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority1; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority2; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority3; + @NotBlank + private String imageUrl; + } diff --git a/src/main/java/com/groupD/server/domain/entity/Member.java b/src/main/java/com/groupD/server/domain/entity/Member.java index 1faa9cf..068bb2a 100644 --- a/src/main/java/com/groupD/server/domain/entity/Member.java +++ b/src/main/java/com/groupD/server/domain/entity/Member.java @@ -1,5 +1,7 @@ package com.groupD.server.domain.entity; +import com.groupD.server.domain.Disability; +import com.groupD.server.domain.PreferJob; import com.groupD.server.domain.Role; import lombok.AllArgsConstructor; import lombok.Builder; @@ -29,12 +31,29 @@ public class Member extends DateEntity { @NotBlank private String password; + @NotBlank + private String phonenum; + + @Enumerated(EnumType.STRING) + private Disability disability; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority1; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority2; + + @Enumerated(EnumType.STRING) + private PreferJob jobPriority3; + + @NotBlank + private String imageUrl; @Enumerated(EnumType.STRING) private Role role; private String refreshToken; private String oauth; - private String image; + public void updateRefreshToken(String newRefreshToken) { this.refreshToken = newRefreshToken; diff --git a/src/main/java/com/groupD/server/service/AuthService.java b/src/main/java/com/groupD/server/service/AuthService.java index f68d8b7..030aa2a 100644 --- a/src/main/java/com/groupD/server/service/AuthService.java +++ b/src/main/java/com/groupD/server/service/AuthService.java @@ -1,7 +1,10 @@ package com.groupD.server.service; +import com.groupD.server.domain.Disability; +import com.groupD.server.domain.PreferJob; import com.groupD.server.domain.Role; import com.groupD.server.domain.dto.SignInResponseDto; +import com.groupD.server.domain.dto.SignUpRequestDto; import com.groupD.server.domain.entity.Member; import com.groupD.server.exception.auth.EmailExistsException; import com.groupD.server.exception.auth.InvalidEmailException; @@ -29,17 +32,22 @@ public class AuthService { private String KAKAO_SECRET_SERVER_PWD; @Transactional - public void signUp(String email, String password, Role role, String oauth, String image) { - if(memberRepository.existsByEmail(email)) throw new EmailExistsException("이미 가입한 이메일입니다."); + public void signUp(SignUpRequestDto dto) { + if(memberRepository.existsByEmail(dto.getEmail())) throw new EmailExistsException("이미 가입한 이메일입니다."); memberRepository.save( Member.builder() .id(null) - .email(email) - .password(passwordEncoder.encode(password)) - .image(image) - .role(role) + .email(dto.getEmail()) + .password(passwordEncoder.encode(dto.getPassword())) + .imageUrl(dto.getImageUrl()) + .role(dto.getRole()) + .disability(dto.getDisability()) + .phonenum(dto.getPhonenum()) + .jobPriority1(dto.getJobPriority1()) + .jobPriority2(dto.getJobPriority2()) + .jobPriority3(dto.getJobPriority3()) .refreshToken(null) - .oauth(oauth) + .oauth("IN_APP") .build() ); } @@ -58,7 +66,7 @@ public SignInResponseDto signIn(String email, String password) { TokenInfo refreshToken = tokenProvider.createRefreshToken(member.getEmail(), member.getRole()); member.updateRefreshToken(refreshToken.getToken()); return new SignInResponseDto( - member.getId(), member.getEmail(), member.getImage(), member.getRole(), accessToken.getToken(), refreshToken.getToken(), accessToken.getExpireTime(), refreshToken.getExpireTime() + member.getId(), member.getEmail(), member.getImageUrl(), member.getRole(), accessToken.getToken(), refreshToken.getToken(), accessToken.getExpireTime(), refreshToken.getExpireTime() ); } }