diff --git a/src/main/kotlin/uoslife/servermeeting/match/api/MatchApi.kt b/src/main/kotlin/uoslife/servermeeting/match/api/MatchApi.kt index 4a548fa9..23eb4beb 100644 --- a/src/main/kotlin/uoslife/servermeeting/match/api/MatchApi.kt +++ b/src/main/kotlin/uoslife/servermeeting/match/api/MatchApi.kt @@ -43,11 +43,11 @@ class MatchApi( ), ] ) - @GetMapping("/teams/participation") - fun getMeetingParticipation( + @GetMapping("/me/participations") + fun getUserMeetingParticipation( @AuthenticationPrincipal userDetails: UserDetails ): ResponseEntity { - val result = matchingService.getMeetingParticipation(userDetails.username.toLong()) + val result = matchingService.getUserMeetingParticipation(userDetails.username.toLong()) return ResponseEntity.ok(result) } @@ -78,13 +78,13 @@ class MatchApi( )] )] ) - @GetMapping("/teams/{meetingTeamId}/result") + @GetMapping("/teams/{teamId}/result") fun getMatchResult( - @PathVariable meetingTeamId: Long, + @PathVariable teamId: Long, @AuthenticationPrincipal userDetails: UserDetails ): ResponseEntity { return ResponseEntity.ok( - matchingService.getMatchResult(userDetails.username.toLong(), meetingTeamId) + matchingService.getMatchResult(userDetails.username.toLong(), teamId) ) } @@ -138,14 +138,14 @@ class MatchApi( ), ] ) - @GetMapping("/matches/{matchId}/partner") - fun getMatchedMeetingTeamInformation( + @GetMapping("/{matchId}/partner") + fun getMatchedPartnerInformation( @PathVariable matchId: Long, @AuthenticationPrincipal userDetails: UserDetails, ): ResponseEntity { return ResponseEntity.status(HttpStatus.OK) .body( - matchingService.getMatchPartnerInformation(userDetails.username.toLong(), matchId) + matchingService.getMatchedPartnerInformation(userDetails.username.toLong(), matchId) ) } } diff --git a/src/main/kotlin/uoslife/servermeeting/match/service/MatchingService.kt b/src/main/kotlin/uoslife/servermeeting/match/service/MatchingService.kt index 406125c7..c61dd420 100644 --- a/src/main/kotlin/uoslife/servermeeting/match/service/MatchingService.kt +++ b/src/main/kotlin/uoslife/servermeeting/match/service/MatchingService.kt @@ -33,7 +33,7 @@ class MatchingService( private val singleMeetingService: SingleMeetingService, private val tripleMeetingService: TripleMeetingService, ) { - fun getMeetingParticipation(userId: Long): MeetingParticipationResponse { + fun getUserMeetingParticipation(userId: Long): MeetingParticipationResponse { val userTeams = userTeamDao.findAllByUserIdWithPaymentStatus(userId) return MeetingParticipationResponse( @@ -54,12 +54,16 @@ class MatchingService( ) } - fun getMatchPartnerInformation(userId: Long, matchId: Long): MeetingTeamInformationGetResponse { + fun getMatchedPartnerInformation( + userId: Long, + matchId: Long + ): MeetingTeamInformationGetResponse { + val match = matchedDao.findById(matchId) ?: throw MatchNotFoundException() + val userTeam = userTeamDao.findUserWithMeetingTeamByMatchId(userId, matchId) ?: throw UnauthorizedMatchAccessException() - val match = matchedDao.findById(matchId) ?: throw MatchNotFoundException() val partnerTeam = getPartnerTeam(userTeam.team.gender, match) // 매칭된 상대의 정보를 조회