Skip to content

Commit

Permalink
Merge pull request #173 from THEGOODs-repo/feature/171
Browse files Browse the repository at this point in the history
♻️ refactor: 회원가입, mypage 기능 변경사항 수정
  • Loading branch information
hyoungj00n authored Apr 15, 2024
2 parents ed78e2e + 18b2a03 commit 5a11e45
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ public enum ErrorStatus implements BaseErrorCode {
// Member
MEMBER_NICKNAME_DUPLICATED(HttpStatus.BAD_REQUEST, "MEMBER4001", "중복된 닉네임 입니다."),
MEMBER_PASSWORD_ERROR(HttpStatus.BAD_REQUEST, "MEMBER4002", "비밀번호가 잘못되었습니다."),
MEMBER_EMAIL_NOT_FOUND(HttpStatus.BAD_REQUEST, "MEMBER4003", "이메일이 존재하지 않습니다."),
MEMBER_EMAIL_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4003", "이메일이 존재하지 않습니다."),
MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4004", "해당 회원을 찾을 수 없습니다."),
MEMBER_PHONE_AUTH_ERROR(HttpStatus.BAD_REQUEST, "MEMBER4005", "유효하지 않는 번호입니다."),
MEMBER_EMAIL_AUTH_ERROR(HttpStatus.BAD_REQUEST, "MEMBER4006", "유효하지 않는 이메일입니다."),
MEMBER_PASSWORD_NOT_EQUAL(HttpStatus.BAD_REQUEST, "MEMBER4007", "비밀번호가 일치하지 않습니다."),
MEMBER_ACCOUNT_NOT_FOUND(HttpStatus.BAD_REQUEST, "MEMBER4008", "계좌가 존재하지 않습니다"),
MEMBER_ADDRESS_NOT_FOUND(HttpStatus.BAD_REQUEST, "MEMBER4009", "주소가 존재하지 않습니다"),
MEMBER_ACCOUNT_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4008", "계좌가 존재하지 않습니다"),
MEMBER_ADDRESS_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4009", "주소가 존재하지 않습니다"),
MEMBER_INACTIVATE(HttpStatus.NOT_ACCEPTABLE, "MEMBER40010", "탈퇴한 회원입니다."),
MEMBER_NOT_OWNER(HttpStatus.NOT_ACCEPTABLE, "MEMBER40010", "해당 회원이 아닙니다."),
MEMBER_NOT_OWNER(HttpStatus.NOT_ACCEPTABLE, "MEMBER40011", "해당 회원이 아닙니다."),
MEMBER_CONTACT_NOT_FOUND(HttpStatus.NOT_FOUND,"MEMBER40012", "연락 가능 시간을 조회할 수 없습니다."),

//JWT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.umc.TheGoods.domain.item.ItemOption;
import com.umc.TheGoods.domain.item.Tag;
import com.umc.TheGoods.domain.mapping.Tag.CategoryTag;
import com.umc.TheGoods.domain.mapping.member.MemberCategory;
import com.umc.TheGoods.domain.mapping.member.MemberTag;
import com.umc.TheGoods.domain.mapping.member.MemberTerm;
import com.umc.TheGoods.domain.member.Auth;
import com.umc.TheGoods.domain.member.Member;
Expand Down Expand Up @@ -49,13 +47,13 @@ public static MemberResponseDTO.JoinResultDTO toJoinResultDTO(Member member) {
public static Member toMember(MemberRequestDTO.JoinDTO request, BCryptPasswordEncoder encoder) {
return Member.builder()
.nickname(request.getNickname())
.name(request.getName())
.password(encoder.encode(request.getPassword()))
.email(request.getEmail())
.birthday(request.getBirthday())
.gender(request.getGender())
.phone(request.getPhone())
.memberRole(MemberRole.BUYER)
.memberCategoryList(new ArrayList<>())
.memberTermList(new ArrayList<>())
.itemList(new ArrayList<>())
.build();
Expand All @@ -78,7 +76,6 @@ public static MemberResponseDTO.NewTokenDTO toNewTokenDTO(String accessToken, St

public static Member toUpdatePassword(Member member, String password) {
List<MemberTerm> memberTermList = member.getMemberTermList();
List<MemberCategory> memberCategoryList = member.getMemberCategoryList();
List<Item> memberItemList = member.getItemList();
if (memberItemList == null) {
memberItemList = new ArrayList<>();
Expand All @@ -88,45 +85,21 @@ public static Member toUpdatePassword(Member member, String password) {
memberTermList = new ArrayList<>();
}

if (memberCategoryList == null) {
memberCategoryList = new ArrayList<>();
}
return Member.builder()
.id(member.getId())
.name(member.getName())
.nickname(member.getNickname())
.password(password)
.email(member.getEmail())
.birthday(member.getBirthday())
.gender(member.getGender())
.phone(member.getPhone())
.memberRole(MemberRole.BUYER)
.memberCategoryList(memberCategoryList)
.memberTermList(memberTermList)
.itemList(memberItemList)
.build();
}

public static List<MemberCategory> toMemberCategoryList(List<Category> categoryList) {


return categoryList.stream()
.map(category ->
MemberCategory.builder()
.category(category)
.build()
).collect(Collectors.toList());

}

public static List<MemberTag> toMemberTagList(List<Tag> tagList){

return tagList.stream().map(tag ->
MemberTag.builder()
.tag(tag)
.build()
).collect(Collectors.toList());

}

public static List<MemberTerm> toMemberTermList(HashMap<Term, Boolean> termList) {

Expand Down Expand Up @@ -308,7 +281,6 @@ public static MemberResponseDTO.PasswordUpdateResultDTO toPasswordUpdateResultDT

public static Member toUpdateProfile(Member member, ProfileImg profileImg, String nickname, String introduce) {
List<MemberTerm> memberTermList = member.getMemberTermList();
List<MemberCategory> memberCategoryList = member.getMemberCategoryList();
List<Item> memberItemList = member.getItemList();
if (memberItemList == null) {
memberItemList = new ArrayList<>();
Expand All @@ -318,19 +290,16 @@ public static Member toUpdateProfile(Member member, ProfileImg profileImg, Strin
memberTermList = new ArrayList<>();
}

if (memberCategoryList == null) {
memberCategoryList = new ArrayList<>();
}
return Member.builder()
.id(member.getId())
.name(member.getName())
.nickname(nickname)
.password(member.getPassword())
.email(member.getEmail())
.birthday(member.getBirthday())
.gender(member.getGender())
.phone(member.getPhone())
.memberRole(MemberRole.BUYER)
.memberCategoryList(memberCategoryList)
.memberTermList(memberTermList)
.itemList(memberItemList)
.introduce(introduce)
Expand Down Expand Up @@ -442,30 +411,6 @@ public static List<MemberResponseDTO.AddressDTO> toGetAddressDTO(List<Address> a
return addressList;
}

public static MemberResponseDTO.CustomInfoDTO toCustomInfoDTO(List<Category> categoryList, List<Tag> tagList){
List<MemberResponseDTO.CategoryDTO> category = categoryList.stream().map(
c ->{
return MemberResponseDTO.CategoryDTO
.builder()
.id(c.getId())
.name(c.getName())
.build();}
).collect(Collectors.toList());

List<MemberResponseDTO.TagDTO> tag = tagList.stream().map(
t ->{
return MemberResponseDTO.TagDTO.builder()
.id(t.getId())
.name(t.getName())
.build();
}
).collect(Collectors.toList());

return MemberResponseDTO.CustomInfoDTO.builder()
.categoryList(category)
.tagList(tag)
.build();
}

public static Declaration toDeclaration(Member member, MemberRequestDTO.DeclareDTO request){

Expand Down Expand Up @@ -519,4 +464,12 @@ public static ContactTime toContactTime(Member member, MemberRequestDTO.ContactD
.build();
}

public static MemberResponseDTO.ContactResponseDTO toContactDTO(ContactTime contactTime){
return MemberResponseDTO.ContactResponseDTO.builder()
.start(contactTime.getStartTime())
.end(contactTime.getEndTime())
.allTime(contactTime.getAllTime())
.build();
}

}
3 changes: 0 additions & 3 deletions src/main/java/com/umc/TheGoods/domain/item/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.umc.TheGoods.domain.common.BaseDateTimeEntity;
import com.umc.TheGoods.domain.mapping.Tag.CategoryTag;
import com.umc.TheGoods.domain.mapping.member.MemberCategory;
import lombok.*;

import javax.persistence.*;
Expand All @@ -24,8 +23,6 @@ public class Category extends BaseDateTimeEntity {
@Column(nullable = false, length = 30)
private String name;

@OneToMany(mappedBy = "category", cascade = CascadeType.ALL)
private List<MemberCategory> memberCategoryList = new ArrayList<>();

@OneToMany(mappedBy = "category", cascade = CascadeType.ALL)
private List<CategoryTag> categoryTagList = new ArrayList<>();
Expand Down

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/com/umc/TheGoods/domain/member/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import com.umc.TheGoods.domain.mapping.ViewSearch.TagSearch;
import com.umc.TheGoods.domain.mapping.comment.CommentLike;
import com.umc.TheGoods.domain.mapping.comment.CommentMention;
import com.umc.TheGoods.domain.mapping.member.MemberCategory;
import com.umc.TheGoods.domain.mapping.member.MemberTag;
import com.umc.TheGoods.domain.mapping.member.MemberTerm;
import com.umc.TheGoods.domain.mapping.post.PostLike;
import com.umc.TheGoods.domain.mypage.*;
Expand Down Expand Up @@ -114,11 +112,6 @@ public class Member extends BaseDateTimeEntity {
@ColumnDefault("false")
private Boolean infoTerm;

@OneToMany(mappedBy = "member", cascade = CascadeType.ALL)
private List<MemberCategory> memberCategoryList = new ArrayList<>();

@OneToMany(mappedBy = "member", cascade = CascadeType.ALL)
private List<MemberTag> memberTagList = new ArrayList<>();

@OneToMany(mappedBy = "member", cascade = CascadeType.ALL)
private List<MemberTerm> memberTermList = new ArrayList<>();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.umc.TheGoods.domain.member.Member;
import com.umc.TheGoods.domain.mypage.Account;
import com.umc.TheGoods.domain.mypage.Address;
import com.umc.TheGoods.domain.mypage.ContactTime;
import com.umc.TheGoods.redis.domain.RefreshToken;
import com.umc.TheGoods.web.dto.member.MemberRequestDTO;
import com.umc.TheGoods.web.dto.member.MemberResponseDTO;
Expand Down Expand Up @@ -48,7 +49,6 @@ public interface MemberCommandService {

Member profileModify(MultipartFile profile, String nickname, String introduce, Member member);

Member updateRole(Member member);

void updatePhoneName(MemberRequestDTO.PhoneNameUpdateDTO request, Member member);

Expand All @@ -68,12 +68,13 @@ public interface MemberCommandService {

void deleteAddress(Member member, Long addressId);

void updateCustomInfo(Long memberId, MemberRequestDTO.CustomInfoDTO request);

void postDeclare(Member member, MemberRequestDTO.DeclareDTO request);

void deleteDeclare(Long declarationId, Member member);

void postContact(Long memberId, MemberRequestDTO.ContactDTO request);

ContactTime getContact(Member member);

}
Loading

0 comments on commit 5a11e45

Please sign in to comment.