feat: 계절 이야기에 사진 연결 (띠·목록·상세·피드, CC BY 계열 출처 표기)

This commit is contained in:
minaChoi committed 2026-10-08 09:10:10 +09:00
1 parent e8382f450b
commit ba62e82f1b
15 files changed
+77 -21

No files matched your search

+3 -2
View File
@@ -51,7 +51,7 @@
| [x] | 각 상세 창 점수 칸을 오늘/내일/토/일로 — 단기예보(시간별)는 약 4일 뒤까지라 월~수엔 주말 점수를 같은 방식으로 못 냄. 안: 범위 밖 주말은 중기예보(기온·비 확률)로 대략 점수 + "예상" 표시, 오늘·내일이 주말이면 다음 주말 표시 | 사용자 요청 | `backend/services/index_service.py` (`DAYS = 3`), `frontend/src/b/Sheets.tsx` |
| [x] | 그날 밤 달 모양 — 밤 히어로에 달 모양·밝기, 보름·삭인 밤엔 '오늘 밤 달' 포스트 (사용자 결정 1·4안). 보름·삭 시각은 Meeus 계산(오차 2분 안) — 계산은 `moon.py`로 외부 API 없이 가능 | 사용자 질문 | `backend/services/calc/moon.py` |
| [ ] | **[결정 필요]** 각과 상관없는 요소 비중 — 김서림각 바람, 택시대란·배달폭주·넷플릭스각 습도가 '상관없음'인데 비중 5%라 항상 50점으로 섞임. 0으로 할지 / 짬뽕·배달폭주각에 '공기 맑음' 5%가 좋은 쪽으로 들어가는 게 맞는지 | 6각 차트 수정 중 발견 | `backend/seed/index_definition.json` |
| [ ] | **[결정 필요]** 계절 이야기 사진 — CC BY-SA 등 8장은 저작자·라이선스 표시 필요(표시 위치 정하기), `howgak` 글은 맞는 사진 없음(일러스트/아이콘), `tangerine`(퍼블릭 도메인) 사용 여부, `di`(매미)·`peanut_new`(일본 삶은 땅콩) 주제 적합성 | 사진 수집 중 발견 | `frontend/public/season/sources.json` |
| [x] | **[결정 필요]** 계절 이야기 사진 — CC BY-SA 등 8장은 저작자·라이선스 표시 필요(표시 위치 정하기), `howgak` 글은 맞는 사진 없음(일러스트/아이콘), `tangerine`(퍼블릭 도메인) 사용 여부, `di`(매미)·`peanut_new`(일본 삶은 땅콩) 주제 적합성 | 사진 수집 중 발견 | `frontend/public/season/sources.json` |
| [x] | 포스트 본문이 슬라이드 내용 반복 — 축제("N월 N일부터…까지예요" = 기간 줄), 오늘 날씨, 생활 알림, 내일 미리보기, 한 문장, 각, 노을. 본문엔 슬라이드에 없는 한 줄만 | 전체 검수 | `backend/services/feed_service.py` |
| [x] | 아이콘 오용 — 밤 '한 문장' 카드에 망원경(`stars`), 폭염·한파 특보에도 우산 아이콘·"☔ 우산 챙겨!", 흐린 날 노을 시간대 칸에 노을 그림, 데이터 없는 칸에 해·구름 그림, 흐려도 "맑음"·해 그림(주말 플랜·주말 화면), 행사 아이콘 `calendar`/`fireworks` 혼용 | 전체 검수 | `backend/seed/article.json:103,117`, `backend/services/feed_service.py:420`, `backend/services/weather_service.py:85,94`, `backend/services/weekend_plan.py:52,95,116`, `frontend/src/b/WeekPage.tsx:85` |
| [x] | 뜻 모를 표시 — "출처: 날씨각 (검수 전 예시)" 노출, "41번째 주", "해 지는 쪽 263°", 점수 뒤 "점" 없음, "추천: 피크닉각 추천", 노을 시각 18:12/6:12 이중 표기, 날짜 "10.04"/"10.4" 혼용, "구름많음"/"구름 많음" 혼용 | 전체 검수 | `backend/seed/article.json`, `frontend/src/b/SeasonPage.tsx:32`, `frontend/src/b/SkyPage.tsx`, `frontend/src/b/WeekPage.tsx:69` |
@@ -64,7 +64,8 @@
| [ ] | 문화정보 API 승인 후 실제 응답 확인 — 지금 `SERVICE_KEY_IS_NOT_REGISTERED_ERROR`(403). 날짜 형식, `gpsX`/`gpsY` 순서, 썸네일 https 여부 확인. 승인 직후 바로 보려면 Redis `event:{sido}:{날짜}` 키 삭제 | 전시 연결 중 발견 | `backend/services/external/culture_api.py` |
| [ ] | **[결정 필요]** 두 달 넘는 전시가 `MAX_EVENT_DAYS = 60` 필터에 걸려 빠짐 — 전시는 기준을 따로 둘지 | 전시 연결 중 발견 | `backend/services/week_service.py` |
| [ ] | 전시 썸네일 저작권 확인 — 데이터셋은 '이용허락범위 제한 없음'이나 원저작권이 주최 기관에 있을 수 있음 | 전시 연결 중 발견 | `backend/services/week_service.py` (`image_credit`) |
| [ ] | 계절 이야기 사진 연결 — 받은 13장(`frontend/public/season/`)을 `article`에 사진 칸 추가해 띠·목록·상세·피드에 표시, CC BY 계열은 저작자·라이선스 표시. 스켈레톤 작업 끝난 뒤 진행 | 사용자 요청 | `backend/common/database/model/models.py`, `backend/seed/article.json`, `frontend/src/b/SeasonPage.tsx`, `frontend/src/b/Sheets.tsx`, `frontend/src/b/TodayPage.tsx` |
| [x] | 계절 이야기 사진 연결 — 받은 13장(`frontend/public/season/`)을 `article`에 사진 칸 추가해 띠·목록·상세·피드에 표시, CC BY 계열은 저작자·라이선스 표시. 스켈레톤 작업 끝난 뒤 진행 | 사용자 요청 | `backend/common/database/model/models.py`, `backend/seed/article.json`, `frontend/src/b/SeasonPage.tsx`, `frontend/src/b/Sheets.tsx`, `frontend/src/b/TodayPage.tsx` |
| [ ] | **[결정 필요]** 계절 이야기 사진 2장 안 씀 — `di.jpg`(매미)는 불쾌지수 글과 주제가 다르고, `peanut_new.jpg`(일본 가토리시 삶은 땅콩, 왼쪽은 일본 대립종)는 '국산 햇땅콩' 글과 맞지 않아 아이콘 유지. 맞는 사진을 새로 구할지 | 계절 이야기 사진 연결 중 판단 | `frontend/public/season/sources.json`, `backend/seed/article.json` |
| [x] | (로컬 반영함, 운영 DB는 배포 때 같은 ALTER 필요) 로컬 DB 칼럼 추가 후 백엔드·워커 컨테이너 다시 빌드 — 지금 9810 백엔드는 이미지로 떠 있어 이번 백엔드 수정이 화면에 안 보임. 필요한 ALTER: `weather_daily.rain_prob_am`/`rain_prob_pm SMALLINT NULL`, `index_score.estimated BOOLEAN NOT NULL DEFAULT false`. 진행 중인 백엔드 작업이 끝난 뒤 실행 | 오늘/내일/토/일 작업 중 발견 | `backend/postgres-init/init.sql`, `compose.yaml` |
| [ ] | **[결정 필요]** 확정 시안(`docs/시안_B_확정.html` 489·585행, `.trend3`)에 각 점수 칸이 아직 "오늘·내일·모레" 3칸 — 실제는 오늘/내일/토/일 4칸. 시안도 고칠지 | 오늘/내일/토/일 작업 중 발견 | `docs/시안_B_확정.html` |
| [x] | (로컬 반영함, 운영은 배포 때) 행사 아이콘 `calendar`→`fireworks` 기존 DB 반영 — 코드·`init.sql` 기본값만 바뀌어 이미 들어간 행사는 그대로. 필요한 명령: `UPDATE event SET icon='fireworks' WHERE icon='calendar'; ALTER TABLE event ALTER COLUMN icon SET DEFAULT 'fireworks';` (운영은 확인 받고) | 아이콘 오용 수정 중 발견 | `backend/postgres-init/init.sql`, `backend/common/database/model/models.py` |
+2
View File
@@ -280,6 +280,8 @@ class Article(Base):
show_from: Mapped[Optional[date]] = mapped_column(Date, nullable=True)
show_until: Mapped[Optional[date]] = mapped_column(Date, nullable=True)
sort_order: Mapped[int] = mapped_column(SmallInteger, default=0)
image_url: Mapped[Optional[str]] = mapped_column(String(200), nullable=True)
image_credit: Mapped[Optional[str]] = mapped_column(String(60), nullable=True)
class Post(Base):
+5 -1
View File
@@ -374,5 +374,9 @@ CREATE TABLE IF NOT EXISTS public.article (
body JSONB NOT NULL, -- 문단 목록
show_from DATE NULL, -- 계절 소식이 보이는 기간 (NULL = 늘)
show_until DATE NULL,
sort_order SMALLINT NOT NULL DEFAULT 0
sort_order SMALLINT NOT NULL DEFAULT 0,
image_url VARCHAR(200) NULL, -- 사진 (frontend/public/season/, NULL = 아이콘)
image_credit VARCHAR(60) NULL -- 사진 출처 표기 ("ⓒ저작자 · CC BY-SA 4.0"), 표기가 필요 없으면 NULL
);
ALTER TABLE public.article ADD COLUMN IF NOT EXISTS image_url VARCHAR(200) NULL;
ALTER TABLE public.article ADD COLUMN IF NOT EXISTS image_credit VARCHAR(60) NULL;
+2
View File
@@ -171,6 +171,8 @@ class BandArticle(WebPacketProtocol):
title: str
meta: str
icon: str
image: Optional[str] = None
image_credit: Optional[str] = None
class Bands(WebPacketProtocol):
+2
View File
@@ -17,6 +17,8 @@ class ArticleSummary(WebPacketProtocol):
title: str
read_minutes: int
icon: str
image: Optional[str] = None # 있으면 아이콘 대신 사진
image_credit: Optional[str] = None # 사진 출처 표기 ("ⓒ저작자 · CC BY-SA 4.0")
class Res_SeasonWeek(Res_WebPacketProtocol):
+2 -1
View File
@@ -12,7 +12,8 @@ router = APIRouter(prefix="/v1/season", tags=["season"])
def _summary(a: Article) -> ArticleSummary:
return ArticleSummary(article_id=a.article_id, code=a.code, category=ArticleCategory(a.category), title=a.title, read_minutes=a.read_minutes, icon=a.icon)
return ArticleSummary(article_id=a.article_id, code=a.code, category=ArticleCategory(a.category), title=a.title, read_minutes=a.read_minutes, icon=a.icon,
image=a.image_url, image_credit=a.image_credit)
@router.get("/week", response_model=Res_SeasonWeek, response_model_exclude_none=True, summary="이번 주 계절 책: 시, 절기, 계절 소식")
+2 -1
View File
@@ -70,7 +70,8 @@ async def main() -> int:
]
articles = [
{**a, "show_from": date.fromisoformat(a["show_from"]) if a["show_from"] else None,
"show_until": date.fromisoformat(a["show_until"]) if a["show_until"] else None}
"show_until": date.fromisoformat(a["show_until"]) if a["show_until"] else None,
"image_url": a.get("image_url"), "image_credit": a.get("image_credit")}
for a in _json("article.json")
]
weeks = _json("season_week.json")
+17
View File
@@ -5,6 +5,8 @@
"title": "설악산 첫 단풍, 절정은 언제?",
"read_minutes": 3,
"icon": "maple",
"image_url": "/season/maple.jpg",
"image_credit": "ⓒJoycekim77 · CC BY-SA 3.0",
"show_from": "2026-09-20",
"show_until": "2026-10-25",
"body": [
@@ -20,6 +22,8 @@
"title": "하늘공원 억새가 반짝이는 시간",
"read_minutes": 2,
"icon": "sheaf",
"image_url": "/season/reed.jpg",
"image_credit": "ⓒJocelyndurrey · CC BY-SA 4.0",
"show_from": "2026-09-25",
"show_until": "2026-10-31",
"body": [
@@ -34,6 +38,8 @@
"title": "대관령 첫서리, 서울은 한 달 뒤",
"read_minutes": 2,
"icon": "snow",
"image_url": "/season/frost.jpg",
"image_credit": "ⓒSally V · CC BY-SA 4.0",
"show_from": "2026-10-01",
"show_until": "2026-11-15",
"body": [
@@ -77,6 +83,7 @@
"title": "노을은 왜 해 지고 15분 뒤가 더 붉을까?",
"read_minutes": 3,
"icon": "sunset",
"image_url": "/season/sunset.jpg",
"show_from": null,
"show_until": null,
"body": [
@@ -91,6 +98,7 @@
"title": "비 확률 30%면 우산을 챙겨야 할까?",
"read_minutes": 2,
"icon": "umbrella",
"image_url": "/season/umbrella.jpg",
"show_from": null,
"show_until": null,
"body": [
@@ -251,6 +259,7 @@
"title": "햇밤, 바로 먹을까 두었다 먹을까?",
"read_minutes": 2,
"icon": "chestnut",
"image_url": "/season/chestnut_new.jpg",
"show_from": "2026-09-15",
"show_until": "2026-10-31",
"body": [
@@ -281,6 +290,8 @@
"title": "은행 냄새 나는 길, 언제까지일까",
"read_minutes": 2,
"icon": "fallen_leaf",
"image_url": "/season/ginkgo.jpg",
"image_credit": "ⓒKorea.net · CC BY-SA 2.0",
"show_from": "2026-10-10",
"show_until": "2026-11-15",
"body": [
@@ -296,6 +307,8 @@
"title": "군고구마가 생각나는 첫 추위",
"read_minutes": 2,
"icon": "sweet_potato",
"image_url": "/season/sweet_potato.jpg",
"image_credit": "ⓒ국립국어원 · CC BY-SA 2.0 KR",
"show_from": "2026-10-15",
"show_until": "2026-12-31",
"body": [
@@ -311,6 +324,7 @@
"title": "노지 귤이 나오기 시작해요",
"read_minutes": 2,
"icon": "tangerine",
"image_url": "/season/tangerine.jpg",
"show_from": "2026-10-20",
"show_until": "2026-12-31",
"body": [
@@ -326,6 +340,8 @@
"title": "부사 사과가 나오는 때",
"read_minutes": 2,
"icon": "apple",
"image_url": "/season/apple_fuji.jpg",
"image_credit": "ⓒAomorikuma · CC BY-SA 4.0",
"show_from": "2026-10-20",
"show_until": "2026-11-30",
"body": [
@@ -341,6 +357,7 @@
"title": "김장, 언제 하면 좋을까?",
"read_minutes": 2,
"icon": "kimchi",
"image_url": "/season/kimjang.jpg",
"show_from": "2026-11-01",
"show_until": "2026-12-15",
"body": [
+4 -2
View File
@@ -362,7 +362,8 @@ class FeedService:
image=e.event.image_url, image_credit=image_credit(e.event)) for e in mix_kinds(events)[:4]],
top5=[_top(i) for i in items[:5]],
season=[
BandArticle(article_id=a.article_id, title=a.title, meta=f"{_CATEGORY_META[a.category]} · {a.read_minutes}분", icon=a.icon)
BandArticle(article_id=a.article_id, title=a.title, meta=f"{_CATEGORY_META[a.category]} · {a.read_minutes}분", icon=a.icon,
image=a.image_url, image_credit=a.image_credit)
for a in articles or [] if a.category == ArticleCategory.SEASON.value
],
),
@@ -450,7 +451,8 @@ class FeedService:
if t in (PostType.SEASON, PostType.TIP) and p.ref_id in c.articles:
a = c.articles[p.ref_id]
return PostData(**base, title=a.title, icon=a.icon, caption=" ".join(a.body[1:2]) or a.body[0],
slides=[RowsSlide(kind="rows", eyebrow=_CATEGORY_META[a.category], line=a.body[0], icon=a.icon)], share_messages=[a.title])
slides=[RowsSlide(kind="rows", eyebrow=_CATEGORY_META[a.category], line=a.body[0], icon=a.icon, image=a.image_url, image_credit=a.image_credit)],
share_messages=[a.title])
if t is PostType.EVENT:
soon = mix_kinds([e for e in c.events if e.event.start_date <= c.now.date() + timedelta(days=7) and e.event.end_date >= c.now.date()])
rank = p.index_rank or 1
+14
View File
@@ -2,8 +2,10 @@ from datetime import timedelta
import pytest
from httpx import ASGITransport, AsyncClient
from sqlalchemy import text
import services.season_service as season_service
from common.database.db_session_manager import DB_SESSION_MNG
from common.utils.kma_time import now_kst
from router.router import app
@@ -38,3 +40,15 @@ async def test_article_detail_and_not_found():
missing = (await client.get("/v1/season/article/9999")).json()
assert first["body"] and first["article"]["title"] == listed[0]["title"]
assert missing["result"]["desc"] == "NOT_FOUND"
@pytest.mark.anyio
async def test_article_photo_only_when_seeded():
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
listed = {a["code"]: a for a in (await client.get("/v1/season/article/list")).json()["articles"]}
umbrella = (await client.get(f"/v1/season/article/{listed['umbrella']['article_id']}")).json()["article"]
_, maple_id = await DB_SESSION_MNG.execute_lambda(lambda s: s.scalar(text("SELECT article_id FROM article WHERE code = 'maple'")))
maple = (await client.get(f"/v1/season/article/{maple_id}")).json()["article"]
assert umbrella["image"] == "/season/umbrella.jpg" and "image_credit" not in umbrella
assert maple["image"] == "/season/maple.jpg" and maple["image_credit"] == "ⓒJoycekim77 · CC BY-SA 3.0"
assert "image" not in listed["howgak"] and "image" not in listed["di"]
+16
View File
@@ -110,6 +110,14 @@ export type ArticleSummary = {
* Icon
*/
icon: string;
/**
* Image
*/
image?: string | null;
/**
* Image Credit
*/
image_credit?: string | null;
};
/**
@@ -148,6 +156,14 @@ export type BandArticle = {
* Icon
*/
icon: string;
/**
* Image
*/
image?: string | null;
/**
* Image Credit
*/
image_credit?: string | null;
};
/**
+2 -4
View File
@@ -5,7 +5,7 @@ import { ArticleCategory } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { ARTICLE_CAT, cardBg, dateRange, fall, loadOf, shortDay } from './lib'
import { useSheet } from './sheetContext'
import { Chips, Ic, Skel, StateBox } from './ui'
import { Chips, Ic, Skel, StateBox, Thumb } from './ui'
const CATS = [
['all', '전체'],
@@ -126,9 +126,7 @@ export function SeasonPage() {
<b className="mt-0.5 block font-jua text-[17.5px] leading-snug font-normal">{a.title}</b>
<small className="mt-1 block text-xs font-semibold text-(--ink3)">{a.read_minutes}분 읽기</small>
</span>
<span className={cx('grid h-[84px] place-items-center rounded-[18px]', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-[54px]" />
</span>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('h-[84px] rounded-[18px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-[54px]" creditClassName="right-1 bottom-1 max-w-[calc(100%-8px)] whitespace-normal!" />
</button>
))}
</div>
+2 -4
View File
@@ -28,7 +28,7 @@ import { useSky } from './skyContext'
import { SHARE_SIZES, shareImage, type ShareSize } from './storyImage'
import { SheetContext, useSheet, type SharePayload, type SheetState } from './sheetContext'
import { HeartIcon } from './svg'
import { Avatar, Ic, Skel, StateBox } from './ui'
import { Avatar, Ic, Skel, StateBox, Thumb } from './ui'
export function SheetProvider({ children }: { children: ReactNode }) {
const [state, setState] = useState<SheetState>(null)
@@ -397,9 +397,7 @@ function ArticleSheet({ articleId, onTitle }: { articleId: number; onTitle: (t:
if (!a) return <Body>{load === 'loading' ? <ArticleSkel /> : <StateBox load={load} onRetry={() => q.refetch()} empty="글을 찾지 못했어요." hold={<ArticleSkel />} className="inset-0" />}</Body>
return (
<Body>
<div className={cx('mb-3.5 grid h-[150px] place-items-center rounded-[20px]', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-24" />
</div>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('mb-3.5 h-[150px] rounded-[20px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-24" />
<p className="text-[13px] font-extrabold text-(--ink2)">{articleMeta(a)}</p>
<h4 className="mt-1.5 mb-2.5 font-jua text-2xl leading-tight font-normal">{a.title}</h4>
{(q.data?.body ?? []).map((t) => (
+1 -3
View File
@@ -284,9 +284,7 @@ function SeasonBand({ news }: { news: BandArticle[] }) {
<Rail>
{news.map((a) => (
<button key={a.article_id} type="button" onClick={() => open({ type: 'article', articleId: a.article_id })} className="w-[200px] cursor-pointer overflow-hidden rounded-[22px] bg-white text-left shadow-[inset_0_-5px_0_var(--shade),0_8px_16px_rgb(40_48_74/0.06)]">
<span className={cx('grid h-[116px] place-items-center', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-[76px]" />
</span>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('h-[116px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-[76px]" />
<span className="block px-3 pt-2.5 pb-3">
<b className="block font-jua text-[16.5px] leading-snug font-normal">{a.title}</b>
<small className="text-[12.5px] font-semibold text-(--ink2)">{a.meta}</small>
+3 -3
View File
@@ -17,16 +17,16 @@ export function Credit({ text, className = 'right-1 bottom-1' }: { text: string;
return <small className={cx('pointer-events-none absolute z-[1] rounded-[5px] bg-[rgb(16_20_34/0.5)] px-1 py-px text-[9px] leading-tight font-semibold whitespace-nowrap text-white', className)}>{text}</small>
}
type ThumbProps = { image?: string | null; icon: string; credit?: string | null; className?: string; iconClassName?: string; children?: ReactNode }
type ThumbProps = { image?: string | null; icon: string; credit?: string | null; className?: string; iconClassName?: string; creditClassName?: string; children?: ReactNode }
/** 사진이 있으면 사진(+출처), 없거나 못 불러오면 아이콘 */
export function Thumb({ image, icon, credit, className, iconClassName, children }: ThumbProps) {
export function Thumb({ image, icon, credit, className, iconClassName, creditClassName, children }: ThumbProps) {
const [failed, setFailed] = useState<string | null>(null)
const photo = image && image !== failed ? image : null
return (
<span className={cx('relative grid place-items-center overflow-hidden', className)}>
{photo ? <img src={photo} alt="" loading="lazy" decoding="async" onError={() => setFailed(photo)} className="absolute inset-0 size-full object-cover" /> : <Ic name={icon} className={iconClassName} />}
{photo && credit && <Credit text={credit} />}
{photo && credit && <Credit text={credit} className={creditClassName} />}
{children}
</span>
)