Chore: 참석자 초대 API 이벤트 발행 로직 추가

This commit is contained in:
cyjadela
2025-10-27 14:45:19 +09:00
parent 3e2d2a2004
commit b7f1352f86
2 changed files with 625 additions and 6 deletions
@@ -18,6 +18,7 @@ import com.unicorn.hgzero.meeting.biz.usecase.out.SessionReader;
import com.unicorn.hgzero.meeting.biz.usecase.out.SessionWriter;
import com.unicorn.hgzero.meeting.infra.cache.CacheService;
import com.unicorn.hgzero.meeting.infra.event.dto.MeetingStartedEvent;
import com.unicorn.hgzero.meeting.infra.event.dto.NotificationRequestEvent;
import com.unicorn.hgzero.meeting.infra.event.publisher.EventPublisher;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -541,12 +542,31 @@ public class MeetingService implements
// 참석자 저장
participantWriter.saveParticipant(command.meetingId(), command.email());
// TODO: 실제 이메일 발송 구현 필요
// 이메일 발송 서비스 호출
// emailService.sendInvitation(command.email(), meeting, command.frontendUrl());
// 현재는 로그만 남기고 성공으로 처리
log.info("Invitation email would be sent to {} for meeting {} (Frontend URL: {})",
command.email(), meeting.getTitle(), command.frontendUrl());
// 회의 초대 알림 이벤트 발행
try {
NotificationRequestEvent event = NotificationRequestEvent.builder()
.notificationType("MEETING_INVITATION")
.recipientEmail(command.email())
.recipientId(command.email())
.recipientName(command.email())
.title("회의 초대")
.message(String.format("'%s' 회의에 초대되었습니다. 일시: %s, 장소: %s, 참여 링크: %s",
meeting.getTitle(), meeting.getScheduledAt(), meeting.getLocation(), command.frontendUrl()))
.relatedEntityId(command.meetingId())
.relatedEntityType("MEETING")
.requestedBy(meeting.getOrganizerId())
.requestedByName(command.inviterName())
.eventTime(LocalDateTime.now())
.build();
eventPublisher.publishNotificationRequest(event);
log.info("Meeting invitation event published for email: {}, meetingId: {}",
command.email(), command.meetingId());
} catch (Exception e) {
log.error("Failed to publish meeting invitation event: meetingId={}, email={}",
command.meetingId(), command.email(), e);
// 이벤트 발행 실패는 비즈니스 로직에 영향을 주지 않으므로 계속 진행
}
log.info("Participant invited successfully: {} to meeting {}", command.email(), command.meetingId());
}