Skip to content

Commit

Permalink
🌨 :: MatchScoreResponse로 대체
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Dec 29, 2023
1 parent 1882a42 commit 9957439
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.asterbackend.domain.user.user.presentation;

import com.example.asterbackend.domain.user.auth.presentation.dto.response.MyInfoResponse;
import com.example.asterbackend.domain.user.user.presentation.dto.response.MatchScoreResponse;
import com.example.asterbackend.domain.user.user.service.BothMatchService;
import com.example.asterbackend.domain.user.user.service.DeleteUserService;
import com.example.asterbackend.domain.user.user.service.MyInfoService;
Expand All @@ -22,12 +23,12 @@ public class UserController {
private final DeleteUserService deleteUserService;

@GetMapping()
public int whoMatch(@RequestParam("user") String username) {
public MatchScoreResponse whoMatch(@RequestParam("user") String username) {
return whoMatchService.whoMatch(username);
}

@GetMapping("/both")
public int bothMatch(@RequestParam("user1") String username1, @RequestParam("user2") String username2) {
public MatchScoreResponse bothMatch(@RequestParam("user1") String username1, @RequestParam("user2") String username2) {
return bothMatchService.bothMatch(username1, username2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.asterbackend.domain.user.schoolClass.facade.SchoolClassFacade;
import com.example.asterbackend.domain.user.user.entity.User;
import com.example.asterbackend.domain.user.user.facade.UserFacade;
import com.example.asterbackend.domain.user.user.presentation.dto.response.MatchScoreResponse;
import com.example.asterbackend.domain.user.user.repository.UserRepository;
import com.example.asterbackend.global.exception.user.UserNotFoundException;
import lombok.RequiredArgsConstructor;
Expand All @@ -19,7 +20,7 @@ public class BothMatchService {

private final SchoolClassFacade schoolClassFacade;

public int bothMatch(String username1, String username2) {
public MatchScoreResponse bothMatch(String username1, String username2) {
User me = userFacade.getCurrentUser();

User user1 = userRepository.findByUsername(username1)
Expand Down Expand Up @@ -55,7 +56,7 @@ public int bothMatch(String username1, String username2) {
emotionScore = 100 - Math.abs(user1.getEmotionTypeScore() - user2.getEmotionTypeScore());
decisionScore = 100 - Math.abs(user1.getDecisionTypeScore() - user2.getDecisionTypeScore());

return (socialScore + knowledgeScore + emotionScore + decisionScore)/4;
return new MatchScoreResponse(matchScore);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class WhoMatchService {

private final SchoolClassFacade schoolClassFacade;

public int whoMatch(String username) {
public MatchScoreResponse whoMatch(String username) {
User me = userFacade.getCurrentUser();

User user = userRepository.findByUsername(username)
Expand All @@ -42,7 +42,7 @@ public int whoMatch(String username) {
emotionScore = 100 - Math.abs(me.getEmotionTypeScore() - user.getEmotionTypeScore());
decisionScore = 100 - Math.abs(me.getDecisionTypeScore() - user.getDecisionTypeScore());

return (socialScore + knowledgeScore + emotionScore + decisionScore)/4;
return new MatchScoreResponse(matchScore);
}

}

0 comments on commit 9957439

Please sign in to comment.