Skip to content

Commit 3188be8

Browse files
authored
Merge pull request #48 from SynergyX-AI-Pattern/refactor/#47_add_userId_to_notification_body
Refactor/#47 add user id to notification body
2 parents d6df3de + 817d2b6 commit 3188be8

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

app/models/pattern_apply.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class PatternApply(BaseTimeModel):
1515

1616
stock_id = Column(BigInteger, ForeignKey("stock.id"), nullable=False)
1717

18+
user_id = Column(BigInteger, nullable=False)
19+
1820
is_alert_enabled = Column(Boolean, nullable=False, default=False)
1921
entry_at = Column(DateTime, nullable=False)
2022
entry_price = Column(Float, nullable=False)

app/services/pattern_detection_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def _process_apply(apply, db: Session, now: datetime) -> Optional[dict]:
129129

130130
try:
131131
send_notification_to_spring(
132+
user_id=apply.user_id,
132133
title=f"[{stock_name}] 패턴 감지!",
133134
message=f"{stock_name}에 적용한 {pattern_name} 패턴이 감지되었습니다.",
134135
notification_type="PATTERN_DETECTED"

app/utils/notification_sender.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
from app.core.config import settings
55
from app.exceptions.base import APIException
66

7-
def send_notification_to_spring(title: str, message: str, notification_type: str):
7+
def send_notification_to_spring(user_id: int, title: str, message: str, notification_type: str):
88
"""
99
SpringBoot 서버로 알림을 전송하는 유틸 함수입니다.
1010
"""
1111
base_url = settings.SPRING_SERVER_BASE_URL
12-
url = f"{base_url}/notifications/send"
12+
url = f"{base_url}/test/notifications/send"
1313
payload = {
14+
"userId": user_id,
1415
"title": title,
1516
"message": message,
1617
"type": notification_type

0 commit comments

Comments
 (0)