Skip to content

Commit

Permalink
Merge pull request #141 from Team-Shaka/fix/138
Browse files Browse the repository at this point in the history
🐛 Fix: 수락한 초대장도 출력하도록 수정 + 토큰 시간 변경
  • Loading branch information
koojun99 authored Oct 10, 2024
2 parents 0de8a7e + a90e197 commit 5e96af4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class InvitationService {
@Transactional
public InvitationResponseDTO.getInvitations getInvitations(User user) {

List<Invitation> invitations = invitationQueryAdapter.findAllPendingByPhone(user.getPhone());
List<Invitation> invitations = invitationQueryAdapter.findAllByPhone(user.getPhone());

List<InvitationResponseDTO.getInvitation> invitationDtos = invitations.stream()
.map(invitation -> {
Expand Down Expand Up @@ -117,7 +117,16 @@ public InvitationResponseDTO.invitationAccept decisionInvitation(User user, Invi
treehouseId = invitation.getTreeHouse().getId(); // treehouse 관련 로직 개발 후, invitation.getTreeHouse.getId() 등으로 바꾸기
// 초대장 수락
invitationCommandAdapter.acceptInvitation(invitation);
} else if (request.isAcceptDecision()==false) {
// 초대장 거절
invitationCommandAdapter.deleteInvitation(invitation);
}
return InvitationMapper.toInvitationResult(treehouseId);
}

@Transactional
public void deleteInvitation(Long invitationId) {
Invitation invitation = invitationQueryAdapter.findById(invitationId);
invitationCommandAdapter.deleteInvitation(invitation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ public void acceptInvitation(Invitation invitation) {
invitation.setStatus(InvitationStatus.ACCEPTED);
invitationRepository.save(invitation);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,13 @@ public CommonResponse<InvitationResponseDTO.createInvitation> createInvitation(
){
return CommonResponse.onSuccess(invitationService.createInvitation(user,request));
}

@DeleteMapping("/invitation/{invitationId}")
@Operation(summary = "초대장 삭제 API ✅ 🔑", description = "초대장을 삭제하는 API 입니다.")
public CommonResponse deleteInvitation(
@PathVariable Long invitationId
){
invitationService.deleteInvitation(invitationId);
return CommonResponse.onSuccess(null);
}
}
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ jwt:
key: ${JWT_SECRET}
# secret : ${JWT_SECRET}
authorities-key: authoritiesKey
access-token-validity-in-seconds: 7200000 # 2 hour
refresh-token-validity-in-seconds: 2592000000 # 30 day
access-token-validity-in-seconds: 120000 # 2 min
refresh-token-validity-in-seconds: 300000 # 30 day

firebase:
admin-sdk: ${FCM_KEY}
Expand Down

0 comments on commit 5e96af4

Please sign in to comment.