Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat #153] 채팅 요청 자동 거절 알림 생성 #160

Merged
merged 7 commits into from
Nov 29, 2024

Conversation

dudxo
Copy link
Collaborator

@dudxo dudxo commented Nov 28, 2024

관련 이슈

📑 작업 상세 내용

  • 요청된 채팅이 시간이 지나 스케줄러에 의해 자동 거절 되었을 때, 요청자/답변자에게 알림이 생성된다.
    • 알림 생성 시 필요한 값(RejectChatInquiryDto)
      • 자동 거절된 요청 채팅 Id
      • 생성 알림 주인(회원)
    • 조회 쿼리 추가
  • for-each문을 통해 요청자/ 답변자 알림 생성 추가

💫 작업 요약

  • 채팅 요청 자동거절 알림 생성

🔍 중점적으로 리뷰 할 부분

  • 알림 생성 시 알림을 만든 triggerMemberId가 필요합니다. 답변자가 채팅 요청에 대해 응답하지 않아 자동 거절된거니 답변자를 trigger로 생각했었지만, 자동 거절한 주체는 '시스템'이라고 생각되었습니다. 하지만 시스템은 memberId가 없기에 trigger를 자기 자신으로 넣어놓긴 했습니다.

@dudxo dudxo added the ✨ feat 기능 추가 label Nov 28, 2024
@dudxo dudxo requested a review from hyun2371 November 28, 2024 09:48
@dudxo dudxo self-assigned this Nov 28, 2024
@dudxo dudxo linked an issue Nov 28, 2024 that may be closed by this pull request
1 task
Copy link

github-actions bot commented Nov 28, 2024

Test Results

 28 files   28 suites   13s ⏱️
130 tests 129 ✅ 1 💤 0 ❌
131 runs  130 ✅ 1 💤 0 ❌

Results for commit a06dfe4.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 28, 2024

Code Coverage

Overall Project 84.03% -0.63% 🍏
Files changed 70.09% 🍏

File Coverage
NotificationType.java 92.75% 🍏
ChatInquiryService.java 92.65% 🍏
ChatInquiryQueryRepositoryImpl.java 59.88% -18.6%

Copy link
Member

@hyun2371 hyun2371 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생 많으셨습니다~

@@ -129,11 +130,33 @@ public RejectChatResponse rejectChat(Long chatInquiryId, Member answerer) {
@Transactional
public void rejectChatAuto() {
List<Long> rejectedInquirerIds = chatInquiryRepository.getAutoRejectedInquirerIds();
List<RejectChatInquiryDto> rejectChatInquiryDtos = chatInquiryRepository.getAutoRejectedChatInquiry();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List<Long> rejectedInquirerIds = rejectChatInquiryDtos.stream()
			.map(dto -> dto.inquirer().getId())
			.toList()

위 코드를 추가하면 쿼리를 두 번 날릴 필요없이, 하나의 쿼리만 사용할 수 있을 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안그래도 쿼리를 줄일 수 없나 고민했었는데 좋은 방법이네요!

import com.dnd.gongmuin.member.domain.Member;
import com.querydsl.core.annotations.QueryProjection;

public record RejectChatInquiryDto(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

거절된거니까 Rejected가 더 적절할 것 같아요

@@ -14,4 +15,6 @@ public interface ChatInquiryQueryRepository {
List<Long> getAutoRejectedInquirerIds();

void updateChatInquiryStatusRejected();

List<RejectChatInquiryDto> getAutoRejectedChatInquiry();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리스트 조회 메서드니까 복수형으로 Inquires가 되어야 할 것 같습니다~

@dudxo dudxo merged commit 8a10d8b into dev Nov 29, 2024
3 checks passed
@dudxo dudxo deleted the feat/153/rejact-requestedchat-notification branch November 29, 2024 09:55
@dudxo dudxo restored the feat/153/rejact-requestedchat-notification branch December 4, 2024 14:38
@dudxo dudxo deleted the feat/153/rejact-requestedchat-notification branch December 4, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feat 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ 채팅 자동 거절 시 알림 생성
2 participants