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

작업 작은행동 알림 저장 api, listener 생성 #37

Merged
merged 5 commits into from
Feb 20, 2025
Merged

Conversation

keongmini
Copy link
Collaborator

#31

Proposed Changes

  • 작업 알림 저장 api 를 생성합니다.
  • 작업 등록 후 알림 저장할 event listener를 생성합니다. (TODO: publisher 생성 후 반영 예정)

Code Review Point

(리뷰어가 중점적으로 보면 좋을 부분을 적어주세요.)

  • 브랜치명에 이슈번호 잘못 입력했어여 ㅎㅅㅎ.... 31번이 맞습니당

@keongmini keongmini added the Feature 기능 개발 label Feb 19, 2025
@keongmini keongmini added this to the 1차 MVP 개발 milestone Feb 19, 2025
@keongmini keongmini self-assigned this Feb 19, 2025
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

@Service
Copy link
Member

Choose a reason for hiding this comment

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

@Transactional을 클래스 레벨에 선언하는건 어때?!
read-only인 경우에만 메서드 레벨에 선언하고!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

모든 메서드에 적용할 필요 없을 것 같아서 메서드단에 붙여줬어! 저장할 때만 설정하려구

Copy link
Member

Choose a reason for hiding this comment

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

아 오키오키!!

Comment on lines +19 to +20
@PostMapping("/create")
fun createNotifications(
Copy link
Collaborator

Choose a reason for hiding this comment

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

알림은 작업쪽에서 발행하는 이벤트를 받아서 등록하는 플로우로 생각했는데, 직접적으로 클라이언트가 푸쉬알림을 등록하는 경우가 있을까?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

그 나중에 할게요? 누르면 알림 재발송 설정하는거 할 때 필요할 것 같앙

Copy link
Collaborator

Choose a reason for hiding this comment

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

그 때도 task로 거쳐서 보내야 할 것 같아!
task 쪽에 리마인더 저장 여부를 저장하려구

private val pushNotificationRepository: PushNotificationRepository,
) {
@Transactional
fun upsert(pushNotification: PushNotification) = pushNotificationRepository.save(pushNotification.toEntity())
Copy link
Collaborator

@skydreamer21 skydreamer21 Feb 20, 2025

Choose a reason for hiding this comment

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

  1. 함수 네이밍이 Repository에 의존적인 것 같아. Service니까 알람을 등록하는 의미가 명확하게 드러나는 함수 이름을 쓰는건 어떨까?
  2. 이 메서드의 의도는 알림 생성에 관련된것 같은데 upsert 를 쓴 이유가 궁금해!

Copy link
Collaborator Author

@keongmini keongmini Feb 20, 2025

Choose a reason for hiding this comment

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

  1. 음.. 그럼 뭐라고 하는 게 좋을까..?? 추천해줄 수 있어?? 이 메서드에서 알림 등록 + 내용 업데이트까지 포함할거야
  2. 나중에 업데이트 되는 부분도 포함하려고 upsert라고 했어 활성화 여부 같은 거

Copy link
Collaborator

@skydreamer21 skydreamer21 Feb 20, 2025

Choose a reason for hiding this comment

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

  1. 직관적으로 createNotification는 어때?
    https://cocobi.tistory.com/27
    위의 글 한번 참고해봐도 좋을 것 같아!

  2. create랑 update랑 한 메서드 안에서 다루는 것이 괜찮을까? 리포지토리에서 같은 메서드를 부를 순 있지만 서비스에서는 구분하는 것이 낫지 않을까 생각되네!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

어처피 같은 Jpa 메소드 사용해서 create, update을 한 메소드에서 하게 구현하는 건 상관없을 것 같아. 그래서 이름을 create이라고 하기에는 update의 의미를 포함하지 않아서 upsert를 사용한거였어~!

Copy link
Collaborator

Choose a reason for hiding this comment

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

확인!

@keongmini keongmini merged commit 6098c50 into develop Feb 20, 2025
24 checks passed
@keongmini keongmini deleted the feat/34 branch February 20, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants