Skip to content

[25.07.09 / TASK-215] Feature - 뉴스레터 배치 이슈 대응 & 리마인더 추가 #34

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

Merged
merged 10 commits into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions backoffice/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@

OPENAI_API_KEY = env("OPENAI_API_KEY", default="")

AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID", default="")
AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY", default="")
AWS_REGION = env("AWS_REGION", default="ap-northeast-2")
DEFAULT_FROM_EMAIL = env(
"DEFAULT_FROM_EMAIL", default="[email protected]"
)

SENTRY_DSN = env("SENTRY_DSN", default="")
SENTRY_ENVIRONMENT = env("SENTRY_ENVIRONMENT", default="prod")
SENTRY_TRACES_SAMPLE_RATE = env.float("SENTRY_TRACES_SAMPLE_RATE", default=1.0)
Expand Down
13 changes: 13 additions & 0 deletions insight/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ class TrendAnalysis(SerializableMixin):
class WeeklyTrendInsight(SerializableMixin):
trending_summary: list[TrendingItem] = field(default_factory=list)
trend_analysis: TrendAnalysis = None
"""
user trend인 경우 아래 필드가 필요합니다.
(템플릿 의존성 존재, 현우님께서 작업하시면서 변경 가능)
reminder: { // 해당하는 주에 작성한 글이 없는 경우
title: str
days_ago: int
}
user_weekly_stats: { // 토큰 정상인 모든 유저가 갖고 있는 필드
posts: int
views: int
likes: int
}
"""


class WeeklyTrend(TimeStampedModel):
Expand Down
17 changes: 1 addition & 16 deletions insight/schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dataclasses import dataclass

from insight.models import WeeklyTrendInsight
from modules.mail.schemas import EmailMessage


Expand All @@ -10,24 +9,10 @@ class NewsletterContext:
s_date: str
e_date: str
is_expired_token_user: bool
weekly_trend_html: str | None = None
weekly_trend_html: str
user_weekly_trend_html: str | None = None


# templates/insight/weekly_trend.html 데이터 스키마
@dataclass
class WeeklyTrendContext:
insight: WeeklyTrendInsight


# templates/insight/user_weekly_trend.html 데이터 스키마
@dataclass
class UserWeeklyTrendContext:
user: dict[str, str] # username
user_weekly_stats: dict[str, int] # posts, views, likes
insight: WeeklyTrendInsight


@dataclass
class Newsletter:
user_id: int
Expand Down
Loading