-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from YAPP-Github/fix/PC-361-profile-update
[PC-361] 프로필 업데이트 로직 분리
- Loading branch information
Showing
29 changed files
with
702 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
api/src/main/java/org/yapp/domain/auth/presentation/dto/enums/RoleStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
package org.yapp.domain.auth.presentation.dto.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
import lombok.AllArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
public enum RoleStatus { | ||
NONE("NONE"), | ||
REGISTER("REGISTER"), | ||
USER("USER"); | ||
private String status; | ||
NONE("NONE"), | ||
REGISTER("REGISTER"), | ||
PENDING("PENDING"), | ||
USER("USER"); | ||
private String status; | ||
|
||
@JsonValue | ||
public String getStatus() { | ||
return status; | ||
} | ||
@JsonValue | ||
public String getStatus() { | ||
return status; | ||
} | ||
} |
89 changes: 45 additions & 44 deletions
89
...in/java/org/yapp/domain/match/application/algorithm/PreferenceBasedMatchingAlgorithm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,59 @@ | ||
package org.yapp.domain.match.application.algorithm; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
import org.yapp.domain.match.application.blocker.Blocker; | ||
import org.yapp.domain.profile.Profile; | ||
import org.yapp.domain.profile.ProfileValuePick; | ||
import org.yapp.domain.profile.application.ProfileValuePickService; | ||
|
||
import java.util.List; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class PreferenceBasedMatchingAlgorithm { | ||
private final List<Blocker> blockers; | ||
private final ProfileValuePickService profileValuePickService; | ||
|
||
/** | ||
* 가치관 기반으로 매칭을 수행 | ||
* | ||
* @param profiles 매칭 수행할 프로필 리스트 | ||
* @return 매칭이 이루어지지 않은 프로필 리스트 | ||
*/ | ||
public List<Profile> doMatch(List<Profile> profiles) { | ||
//TODO : 효율적인 일반 그래프 매칭 알고리즘 구현 | ||
//TODO : 요구조건 - 차단한 사용자 x, 이전에 매칭된 사용자 x, 지인 x | ||
|
||
return List.of(); | ||
} | ||
|
||
private int calculateWeight(Long fromProfileId, Long toProfileId) { | ||
List<ProfileValuePick> profileValuePicksOfFrom = | ||
profileValuePickService.getAllProfileValuesByProfileId(fromProfileId); | ||
List<ProfileValuePick> profileValuePicksOfTo = profileValuePickService.getAllProfileValuesByProfileId(toProfileId); | ||
|
||
int valueListSize = profileValuePicksOfFrom.size(); | ||
int sumOfWeight = 0; | ||
for (int i = 0; i < valueListSize; i++) { | ||
ProfileValuePick profileValuePickOfFrom = profileValuePicksOfFrom.get(i); | ||
ProfileValuePick profileValuePickOfTo = profileValuePicksOfTo.get(i); | ||
if (profileValuePickOfFrom.getSelectedAnswer().equals(profileValuePickOfTo.getSelectedAnswer())) { | ||
sumOfWeight++; | ||
} | ||
|
||
private final List<Blocker> blockers; | ||
private final ProfileValuePickService profileValuePickService; | ||
|
||
/** | ||
* 가치관 기반으로 매칭을 수행 | ||
* | ||
* @param profiles 매칭 수행할 프로필 리스트 | ||
* @return 매칭이 이루어지지 않은 프로필 리스트 | ||
*/ | ||
public List<Profile> doMatch(List<Profile> profiles) { | ||
//TODO : 효율적인 일반 그래프 매칭 알고리즘 구현 | ||
//TODO : 요구조건 - 차단한 사용자 x, 이전에 매칭된 사용자 x, 지인 x | ||
|
||
return List.of(); | ||
} | ||
return sumOfWeight; | ||
} | ||
|
||
private boolean checkBlock(Long user1, Long user2) { | ||
for (Blocker blocker : blockers) { | ||
boolean blocked = blocker.blocked(user1, user2); | ||
if (blocked) { | ||
return true; | ||
} | ||
|
||
private int calculateWeight(Long fromProfileId, Long toProfileId) { | ||
List<ProfileValuePick> profileValuePicksOfFrom = | ||
profileValuePickService.getAllProfileValuePicksByProfileId(fromProfileId); | ||
List<ProfileValuePick> profileValuePicksOfTo = profileValuePickService.getAllProfileValuePicksByProfileId( | ||
toProfileId); | ||
|
||
int valueListSize = profileValuePicksOfFrom.size(); | ||
int sumOfWeight = 0; | ||
for (int i = 0; i < valueListSize; i++) { | ||
ProfileValuePick profileValuePickOfFrom = profileValuePicksOfFrom.get(i); | ||
ProfileValuePick profileValuePickOfTo = profileValuePicksOfTo.get(i); | ||
if (profileValuePickOfFrom.getSelectedAnswer() | ||
.equals(profileValuePickOfTo.getSelectedAnswer())) { | ||
sumOfWeight++; | ||
} | ||
} | ||
return sumOfWeight; | ||
} | ||
|
||
private boolean checkBlock(Long user1, Long user2) { | ||
for (Blocker blocker : blockers) { | ||
boolean blocked = blocker.blocked(user1, user2); | ||
if (blocked) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.