Skip to content

Commit

Permalink
Merge pull request #295 from Gamegoo-repo/feat/294
Browse files Browse the repository at this point in the history
[Feat/294] ํ”„๋กœํ•„ ์กฐํšŒ์— wantP ์ถ”๊ฐ€ํ•˜๊ธฐ
  • Loading branch information
rimi3226 authored Oct 13, 2024
2 parents 6a42285 + 7df56a1 commit 62be445
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/main/generated/com/gamegoo/domain/member/QMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class QMember extends EntityPathBase<Member> {
//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public final NumberPath<Integer> wantPosition = createNumber("wantPosition", Integer.class);

public final NumberPath<Double> winRate = createNumber("winRate", Double.class);

public QMember(String variable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public ApiResponse<String> modifyPosition(
Long userId = JWTUtil.getCurrentUserId();
int mainP = positionRequestDTO.getMainP();
int subP = positionRequestDTO.getSubP();

profileService.modifyPosition(userId, mainP, subP);
int wantP = positionRequestDTO.getWantP();
profileService.modifyPosition(userId, mainP, subP, wantP);

return ApiResponse.onSuccess("ํฌ์ง€์…˜ ์ˆ˜์ •์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ");
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gamegoo/converter/MemberConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static MemberResponse.myProfileMemberDTO toMyProfileDTO(Member member) {
.manner(member.getMannerLevel())
.mainP(member.getMainPosition())
.subP(member.getSubPosition())
.wantP(member.getWantPosition())
.isAgree(member.getIsAgree())
.isBlind(member.getBlind())
.winrate(member.getWinRate())
Expand Down Expand Up @@ -114,6 +115,7 @@ public static MemberResponse.myProfileDTO profileDTO(Member member, Double manne
.mannerRank(mannerScoreRank)
.mainP(member.getMainPosition())
.subP(member.getSubPosition())
.wantP(member.getWantPosition())
.isAgree(member.getIsAgree())
.isBlind(member.getBlind())
.winrate(member.getWinRate())
Expand Down Expand Up @@ -158,6 +160,7 @@ public static MemberResponse.memberProfileDTO toMemberProfileDTO(Member member,
.mannerRank(mannerScoreRank)
.mannerRatingCount(mannerRatingCount)
.mainP(targetMember.getMainPosition())
.wantP(targetMember.getWantPosition())
.subP(targetMember.getSubPosition())
.isAgree(targetMember.getIsAgree())
.isBlind(targetMember.getBlind())
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/gamegoo/domain/member/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ public class Member extends BaseDateTimeEntity {
private Double winRate;

@Column(name = "main_position")
private Integer mainPosition;
private Integer mainPosition = 0;

@Column(name = "sub_position")
private Integer subPosition;
private Integer subPosition = 0;

@Column(name = "want_position")
private Integer wantPosition = 0;

@Column(name = "refresh_token")
private String refreshToken;
Expand Down Expand Up @@ -119,9 +122,10 @@ public void updateMike(Boolean isMike){
this.mike=isMike;
}

public void updatePosition(Integer mainPosition, Integer subPosition) {
public void updatePosition(Integer mainPosition, Integer subPosition, Integer wantPosition) {
this.mainPosition = mainPosition;
this.subPosition = subPosition;
this.wantPosition = wantPosition;
}

public void updateProfileImage(Integer profileImage) {
Expand All @@ -132,9 +136,10 @@ public void deactiveMember() {
this.blind = true;
}

public void updateMemberFromMatching(Integer mainPosition, Integer subPosition, Boolean mike) {
public void updateMemberFromMatching(Integer mainPosition, Integer subPosition, Integer wantPosition, Boolean mike) {
this.mainPosition = mainPosition;
this.subPosition = subPosition;
this.wantPosition = wantPosition;
this.mike = mike;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/gamegoo/dto/member/MemberRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public static class PositionRequestDTO {
@Min(value = 0, message = "์„œ๋ธŒ ํฌ์ง€์…˜์˜ ๊ฐ’์€ 0์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.")
@Max(value = 5, message = "์„œ๋ธŒ ํฌ์ง€์…˜์˜ ๊ฐ’์€ 5์ดํ•˜์ด์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.")
int subP;

@Min(value = 0, message = "์›ํ•˜๋Š” ํฌ์ง€์…˜์˜ ๊ฐ’์€ 0์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.")
@Max(value = 5, message = "์›ํ•˜๋Š” ํฌ์ง€์…˜์˜ ๊ฐ’์€ 5์ดํ•˜์ด์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.")
int wantP;
}

@Getter
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gamegoo/dto/member/MemberResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public static class myProfileMemberDTO {
String updatedAt;
Integer mainP;
Integer subP;
Integer wantP;
Boolean isAgree;
Boolean isBlind;
String loginType;
Expand All @@ -123,6 +124,7 @@ public static class myProfileDTO {
String updatedAt;
Integer mainP;
Integer subP;
Integer wantP;
Boolean isAgree;
Boolean isBlind;
String loginType;
Expand Down Expand Up @@ -151,6 +153,7 @@ public static class memberProfileDTO {
String updatedAt;
Integer mainP;
Integer subP;
Integer wantP;
Boolean isAgree;
Boolean isBlind;
String loginType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ public void save(MatchingRequest.InitializingMatchingRequestDTO request, Long id

// ๋งค์นญ ๊ธฐ๋ก์— ๋”ฐ๋ผ member ์ •๋ณด ๋ณ€๊ฒฝํ•˜๊ธฐ
if (request.getMainP() != null && request.getSubP() != null && request.getWantP() != null) {
member.updateMemberFromMatching(request.getMainP(), request.getSubP(),
request.getMike());
member.updateMemberFromMatching(request.getMainP(), request.getSubP(), request.getWantP(), request.getMike());
log.info("Updated member information based on matching record, memberId: {}",
member.getId());
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/gamegoo/service/member/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public Member joinMember(String email, String password, String gameName, String
.profileImage(randomProfileImage)
.blind(false)
.mike(false)
.mainPosition(0)
.subPosition(0)
.wantPosition(0)
.mannerLevel(1)
.isAgree(isAgree)
.build();
Expand All @@ -112,7 +115,6 @@ public Member joinMember(String email, String password, String gameName, String
// (2) Champion id, Member id ์—ฎ์–ด์„œ MemberChampion ํ…Œ์ด๋ธ”์— ๋„ฃ๊ธฐ
top3Champions
.forEach(championId -> {
System.out.println(championId);
Champion champion = championRepository.findById(Long.valueOf(championId))
.orElseThrow(() -> new MemberHandler(ErrorStatus.CHAMPION_NOT_FOUND));

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/gamegoo/service/member/ProfileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ public void deleteMember(Long userId) {
* @param subP
*/
@Transactional
public void modifyPosition(Long userId, int mainP, int subP) {
if (mainP < 0 || subP < 0 || mainP > 5 || subP > 5) {
public void modifyPosition(Long userId, int mainP, int subP, int wantP) {
if (mainP < 0 || subP < 0 || wantP < 0 || mainP > 5 || subP > 5 || wantP > 5) {
throw new MemberHandler(ErrorStatus.POSITION_NOT_FOUND);
}

Member member = memberRepository.findById(userId)
.orElseThrow(() -> new MemberHandler(ErrorStatus.MEMBER_NOT_FOUND));

member.updatePosition(mainP, subP);
member.updatePosition(mainP, subP, wantP);
memberRepository.save(member);
}

Expand Down

0 comments on commit 62be445

Please sign in to comment.