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-be: Email 전송 상태값 종류 추가 #1011

Open
wants to merge 4 commits into
base: be/develop
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 13, 2025

목적

현재 이메일 전송시 전송을 성공/실패 했는지만 Boolean 값으로 저장되고 있습니다.
이를 Enum을 사용하여 전송 상태값의 종류를 다양하게 만듭니다.(전송 중/ 전송 성공/ 전송 실패)

작업 세부사항

  • Email 도메인 클래스의 isSucceed 필드 변경
  • 클래스 필드 변경에 따른 DB 컬럼 업데이트 Flyway 추가
  • 관련 테스트코드 추가 및 변경

참고 사항

  • 운영서버에 배포가 진행되기 전에 DB 스키마 변경으로 인한 사전 작업이 요구될 수 있습니다.
  • 비동기로 요청이 가고, 그 직후 PENDING 상태에서 추후 DELIVERED, FAILED로 상태가 바뀌는 지에 대한 테스트를 어떻게 작성할지 의견이 필요합니다~

아래의 별표줄 밑에 요구사항 ID만 작성해주세요. Prefix 금지!


EMAIL_SEND_STATUS

closes #1010

@github-actions github-actions bot added backend 백엔드 feature 새로운 기능 labels Feb 13, 2025
@Dobby-Kim Dobby-Kim marked this pull request as ready for review February 13, 2025 08:34
Copy link
Contributor Author

1739435703.921449

Copy link
Member

@cutehumanS2 cutehumanS2 left a comment

Choose a reason for hiding this comment

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

👍

비동기로 요청이 가고, 그 직후 PENDING 상태에서 추후 DELIVERED, FAILED로 상태가 바뀌는 지에 대한 테스트를 어떻게 작성할지 의견이 필요합니다~

"비동기로 작동하는지", 그리고 이메일 발송 "직후에" 상태가 변경되는지 검증하고 싶으신걸까요??
아니면, 단순히 이메일 발송 성공 여부에 따라 DELIVERED, FAILED로 잘 저장되는지를 검증하고 싶으신 건가요? 후자는 워낙 단순해서 아닐 거 같긴 합니다만. 😅

Comment on lines +54 to +55
log.info("이메일 전송 실패: from={}, to={}, subject={}, error={}", from.getId(), to.getEmail(), subject, e.getMessage());
email.updateStatus(EmailStatus.FAILED);
Copy link
Member

Choose a reason for hiding this comment

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

[필수 반영x]
사소한 부분인데, 둘 순서를 바꾸는 게 아주 조오금 더 안정성 있지 않을까요? ㅎ ㅎ
로그에서도 상태를 안 찍고 있기도 하고, 그럴 일이 있을까 싶지만 왠지 상태를 바꾸고 나서 로깅 하는 게 안정적인 거 같아서요~

SET email_status = CASE
WHEN email_status = '1' THEN 'DELIVERED'
WHEN email_status = '0' THEN 'FAILED'
ELSE 'PENDING'
Copy link
Member

Choose a reason for hiding this comment

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

'PENDING'은 필요 없을 거 같긴 한데, 혹시 모르니 해 놓는 게 좋을까요?

@@ -338,7 +338,7 @@ void read() {
fieldWithPath("subject").description("이메일 제목"),
fieldWithPath("content").description("이메일 본문"),
fieldWithPath("createdDate").description("전송 날짜"),
fieldWithPath("isSucceed").description("전송 성공 여부")
fieldWithPath("status").description("이메일 상태 (PENDING, DELIVERED, FAILED)")
Copy link
Member

Choose a reason for hiding this comment

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

[필수 반영x]
이메일 상태 -> 이메일 전송 상태 로 하는 게 명확한 거 같아요 ㅎ ㅎ

ELSE 'PENDING'
END;

ALTER TABLE email MODIFY COLUMN email_status VARCHAR(20) NOT NULL DEFAULT 'PENDING';
Copy link
Member

Choose a reason for hiding this comment

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

맨 위 alter table에 합치면 혹시 결과가 다른가요? ?

ALTER TABLE email CHANGE COLUMN is_succeed email_status VARCHAR(20) NOT NULL DEFAULT 'PENDING';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend 백엔드 feature 새로운 기능
Projects
Status: 할일
Development

Successfully merging this pull request may close these issues.

2 participants