Skip to content

Commit

Permalink
[PC-579] feat: 매칭 거절 API 엔드포인트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
devchlee12 committed Feb 12, 2025
1 parent 087c39b commit da0b5cf
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public Map<ContactType, String> getContacts() {
}

@Transactional
public void rejectMatch(Long userId) {
public void refuseMatch(Long userId) {
MatchInfo matchInfo = getMatchInfo(userId);
matchInfo.refusePiece(userId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yapp.core.domain.profile.ContactType;
Expand All @@ -29,83 +31,91 @@
@RequestMapping("/api/matches")
public class MatchController {

private final MatchService matchService;
private final DirectBlockService directBlockService;
private final MatchService matchService;
private final DirectBlockService directBlockService;

@GetMapping("/infos")
@Operation(summary = "매칭 정보 조회", description = "이번 매칭의 정보를 조회합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchInfoResponse>> getMatchInfo() {
MatchInfoResponse matchInfoResponse = matchService.getMatchInfoResponse();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchInfoResponse));
}
@GetMapping("/infos")
@Operation(summary = "매칭 정보 조회", description = "이번 매칭의 정보를 조회합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchInfoResponse>> getMatchInfo() {
MatchInfoResponse matchInfoResponse = matchService.getMatchInfoResponse();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchInfoResponse));
}

@PatchMapping("/pieces/check")
@Operation(summary = "매칭 조각 확인 체크", description = "이번 매칭의 조각을 확인했음을 서버에 알립니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> checkMatchPiece() {
matchService.checkPiece();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}
@PatchMapping("/pieces/check")
@Operation(summary = "매칭 조각 확인 체크", description = "이번 매칭의 조각을 확인했음을 서버에 알립니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> checkMatchPiece() {
matchService.checkPiece();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}

@GetMapping("/profiles/basic")
@Operation(summary = "매칭 프로필 기본정보 확인", description = "매칭 상대의 프로필 기본정보를 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchProfileBasicResponse>> getBasicMatchProfile() {
MatchProfileBasicResponse matchProfileBasic = matchService.getMatchProfileBasic();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchProfileBasic));
}
@GetMapping("/profiles/basic")
@Operation(summary = "매칭 프로필 기본정보 확인", description = "매칭 상대의 프로필 기본정보를 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchProfileBasicResponse>> getBasicMatchProfile() {
MatchProfileBasicResponse matchProfileBasic = matchService.getMatchProfileBasic();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchProfileBasic));
}

@GetMapping("/values/talks")
@Operation(summary = "매칭 상대 가치관 톡 확인", description = "매칭 상대의 가치관 톡을 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchValueTalkResponse>> getMatchTalkValues() {
MatchValueTalkResponse matchValueTalk = matchService.getMatchValueTalk();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchValueTalk));
}
@GetMapping("/values/talks")
@Operation(summary = "매칭 상대 가치관 톡 확인", description = "매칭 상대의 가치관 톡을 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchValueTalkResponse>> getMatchTalkValues() {
MatchValueTalkResponse matchValueTalk = matchService.getMatchValueTalk();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchValueTalk));
}


@GetMapping("/values/picks")
@Operation(summary = "매칭 상대 가치관 픽 확인", description = "매칭 상대의 가치관 픽을 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchValuePickResponse>> getMatchValuePicks() {
MatchValuePickResponse matchValuePickResponse = matchService.getMatchedUserValuePicks();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchValuePickResponse));
}
@GetMapping("/values/picks")
@Operation(summary = "매칭 상대 가치관 픽 확인", description = "매칭 상대의 가치관 픽을 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<MatchValuePickResponse>> getMatchValuePicks() {
MatchValuePickResponse matchValuePickResponse = matchService.getMatchedUserValuePicks();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(matchValuePickResponse));
}

@GetMapping("/images")
@Operation(summary = "매칭 상대 프로필 이미지 확인", description = "매칭 상대의 프로필 이미지를 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<ImageUrlResponse>> getMatchedUserImages() {
String matchedUserImageUrl = matchService.getMatchedUserImageUrl();
ImageUrlResponse imageUrlResponse = new ImageUrlResponse(matchedUserImageUrl);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(imageUrlResponse));
}
@GetMapping("/images")
@Operation(summary = "매칭 상대 프로필 이미지 확인", description = "매칭 상대의 프로필 이미지를 확인합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<ImageUrlResponse>> getMatchedUserImages() {
String matchedUserImageUrl = matchService.getMatchedUserImageUrl();
ImageUrlResponse imageUrlResponse = new ImageUrlResponse(matchedUserImageUrl);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(imageUrlResponse));
}

@PostMapping("/accept")
@Operation(summary = "매칭 수락하기", description = "매칭을 수락합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> acceptMatch() {
matchService.acceptMatch();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}
@PostMapping("/accept")
@Operation(summary = "매칭 수락하기", description = "매칭을 수락합니다.", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> acceptMatch() {
matchService.acceptMatch();
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}

@GetMapping("/contacts")
@Operation(summary = "매칭 상대 연락처 조회", description = "매칭 상대의 연락처를 조회합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<ContactResponses>> getContacts() {
Map<ContactType, String> contacts = matchService.getContacts();
List<ContactResponse> contactsList = ContactResponses.convert(contacts);
ContactResponses contactResponses = new ContactResponses(contactsList);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(contactResponses));
}
@GetMapping("/contacts")
@Operation(summary = "매칭 상대 연락처 조회", description = "매칭 상대의 연락처를 조회합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<ContactResponses>> getContacts() {
Map<ContactType, String> contacts = matchService.getContacts();
List<ContactResponse> contactsList = ContactResponses.convert(contacts);
ContactResponses contactResponses = new ContactResponses(contactsList);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccess(contactResponses));
}

@PostMapping("/blocks/users/{userId}")
@Operation(summary = "매칭 상대 차단", description = "매칭 상대를 차단합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> blockUsers(
@PathVariable(name = "userId") Long userId) {
directBlockService.blockUser(userId);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}
@PostMapping("/blocks/users/{userId}")
@Operation(summary = "매칭 상대 차단", description = "매칭 상대를 차단합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> blockUsers(
@PathVariable(name = "userId") Long userId) {
directBlockService.blockUser(userId);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}

@PutMapping("/refuse")
@Operation(summary = "매칭 거절", description = "매칭을 거절합니다", tags = {"매칭"})
public ResponseEntity<CommonResponse<Void>> refuseMatch(@AuthenticationPrincipal Long userId) {
matchService.refuseMatch(userId);
return ResponseEntity.status(HttpStatus.OK)
.body(CommonResponse.createSuccessWithNoContent());
}
}

0 comments on commit da0b5cf

Please sign in to comment.