Skip to content

Commit

Permalink
♻️ :: 학생 매칭하기 api 쿼리 스트링으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Dec 5, 2023
1 parent 2178a97 commit 2b19c8a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public class UserController {

private final DeleteUserService deleteUserService;

@GetMapping()
public int whoMatch(@RequestBody @Valid WhoMatchRequest request) {
return whoMatchService.whoMatch(request);
@GetMapping("/{username}")
public int whoMatch(@PathVariable String username) {
return whoMatchService.whoMatch(username);
}

@GetMapping("/both")
public int bothMatch(@RequestBody @Valid BothMatchRequest request) {
return bothMatchService.bothMatch(request);
@GetMapping("/both/{username1}/{username2}")
public int bothMatch(@PathVariable String username1, @PathVariable String username2) {
return bothMatchService.bothMatch(username1, username2);
}

@GetMapping("/my-info")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public class BothMatchService {

private final SchoolClassFacade schoolClassFacade;

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

User user1 = userRepository.findByUsername(request.getUsername1())
User user1 = userRepository.findByUsername(username1)
.orElseThrow(()->UserNotFoundException.EXCEPTION);

User user2 = userRepository.findByUsername(request.getUsername2())
User user2 = userRepository.findByUsername(username2)
.orElseThrow(()->UserNotFoundException.EXCEPTION);

if(me.getStudentId().substring(0, 1).equals(user1.getStudentId().substring(0,1))) return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class WhoMatchService {

private final SchoolClassFacade schoolClassFacade;

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

User user = userRepository.findByUsername(request.getUsername())
User user = userRepository.findByUsername(username)
.orElseThrow(()-> UserNotFoundException.EXCEPTION);

if(me.getStudentId().substring(0, 1).equals(user.getStudentId().substring(0,1))) return 0;
Expand Down

0 comments on commit 2b19c8a

Please sign in to comment.