diff --git a/.gitignore b/.gitignore index 7f38461..827cf98 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ venv/ # 생성물: python backend/scripts/export_openapi.py 로 다시 만든다 backend/openapi.json +backend/uploads/ # 도구 캐시·설정 (impeccable 디자인 도구) .impeccable/ diff --git a/backend/common/database/model/models.py b/backend/common/database/model/models.py index c85de53..02b6627 100644 --- a/backend/common/database/model/models.py +++ b/backend/common/database/model/models.py @@ -336,6 +336,14 @@ class PostLike(Base): created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) +class PostLikeAnon(Base): + __tablename__ = "post_like_anon" + + post_id: Mapped[int] = mapped_column(BigInteger, primary_key=True) + ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + + class PostSave(Base): __tablename__ = "post_save" @@ -364,13 +372,21 @@ class CommentLike(Base): created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) +class CommentLikeAnon(Base): + __tablename__ = "comment_like_anon" + + comment_id: Mapped[int] = mapped_column(BigInteger, primary_key=True) + ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + + class MyGak(Base): __tablename__ = "my_gak" my_gak_id: Mapped[int] = mapped_column(BigInteger, primary_key=True) user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True)) - index_a: Mapped[int] = mapped_column(SmallInteger) - index_b: Mapped[int] = mapped_column(SmallInteger) + name: Mapped[str] = mapped_column(String(12)) + rule: Mapped[dict] = mapped_column(JSONB) created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) @@ -382,6 +398,7 @@ class Talk(Base): region_code: Mapped[str] = mapped_column(String(10)) body: Mapped[str] = mapped_column(String(100)) weather: Mapped[Optional[str]] = mapped_column(String(30), nullable=True) + image: Mapped[Optional[str]] = mapped_column(String(200), nullable=True) like_count: Mapped[int] = mapped_column(Integer, default=0) report_count: Mapped[int] = mapped_column(Integer, default=0) hidden: Mapped[bool] = mapped_column(Boolean, default=False) @@ -397,6 +414,14 @@ class TalkLike(Base): created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) +class TalkLikeAnon(Base): + __tablename__ = "talk_like_anon" + + talk_id: Mapped[int] = mapped_column(BigInteger, primary_key=True) + ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + + class TalkReport(Base): __tablename__ = "talk_report" diff --git a/backend/common/liker.py b/backend/common/liker.py new file mode 100644 index 0000000..ed7680d --- /dev/null +++ b/backend/common/liker.py @@ -0,0 +1,38 @@ +import hashlib +import hmac +import uuid +from dataclasses import dataclass +from typing import Optional + +from fastapi import Depends, Request + +from common.auth import optional_user +from common.database.model.models import User +from config.settings import settings + + +@dataclass(frozen=True) +class Liker: + """좋아요를 누른 사람. 로그인했으면 user_id, 아니면 IP 해시로 한 번만 센다.""" + user_id: Optional[uuid.UUID] + ip_hash: str + + +def client_ip(request: Request) -> str: + """nginx 가 X-Forwarded-For 맨 끝에 붙인 접속 주소만 믿는다. 앞쪽은 클라이언트가 마음대로 넣을 수 있다.""" + xff = request.headers.get("x-forwarded-for", "") + last = xff.rsplit(",", 1)[-1].strip() + if last: + return last + return request.client.host if request.client else "" + + +def ip_hash(ip: str) -> str: + """IP 원문은 저장하지 않는다. 서버 비밀값으로 HMAC 한 값만 남긴다.""" + if not settings.jwt_refresh_secret: + raise RuntimeError("JWT_REFRESH_SECRET is empty") + return hmac.new(settings.jwt_refresh_secret.encode(), f"like-ip:{ip}".encode(), hashlib.sha256).hexdigest() + + +async def liker(request: Request, user: Optional[User] = Depends(optional_user)) -> Liker: + return Liker(user_id=user.user_id if user else None, ip_hash=ip_hash(client_ip(request))) diff --git a/backend/config/settings.py b/backend/config/settings.py index f56e97b..c33b54e 100644 --- a/backend/config/settings.py +++ b/backend/config/settings.py @@ -34,6 +34,9 @@ class Settings(BaseSettings): # 지역 검색 페이지의 정적 HTML 을 받아 올 프론트 주소 (같은 docker 망 안) frontend_internal_url: str = "http://frontend" + # 사람 글 사진을 저장할 폴더 (compose 볼륨) + upload_dir: str = "uploads" + jwt_access_secret: str = "" jwt_refresh_secret: str = "" jwt_access_minutes: int = 60 diff --git a/backend/crud/my_gak_crud.py b/backend/crud/my_gak_crud.py index ab4f117..c3f39ab 100644 --- a/backend/crud/my_gak_crud.py +++ b/backend/crud/my_gak_crud.py @@ -1,7 +1,6 @@ import uuid from sqlalchemy import delete, func, select -from sqlalchemy.dialects.postgresql import insert from sqlalchemy.ext.asyncio import AsyncSession from common.database.model.models import MyGak @@ -14,10 +13,11 @@ class MyGakCRUD: async def count(self, s: AsyncSession, user_id: uuid.UUID) -> int: return await s.scalar(select(func.count()).select_from(MyGak).where(MyGak.user_id == user_id)) - async def add(self, s: AsyncSession, user_id: uuid.UUID, a: int, b: int) -> MyGak: - """같은 조합이 이미 있으면 그것을 돌려준다.""" - await s.execute(insert(MyGak).values(user_id=user_id, index_a=a, index_b=b).on_conflict_do_nothing()) - return await s.scalar(select(MyGak).where(MyGak.user_id == user_id, MyGak.index_a == a, MyGak.index_b == b)) + async def add(self, s: AsyncSession, user_id: uuid.UUID, name: str, rule: dict) -> MyGak: + row = MyGak(user_id=user_id, name=name, rule=rule) + s.add(row) + await s.flush() + return row async def delete(self, s: AsyncSession, user_id: uuid.UUID, my_gak_id: int) -> bool: res = await s.execute(delete(MyGak).where(MyGak.my_gak_id == my_gak_id, MyGak.user_id == user_id).returning(MyGak.my_gak_id)) diff --git a/backend/crud/reaction_crud.py b/backend/crud/reaction_crud.py index 753e757..274f9f8 100644 --- a/backend/crud/reaction_crud.py +++ b/backend/crud/reaction_crud.py @@ -5,17 +5,25 @@ from sqlalchemy import delete, select, update from sqlalchemy.dialects.postgresql import insert from sqlalchemy.ext.asyncio import AsyncSession -from common.database.model.models import Comment, CommentLike, Post, PostLike, PostSave, User +from common.database.model.models import Comment, CommentLike, CommentLikeAnon, Post, PostLike, PostLikeAnon, PostSave, User +from common.liker import Liker + + +async def toggle_like_row(s: AsyncSession, who: Liker, member: type, anon: type, id_name: str, id_value: int, on: bool) -> bool: + """로그인했으면 member 표에 user_id 로, 아니면 anon 표에 ip_hash 로 넣거나 지운다. 실제로 바뀌었으면 True.""" + model, keys = (member, {id_name: id_value, "user_id": who.user_id}) if who.user_id is not None else (anon, {id_name: id_value, "ip_hash": who.ip_hash}) + id_col = getattr(model, id_name) + if on: + res = await s.execute(insert(model).values(**keys).on_conflict_do_nothing().returning(id_col)) + else: + res = await s.execute(delete(model).where(*(getattr(model, k) == v for k, v in keys.items())).returning(id_col)) + return res.first() is not None class ReactionCRUD: - async def toggle_post_like(self, s: AsyncSession, post_id: int, user_id: uuid.UUID, on: bool) -> int: + async def toggle_post_like(self, s: AsyncSession, post_id: int, who: Liker, on: bool) -> int: """좋아요를 켜거나 끄고, 실제로 바뀌었을 때만 수를 고친다. 바뀐 뒤 좋아요 수를 돌려준다.""" - if on: - res = await s.execute(insert(PostLike).values(post_id=post_id, user_id=user_id).on_conflict_do_nothing().returning(PostLike.post_id)) - else: - res = await s.execute(delete(PostLike).where(PostLike.post_id == post_id, PostLike.user_id == user_id).returning(PostLike.post_id)) - if res.first() is not None: + if await toggle_like_row(s, who, PostLike, PostLikeAnon, "post_id", post_id, on): await s.execute(update(Post).where(Post.post_id == post_id).values(like_count=Post.like_count + (1 if on else -1))) return await s.scalar(select(Post.like_count).where(Post.post_id == post_id)) @@ -34,6 +42,9 @@ class ReactionCRUD: saved = set((await s.scalars(select(PostSave.post_id).where(PostSave.user_id == user_id, PostSave.post_id.in_(post_ids)))).all()) return liked, saved + async def anon_liked_posts(self, s: AsyncSession, ip_hash: str, post_ids: list[int]) -> set[int]: + return set((await s.scalars(select(PostLikeAnon.post_id).where(PostLikeAnon.ip_hash == ip_hash, PostLikeAnon.post_id.in_(post_ids)))).all()) + async def saved_posts(self, s: AsyncSession, user_id: uuid.UUID, cursor: Optional[int], limit: int) -> list[tuple[Post, PostSave]]: stmt = select(Post, PostSave).join(PostSave, PostSave.post_id == Post.post_id).where(PostSave.user_id == user_id, Post.deleted.is_(False)) if cursor is not None: @@ -50,6 +61,10 @@ class ReactionCRUD: stmt = select(CommentLike.comment_id).where(CommentLike.user_id == user_id, CommentLike.comment_id.in_(comment_ids)) return set((await s.scalars(stmt)).all()) + async def anon_liked_comments(self, s: AsyncSession, ip_hash: str, comment_ids: list[int]) -> set[int]: + stmt = select(CommentLikeAnon.comment_id).where(CommentLikeAnon.ip_hash == ip_hash, CommentLikeAnon.comment_id.in_(comment_ids)) + return set((await s.scalars(stmt)).all()) + async def add_comment(self, s: AsyncSession, post_id: int, user_id: uuid.UUID, body: str) -> Comment: c = Comment(post_id=post_id, user_id=user_id, body=body) s.add(c) @@ -68,14 +83,10 @@ class ReactionCRUD: await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count - 1)) return True - async def toggle_comment_like(self, s: AsyncSession, comment_id: int, user_id: uuid.UUID, on: bool) -> Optional[int]: + async def toggle_comment_like(self, s: AsyncSession, comment_id: int, who: Liker, on: bool) -> Optional[int]: exists = await s.scalar(select(Comment.comment_id).where(Comment.comment_id == comment_id, Comment.deleted.is_(False))) if exists is None: return None - if on: - res = await s.execute(insert(CommentLike).values(comment_id=comment_id, user_id=user_id).on_conflict_do_nothing().returning(CommentLike.comment_id)) - else: - res = await s.execute(delete(CommentLike).where(CommentLike.comment_id == comment_id, CommentLike.user_id == user_id).returning(CommentLike.comment_id)) - if res.first() is not None: + if await toggle_like_row(s, who, CommentLike, CommentLikeAnon, "comment_id", comment_id, on): await s.execute(update(Comment).where(Comment.comment_id == comment_id).values(like_count=Comment.like_count + (1 if on else -1))) return await s.scalar(select(Comment.like_count).where(Comment.comment_id == comment_id)) diff --git a/backend/crud/talk_crud.py b/backend/crud/talk_crud.py index dc681a8..2c59ad5 100644 --- a/backend/crud/talk_crud.py +++ b/backend/crud/talk_crud.py @@ -6,7 +6,9 @@ from sqlalchemy import delete, func, select, update from sqlalchemy.dialects.postgresql import insert from sqlalchemy.ext.asyncio import AsyncSession -from common.database.model.models import Region, Talk, TalkLike, TalkReport, User, UserBlock +from common.database.model.models import Region, Talk, TalkLike, TalkLikeAnon, TalkReport, User, UserBlock +from common.liker import Liker +from crud.reaction_crud import toggle_like_row class TalkCRUD: @@ -27,11 +29,14 @@ class TalkCRUD: async def liked(self, s: AsyncSession, user_id: uuid.UUID, talk_ids: list[int]) -> set[int]: return set((await s.scalars(select(TalkLike.talk_id).where(TalkLike.user_id == user_id, TalkLike.talk_id.in_(talk_ids)))).all()) + async def anon_liked(self, s: AsyncSession, ip_hash: str, talk_ids: list[int]) -> set[int]: + return set((await s.scalars(select(TalkLikeAnon.talk_id).where(TalkLikeAnon.ip_hash == ip_hash, TalkLikeAnon.talk_id.in_(talk_ids)))).all()) + async def count_since(self, s: AsyncSession, user_id: uuid.UUID, since: datetime) -> int: return await s.scalar(select(func.count()).select_from(Talk).where(Talk.user_id == user_id, Talk.created_at >= since)) - async def add(self, s: AsyncSession, user_id: uuid.UUID, region_code: str, body: str, weather: Optional[str]) -> Talk: - t = Talk(user_id=user_id, region_code=region_code, body=body, weather=weather) + async def add(self, s: AsyncSession, user_id: uuid.UUID, region_code: str, body: str, weather: Optional[str], image: Optional[str] = None) -> Talk: + t = Talk(user_id=user_id, region_code=region_code, body=body, weather=weather, image=image) s.add(t) await s.flush() await s.refresh(t) @@ -44,13 +49,9 @@ class TalkCRUD: res = await s.execute(update(Talk).where(Talk.talk_id == talk_id, Talk.user_id == user_id, Talk.deleted.is_(False)).values(deleted=True).returning(Talk.talk_id)) return res.first() is not None - async def toggle_like(self, s: AsyncSession, talk_id: int, user_id: uuid.UUID, on: bool) -> int: + async def toggle_like(self, s: AsyncSession, talk_id: int, who: Liker, on: bool) -> int: """좋아요를 켜거나 끄고, 실제로 바뀌었을 때만 수를 고친다. 바뀐 뒤 좋아요 수를 돌려준다.""" - if on: - res = await s.execute(insert(TalkLike).values(talk_id=talk_id, user_id=user_id).on_conflict_do_nothing().returning(TalkLike.talk_id)) - else: - res = await s.execute(delete(TalkLike).where(TalkLike.talk_id == talk_id, TalkLike.user_id == user_id).returning(TalkLike.talk_id)) - if res.first() is not None: + if await toggle_like_row(s, who, TalkLike, TalkLikeAnon, "talk_id", talk_id, on): await s.execute(update(Talk).where(Talk.talk_id == talk_id).values(like_count=Talk.like_count + (1 if on else -1))) return await s.scalar(select(Talk.like_count).where(Talk.talk_id == talk_id)) diff --git a/backend/postgres-init/init.sql b/backend/postgres-init/init.sql index 34e1094..0550fab 100644 --- a/backend/postgres-init/init.sql +++ b/backend/postgres-init/init.sql @@ -211,6 +211,14 @@ CREATE TABLE IF NOT EXISTS public.post_like ( PRIMARY KEY (post_id, user_id) ); +-- 로그인 없이 누른 좋아요. IP 원문 대신 HMAC-SHA256 해시로 한 IP 에 한 번만 센다. like_count 는 post_like 와 이 표를 합한 수 +CREATE TABLE IF NOT EXISTS public.post_like_anon ( + post_id BIGINT NOT NULL, + ip_hash CHAR(64) NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY (post_id, ip_hash) +); + CREATE TABLE IF NOT EXISTS public.post_save ( post_id BIGINT NOT NULL, user_id UUID NOT NULL, @@ -248,16 +256,22 @@ CREATE TABLE IF NOT EXISTS public.comment_like ( PRIMARY KEY (comment_id, user_id) ); --- 나만의 각: 공식 각 두 개를 섞은 조합. 점수는 저장하지 않고 두 각의 오늘 점수 중 낮은 쪽을 그때 쓴다 +CREATE TABLE IF NOT EXISTS public.comment_like_anon ( + comment_id BIGINT NOT NULL, + ip_hash CHAR(64) NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY (comment_id, ip_hash) +); + +-- 나만의 각: 사용자가 이름과 날씨 조건(수치)을 정해 저장. 점수는 저장하지 않고 볼 때 그 동네 예보로 계산한다 CREATE TABLE IF NOT EXISTS public.my_gak ( my_gak_id BIGSERIAL PRIMARY KEY, user_id UUID NOT NULL, - index_a SMALLINT NOT NULL, -- 같은 조합은 하나로: 작은 index_id 가 a - index_b SMALLINT NOT NULL, - created_at TIMESTAMPTZ NOT NULL DEFAULT now(), - CHECK (index_a < index_b) + name VARCHAR(12) NOT NULL, -- 사용자가 지은 이름 (소맥각) + rule JSONB NOT NULL, -- 조건: temp [lo,hi]·rain·wind_max·air·humidity [lo,hi]·slots + created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); -CREATE UNIQUE INDEX IF NOT EXISTS uq_my_gak ON public.my_gak (user_id, index_a, index_b); +CREATE INDEX IF NOT EXISTS ix_my_gak_user ON public.my_gak (user_id); -- 동네 이야기: 사용자가 쓴 짧은 글(전국에 보임). 쓸 때의 동네 날씨를 함께 남긴다 CREATE TABLE IF NOT EXISTS public.talk ( @@ -266,6 +280,7 @@ CREATE TABLE IF NOT EXISTS public.talk ( region_code VARCHAR(10) NOT NULL, body VARCHAR(100) NOT NULL, weather VARCHAR(30), -- 쓸 때 날씨 한 줄 (예: 18° 맑음) + image VARCHAR(200), -- 올린 사진 경로 (위치 정보를 지운 사본) like_count INTEGER NOT NULL DEFAULT 0, report_count INTEGER NOT NULL DEFAULT 0, -- 로그인한 사람의 신고만 센다 hidden BOOLEAN NOT NULL DEFAULT FALSE, -- 신고가 쌓이면 자동으로 숨김 @@ -282,6 +297,13 @@ CREATE TABLE IF NOT EXISTS public.talk_like ( PRIMARY KEY (talk_id, user_id) ); +CREATE TABLE IF NOT EXISTS public.talk_like_anon ( + talk_id BIGINT NOT NULL, + ip_hash CHAR(64) NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + PRIMARY KEY (talk_id, ip_hash) +); + CREATE TABLE IF NOT EXISTS public.talk_report ( talk_id BIGINT NOT NULL, user_id UUID NOT NULL, diff --git a/backend/requirements.txt b/backend/requirements.txt index ce49808..fd414af 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -12,3 +12,5 @@ apscheduler>=3.10,<4 pytest python-jose[cryptography] bcrypt +python-multipart +Pillow diff --git a/backend/router/v1/feed/feed.py b/backend/router/v1/feed/feed.py index fa8cfc9..90dc77a 100644 --- a/backend/router/v1/feed/feed.py +++ b/backend/router/v1/feed/feed.py @@ -5,6 +5,7 @@ from fastapi import APIRouter, Depends, Path, Query from common.auth import optional_user from common.database.model.models import User from common.enums import ErrorType +from common.liker import Liker, liker from common.models.errors import error_info from router.v1.feed.protocol import Res_Feed, Res_Post from services.feed_service import FeedService @@ -15,7 +16,7 @@ router = APIRouter(prefix="/v1/feed", tags=["feed"]) @router.get("", response_model=Res_Feed, response_model_exclude_none=True, summary="메인 피드: 하늘 영역, 오늘의 각, 오늘 포스트 전부, 띠") async def get_feed( - region: str = Query(..., description="구 행정코드"), user: Optional[User] = Depends(optional_user), + region: str = Query(..., description="구 행정코드"), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker), service: FeedService = Depends(), reactions: ReactionService = Depends(), ) -> Res_Feed: err, feed = await service.feed(region) @@ -24,10 +25,14 @@ async def get_feed( ids = [p.post_id for p in feed.posts] counts = await reactions.counts(ids) liked, saved = await reactions.marks(user, ids) + # 캐시된 피드는 모두에게 같으니, 로그인 안 한 사람의 좋아요 표시는 캐시 밖에서 IP 해시로 덧붙인다 + anon_liked = await reactions.anon_liked(who.ip_hash, ids) if user is None else set() for p in feed.posts: p.like_count, p.comment_count = counts.get(p.post_id, (p.like_count, p.comment_count)) if user is not None: p.liked, p.saved = p.post_id in liked, p.post_id in saved + else: + p.liked = p.post_id in anon_liked return feed diff --git a/backend/router/v1/my_gak/my_gak.py b/backend/router/v1/my_gak/my_gak.py index 87e29e8..c70c546 100644 --- a/backend/router/v1/my_gak/my_gak.py +++ b/backend/router/v1/my_gak/my_gak.py @@ -7,35 +7,41 @@ from common.database.model.models import MyGak, User from common.enums import ErrorType from common.models.errors import error_info from common.models.gmodel import Res_WebPacketProtocol -from router.v1.my_gak.protocol import MyGakData, Req_MyGak, Res_MyGak, Res_MyGakList +from router.v1.my_gak.protocol import MyGakData, MyGakRule, MyGakScore, Req_MyGak, Req_MyGakScore, Res_MyGak, Res_MyGakList, Res_MyGakScore from services.my_gak_service import MyGakService router = APIRouter(prefix="/v1/my-gak", tags=["my-gak"]) def _data(g: MyGak) -> MyGakData: - return MyGakData(my_gak_id=g.my_gak_id, index_ids=[g.index_a, g.index_b]) + return MyGakData(my_gak_id=g.my_gak_id, name=g.name, rule=MyGakRule(**g.rule)) -@router.get("", response_model=Res_MyGakList, response_model_exclude_none=True, summary="내 각과 섞을 수 있는 공식 각 (로그인 없이도 섞을 수 있는 목록은 보임)") +@router.get("", response_model=Res_MyGakList, response_model_exclude_none=True, summary="내 각 목록 (로그인하지 않았으면 빈 목록)") async def list_my_gak(user: Optional[User] = Depends(optional_user), service: MyGakService = Depends()) -> Res_MyGakList: - err, mixable = await service.mixable() - if err is not ErrorType.SUCCESS: - return Res_MyGakList(result=error_info(err)) if user is None: - return Res_MyGakList(mixable=mixable) + return Res_MyGakList() err, rows = await service.mine(user) if err is not ErrorType.SUCCESS: return Res_MyGakList(result=error_info(err)) - return Res_MyGakList(mixable=mixable, items=[_data(g) for g in rows]) + return Res_MyGakList(items=[_data(g) for g in rows]) -@router.post("", response_model=Res_MyGak, response_model_exclude_none=True, summary="공식 각 두 개를 섞어 내 각 만들기 (같은 조합이면 있는 것을 돌려줌)") +@router.post("", response_model=Res_MyGak, response_model_exclude_none=True, summary="이름과 날씨 조건으로 내 각 만들기") async def add_my_gak(req: Req_MyGak, user: User = Depends(current_user), service: MyGakService = Depends()) -> Res_MyGak: - err, g = await service.add(user, req.index_ids) + err, g = await service.add(user, req.name, req.rule.model_dump(exclude_none=True)) return Res_MyGak(result=error_info(err)) if err is not ErrorType.SUCCESS or g is None else Res_MyGak(item=_data(g)) +@router.post("/score", response_model=Res_MyGakScore, response_model_exclude_none=True, summary="조건들의 그 동네 오늘 점수 (로그인 없이, 받은 링크의 각도)") +async def score_my_gak(req: Req_MyGakScore, service: MyGakService = Depends()) -> Res_MyGakScore: + err, got = await service.score(req.region_code, [r.model_dump(exclude_none=True) for r in req.rules]) + if err is not ErrorType.SUCCESS or got is None: + return Res_MyGakScore(result=error_info(err)) + now_slot, scores = got + return Res_MyGakScore(now_slot=now_slot, scores=[MyGakScore(**x) for x in scores]) + + @router.delete("/{my_gak_id}", response_model=Res_WebPacketProtocol, response_model_exclude_none=True, summary="내 각 지우기") async def delete_my_gak(my_gak_id: int = Path(...), user: User = Depends(current_user), service: MyGakService = Depends()) -> Res_WebPacketProtocol: return Res_WebPacketProtocol(result=error_info(await service.delete(user, my_gak_id))) diff --git a/backend/router/v1/my_gak/protocol.py b/backend/router/v1/my_gak/protocol.py index eba7cf3..5f29dea 100644 --- a/backend/router/v1/my_gak/protocol.py +++ b/backend/router/v1/my_gak/protocol.py @@ -1,23 +1,62 @@ -from typing import Optional +from typing import Literal, Optional -from pydantic import Field +from pydantic import Field, model_validator from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol +Slot = Literal["morning", "day", "evening", "night"] + + +class MyGakRule(WebPacketProtocol): + temp: Optional[list[float]] = Field(None, min_length=2, max_length=2, description="체감온도 범위 [최저, 최고]° (-20~40)") + rain: Optional[Literal["dry", "wet"]] = Field(None, description="dry: 비 안 와야 / wet: 비 와야 / 없으면 상관없음") + wind_max: Optional[float] = Field(None, ge=1, le=20, description="바람 상한 m/s") + air: Optional[Literal["good", "normal"]] = Field(None, description="미세먼지 허용 단계: good 좋음까지 / normal 보통까지") + humidity: Optional[list[int]] = Field(None, min_length=2, max_length=2, description="습도 범위 [최저, 최고]%") + slots: list[Slot] = Field(default=["morning", "day", "evening", "night"], min_length=1, max_length=4, description="볼 시간대") + + @model_validator(mode="after") + def _check(self) -> "MyGakRule": + if self.temp and not (-20 <= self.temp[0] < self.temp[1] <= 40): + raise ValueError("temp 는 -20~40 안에서 최저 < 최고") + if self.humidity and not (0 <= self.humidity[0] < self.humidity[1] <= 100): + raise ValueError("humidity 는 0~100 안에서 최저 < 최고") + if not (self.temp or self.rain or self.wind_max is not None or self.air or self.humidity): + raise ValueError("조건을 하나 이상 정해야 함") + return self + class MyGakData(WebPacketProtocol): my_gak_id: int - index_ids: list[int] = Field(description="섞은 공식 각 두 개. 점수는 두 각의 오늘 점수 중 낮은 쪽") + name: str + rule: MyGakRule class Req_MyGak(Req_WebPacketProtocol): - index_ids: list[int] = Field(min_length=2, max_length=2, description="섞을 공식 각 두 개") + name: str = Field(min_length=1, max_length=12, description="내 각 이름 (끝에 '각'이 없으면 붙인다)") + rule: MyGakRule class Res_MyGakList(Res_WebPacketProtocol): - mixable: list[int] = Field(default=[], description="섞을 수 있는 공식 각 index_id") items: list[MyGakData] = Field(default=[], description="내 각. 로그인하지 않았으면 비어 있음") class Res_MyGak(Res_WebPacketProtocol): item: Optional[MyGakData] = None + + +class Req_MyGakScore(Req_WebPacketProtocol): + region_code: str = Field(min_length=10, max_length=10) + rules: list[MyGakRule] = Field(min_length=1, max_length=21) + + +class MyGakScore(WebPacketProtocol): + score: Optional[int] = Field(None, description="지금 시간대 점수. 지금이 고른 시간대가 아니면 고른 시간대 중 가장 좋은 점수. 예보가 없으면 null") + slot: Optional[Slot] = Field(None, description="score 가 어느 시간대 점수인지") + slots: dict[str, int] = Field(default={}, description="고른 시간대별 점수 (아침·낮·저녁·밤 순)") + reasons: list[str] = Field(default=[], description="score 근거: 조건마다 그 시간대 실제 값") + + +class Res_MyGakScore(Res_WebPacketProtocol): + now_slot: Optional[Slot] = None + scores: list[MyGakScore] = [] diff --git a/backend/router/v1/reaction/reaction.py b/backend/router/v1/reaction/reaction.py index c6187a0..6e8ec63 100644 --- a/backend/router/v1/reaction/reaction.py +++ b/backend/router/v1/reaction/reaction.py @@ -5,6 +5,7 @@ from fastapi import APIRouter, Depends, Path, Query from common.auth import current_user, optional_user from common.database.model.models import User from common.enums import ErrorType, PostType +from common.liker import Liker, liker from common.models.errors import error_info from common.models.gmodel import Res_WebPacketProtocol from common.utils.kma_time import KST @@ -21,19 +22,19 @@ def _comment(v: CommentView) -> CommentData: return CommentData(comment_id=c.comment_id, nickname=v.nickname, character=v.character, color=v.color, mood=v.mood, body=c.body, like_count=c.like_count, liked=v.liked, mine=v.mine, created_at=c.created_at.astimezone(KST)) -async def _like(post_id: int, user: User, on: bool, service: ReactionService) -> Res_PostLike: - err, count = await service.like_post(post_id, user, on) +async def _like(post_id: int, who: Liker, on: bool, service: ReactionService) -> Res_PostLike: + err, count = await service.like_post(post_id, who, on) return Res_PostLike(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_PostLike(liked=on, like_count=count) -@router.post("/post/{post_id}/like", response_model=Res_PostLike, response_model_exclude_none=True, summary="좋아요") -async def like_post(post_id: int = Path(...), user: User = Depends(current_user), service: ReactionService = Depends()) -> Res_PostLike: - return await _like(post_id, user, True, service) +@router.post("/post/{post_id}/like", response_model=Res_PostLike, response_model_exclude_none=True, summary="좋아요 (로그인 없으면 IP 당 한 번)") +async def like_post(post_id: int = Path(...), who: Liker = Depends(liker), service: ReactionService = Depends()) -> Res_PostLike: + return await _like(post_id, who, True, service) @router.delete("/post/{post_id}/like", response_model=Res_PostLike, response_model_exclude_none=True, summary="좋아요 취소") -async def unlike_post(post_id: int = Path(...), user: User = Depends(current_user), service: ReactionService = Depends()) -> Res_PostLike: - return await _like(post_id, user, False, service) +async def unlike_post(post_id: int = Path(...), who: Liker = Depends(liker), service: ReactionService = Depends()) -> Res_PostLike: + return await _like(post_id, who, False, service) @router.post("/post/{post_id}/save", response_model=Res_PostSave, response_model_exclude_none=True, summary="저장") @@ -59,9 +60,10 @@ async def list_saved(cursor: Optional[int] = Query(None), user: User = Depends(c @router.get("/post/{post_id}/comment/list", response_model=Res_CommentList, response_model_exclude_none=True, summary="댓글 목록 (로그인 없이 보기)") async def list_comments( - post_id: int = Path(...), cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), service: ReactionService = Depends() + post_id: int = Path(...), cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker), + service: ReactionService = Depends(), ) -> Res_CommentList: - err, items = await service.comments(post_id, user, cursor) + err, items = await service.comments(post_id, user, who.ip_hash, cursor) if err is not ErrorType.SUCCESS: return Res_CommentList(result=error_info(err)) return Res_CommentList(comments=[_comment(v) for v in items], next_cursor=items[-1].comment.comment_id if len(items) == PAGE else None) @@ -78,16 +80,16 @@ async def delete_comment(comment_id: int = Path(...), user: User = Depends(curre return Res_WebPacketProtocol(result=error_info(await service.delete_comment(comment_id, user))) -async def _clike(comment_id: int, user: User, on: bool, service: ReactionService) -> Res_CommentLike: - err, count = await service.like_comment(comment_id, user, on) +async def _clike(comment_id: int, who: Liker, on: bool, service: ReactionService) -> Res_CommentLike: + err, count = await service.like_comment(comment_id, who, on) return Res_CommentLike(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_CommentLike(liked=on, like_count=count) -@router.post("/comment/{comment_id}/like", response_model=Res_CommentLike, response_model_exclude_none=True, summary="댓글 좋아요") -async def like_comment(comment_id: int = Path(...), user: User = Depends(current_user), service: ReactionService = Depends()) -> Res_CommentLike: - return await _clike(comment_id, user, True, service) +@router.post("/comment/{comment_id}/like", response_model=Res_CommentLike, response_model_exclude_none=True, summary="댓글 좋아요 (로그인 없으면 IP 당 한 번)") +async def like_comment(comment_id: int = Path(...), who: Liker = Depends(liker), service: ReactionService = Depends()) -> Res_CommentLike: + return await _clike(comment_id, who, True, service) @router.delete("/comment/{comment_id}/like", response_model=Res_CommentLike, response_model_exclude_none=True, summary="댓글 좋아요 취소") -async def unlike_comment(comment_id: int = Path(...), user: User = Depends(current_user), service: ReactionService = Depends()) -> Res_CommentLike: - return await _clike(comment_id, user, False, service) +async def unlike_comment(comment_id: int = Path(...), who: Liker = Depends(liker), service: ReactionService = Depends()) -> Res_CommentLike: + return await _clike(comment_id, who, False, service) diff --git a/backend/router/v1/talk/protocol.py b/backend/router/v1/talk/protocol.py index 45c5171..31a1bfb 100644 --- a/backend/router/v1/talk/protocol.py +++ b/backend/router/v1/talk/protocol.py @@ -16,6 +16,7 @@ class TalkData(WebPacketProtocol): region_name: Optional[str] = Field(None, description="쓴 사람이 고른 동네 (성남시 분당구)") weather: Optional[str] = Field(None, description="쓸 때 그 동네 날씨 (18° 맑음)") body: str + image: Optional[str] = Field(None, description="올린 사진 주소") like_count: int liked: bool mine: bool @@ -25,6 +26,7 @@ class TalkData(WebPacketProtocol): class Req_Talk(Req_WebPacketProtocol): region_code: str = Field(min_length=10, max_length=10) body: str = Field(min_length=1, max_length=200, description="공백을 줄인 뒤 100자까지") + image: Optional[str] = Field(None, max_length=200, description="먼저 올린 사진 주소 (POST /v1/talk/image 결과)") class Req_TalkReport(Req_WebPacketProtocol): @@ -43,3 +45,7 @@ class Res_Talk(Res_WebPacketProtocol): class Res_TalkLike(Res_WebPacketProtocol): liked: Optional[bool] = None like_count: Optional[int] = None + + +class Res_TalkImage(Res_WebPacketProtocol): + image: Optional[str] = Field(None, description="글에 붙일 사진 주소") diff --git a/backend/router/v1/talk/talk.py b/backend/router/v1/talk/talk.py index da5e9a7..c4f7e89 100644 --- a/backend/router/v1/talk/talk.py +++ b/backend/router/v1/talk/talk.py @@ -1,14 +1,19 @@ from typing import Optional -from fastapi import APIRouter, Depends, Path, Query +import asyncio + +from fastapi import APIRouter, Depends, File, HTTPException, Path, Query, UploadFile +from fastapi.responses import FileResponse from common.auth import current_user, optional_user from common.database.model.models import User from common.enums import ErrorType +from common.liker import Liker, liker from common.models.errors import error_info from common.models.gmodel import Res_WebPacketProtocol from common.utils.kma_time import KST -from router.v1.talk.protocol import Req_Talk, Req_TalkReport, Res_Talk, Res_TalkLike, Res_TalkList, TalkData +from router.v1.talk.protocol import Req_Talk, Req_TalkReport, Res_Talk, Res_TalkImage, Res_TalkLike, Res_TalkList, TalkData +from services.talk_image import MAX_BYTES, URL_PREFIX, file_of, save from services.talk_service import PAGE, TalkService, TalkView router = APIRouter(prefix="/v1/talk", tags=["talk"]) @@ -18,13 +23,15 @@ def _data(v: TalkView) -> TalkData: t, u = v.talk, v.author return TalkData( talk_id=t.talk_id, nickname=u.nickname, character=u.character, color=u.color, mood=u.mood, region_name=v.region_name, weather=t.weather, - body=t.body, like_count=t.like_count, liked=v.liked, mine=v.mine, created_at=t.created_at.astimezone(KST), + body=t.body, image=t.image, like_count=t.like_count, liked=v.liked, mine=v.mine, created_at=t.created_at.astimezone(KST), ) @router.get("/list", response_model=Res_TalkList, response_model_exclude_none=True, summary="동네 이야기 (전국, 최신순, 로그인 없이 보기)") -async def list_talks(cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), service: TalkService = Depends()) -> Res_TalkList: - err, views = await service.page(user, cursor) +async def list_talks( + cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker), service: TalkService = Depends() +) -> Res_TalkList: + err, views = await service.page(user, who.ip_hash, cursor) if err is not ErrorType.SUCCESS: return Res_TalkList(result=error_info(err)) talks = [_data(v) for v in views] @@ -33,28 +40,43 @@ async def list_talks(cursor: Optional[int] = Query(None), user: Optional[User] = @router.post("", response_model=Res_Talk, response_model_exclude_none=True, summary="동네 이야기 쓰기 (링크·전화번호 불가, 하루 5개)") async def add_talk(req: Req_Talk, user: User = Depends(current_user), service: TalkService = Depends()) -> Res_Talk: - err, v = await service.add(user, req.region_code, req.body) + err, v = await service.add(user, req.region_code, req.body, req.image) return Res_Talk(result=error_info(err)) if err is not ErrorType.SUCCESS or v is None else Res_Talk(talk=_data(v)) +@router.post("/image", response_model=Res_TalkImage, response_model_exclude_none=True, summary="글에 붙일 사진 올리기 (10MB까지, 위치 정보를 지우고 1080px로 줄여 저장)") +async def upload_talk_image(file: UploadFile = File(...), user: User = Depends(current_user)) -> Res_TalkImage: + data = await file.read(MAX_BYTES + 1) + err, url = await asyncio.to_thread(save, data) + return Res_TalkImage(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_TalkImage(image=url) + + +@router.get("/image/{name}", summary="올린 사진", response_class=FileResponse) +async def get_talk_image(name: str = Path(..., max_length=40)) -> FileResponse: + path = file_of(URL_PREFIX + name) + if path is None: + raise HTTPException(status_code=404) + return FileResponse(path, media_type="image/webp", headers={"Cache-Control": "public, max-age=31536000, immutable"}) + + @router.delete("/{talk_id}", response_model=Res_WebPacketProtocol, response_model_exclude_none=True, summary="내 이야기 지우기") async def delete_talk(talk_id: int = Path(...), user: User = Depends(current_user), service: TalkService = Depends()) -> Res_WebPacketProtocol: return Res_WebPacketProtocol(result=error_info(await service.delete(user, talk_id))) -async def _like(talk_id: int, user: User, on: bool, service: TalkService) -> Res_TalkLike: - err, count = await service.like(user, talk_id, on) +async def _like(talk_id: int, who: Liker, on: bool, service: TalkService) -> Res_TalkLike: + err, count = await service.like(who, talk_id, on) return Res_TalkLike(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_TalkLike(liked=on, like_count=count) -@router.post("/{talk_id}/like", response_model=Res_TalkLike, response_model_exclude_none=True, summary="이야기 좋아요") -async def like_talk(talk_id: int = Path(...), user: User = Depends(current_user), service: TalkService = Depends()) -> Res_TalkLike: - return await _like(talk_id, user, True, service) +@router.post("/{talk_id}/like", response_model=Res_TalkLike, response_model_exclude_none=True, summary="이야기 좋아요 (로그인 없으면 IP 당 한 번)") +async def like_talk(talk_id: int = Path(...), who: Liker = Depends(liker), service: TalkService = Depends()) -> Res_TalkLike: + return await _like(talk_id, who, True, service) @router.delete("/{talk_id}/like", response_model=Res_TalkLike, response_model_exclude_none=True, summary="이야기 좋아요 취소") -async def unlike_talk(talk_id: int = Path(...), user: User = Depends(current_user), service: TalkService = Depends()) -> Res_TalkLike: - return await _like(talk_id, user, False, service) +async def unlike_talk(talk_id: int = Path(...), who: Liker = Depends(liker), service: TalkService = Depends()) -> Res_TalkLike: + return await _like(talk_id, who, False, service) @router.post("/{talk_id}/report", response_model=Res_WebPacketProtocol, response_model_exclude_none=True, summary="이야기 신고 (서로 다른 3명이면 숨김)") diff --git a/backend/scripts/gen_gak_doc.py b/backend/scripts/gen_gak_doc.py index 917c35f..7f72d2d 100644 --- a/backend/scripts/gen_gak_doc.py +++ b/backend/scripts/gen_gak_doc.py @@ -5,7 +5,7 @@ import sys ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, ROOT) -from services.calc.index_calc import PRIORITY_WEIGHT # noqa: E402 +from services.calc.index_calc import PRIORITY_WEIGHT, _cond # noqa: E402 SEED = os.path.join(ROOT, "seed", "index_definition.json") OUT = os.path.join(os.path.dirname(ROOT), "docs", "각_계산기준.md") @@ -64,12 +64,16 @@ def tim(r): return "달이 어두울수록 좋음 (보름 20점 → 그믐 100점)" if t == "sunset_score": return "그날 노을 점수를 그대로 씀" + if t == "sunrise_score": + return "그날 일출 하늘 점수를 그대로 씀" return f"고정 {r['value']}점" def zero(z): if z["field"] == "warning": return f"{z['value']} 특보가 있으면" + if z["field"] not in FIELD: + return _cond(z)[2] + (f" 최대 {z['cap']}점" if "cap" in z else " 0점") name, unit = FIELD[z["field"]] op = "이상" if z["op"] == ">=" else "미만" s = f"{name} {z['value']}{unit} {op}이면" @@ -83,7 +87,7 @@ def air(r): AX = [("temp", "기온", temp), ("rain", "비", rain), ("wind", "바람", wind), ("humidity", "습도", hum), ("air", "미세먼지", air), - ("uv", "자외선", lambda r: f"자외선 {r['full']} 이하면 만점, {r['zero']} 이상이면 0점 (Open-Meteo)"), + ("uv", "자외선", lambda r: f"자외선 {r['full']} {'이상이면' if r['full'] > r['zero'] else '이하면'} 만점, {r['zero']} {'이하면' if r['full'] > r['zero'] else '이상이면'} 0점 (Open-Meteo)"), ("sun", "햇빛", lambda r: f"해 난 비율 {round(r['full'] * 100)}% 이상이면 만점, {round(r['zero'] * 100)}% 이하면 0점 (Open-Meteo)"), ("view", "가시거리", lambda r: f"{r['full']}km 이상이면 만점, {r['zero']}km 이하면 0점 (Open-Meteo)"), ("time", "시간·요일", tim)] diff --git a/backend/seed/index_definition.json b/backend/seed/index_definition.json index e0ee25e..0c602f7 100644 --- a/backend/seed/index_definition.json +++ b/backend/seed/index_definition.json @@ -1784,10 +1784,10 @@ ], "limit_description": "경기 일정과 시즌(3~10월)은 반영하지 못해요", "sentences": { - "0": "비 70% 넘어요. 우천 취소 각!", - "30": "쌀쌀하거나 비 기운이 있어요. 담요랑 우비 챙겨요.", - "60": "직관 괜찮아요! 밤엔 선선하니 겉옷 하나.", - "80": "15~25°에 비 걱정 없음, 응원가 목청껏 부르는 날 ⚾" + "0": "비 소식이 짙어요. 오늘 직관은 쉬어 가요!", + "30": "바람이 차거나 비 기운이 맴돌아요. 담요랑 우비 꼭 챙겨요!", + "60": "직관 가기 괜찮은 저녁! 겉옷 하나 걸치고 출발~", + "80": "선선한 바람에 비 걱정 없음! 응원가 목청껏 부르는 날 ⚾" }, "sort_order": 24, "priority": 3, @@ -3884,5 +3884,1008 @@ "sort_order": 53, "priority": 2, "months": [] + }, + { + "code": "hangang", + "name": "한강각", + "icon": "hangang", + "category": 1, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "오후 2시~밤 10시, 강가에 돗자리 펴고 놀기 좋은 정도", + "windows": [ + { + "from": 14, + "to": 22 + } + ], + "weight_temp": 30, + "weight_rain": 25, + "weight_wind": 15, + "weight_humidity": 5, + "weight_air": 10, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 15, + "factor_rules": { + "temp": { + "type": "range", + "lo": 15, + "hi": 25, + "best": 20 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 4, + "limit": 12 + }, + "humidity": { + "type": "range", + "lo": 30, + "hi": 65, + "best": 45 + }, + "time": { + "type": "weekday", + "sat": 100, + "sun": 100, + "holiday": 100, + "fri": 90, + "default": 60 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + }, + { + "field": "rain_prob", + "op": ">=", + "value": 70 + }, + { + "field": "wind_ms", + "op": ">=", + "value": 12 + } + ], + "limit_description": "근처에 강이 없어도 나와요. 자리 경쟁은 반영하지 못해요", + "sentences": { + "0": "비 오거나 바람이 거세요. 한강은 다음에!", + "30": "춥거나 더워서 오래 앉아 있긴 힘들어요. 잠깐 걷기만!", + "60": "돗자리 펴기 괜찮은 날이에요. 겉옷 하나 챙겨요.", + "80": "바람 살랑, 햇볕 따뜻. 돗자리 들고 한강 가요 🧺" + }, + "sort_order": 54, + "priority": 1, + "months": [] + }, + { + "code": "themepark", + "name": "놀이공원각", + "icon": "themepark", + "category": 1, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "오전 10시~저녁 8시, 놀이공원에서 놀기 좋은 정도", + "windows": [ + { + "from": 10, + "to": 20 + } + ], + "weight_temp": 30, + "weight_rain": 35, + "weight_wind": 15, + "weight_humidity": 0, + "weight_air": 5, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 15, + "factor_rules": { + "temp": { + "type": "range", + "lo": 15, + "hi": 25, + "best": 20 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 5, + "limit": 14 + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "sat": 80, + "sun": 80, + "holiday": 80, + "default": 100 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + }, + { + "field": "rain_prob", + "op": ">=", + "value": 70 + }, + { + "field": "wind_ms", + "op": ">=", + "value": 14 + }, + { + "field": "feels_c", + "op": ">=", + "value": 33, + "cap": 30 + } + ], + "limit_description": "근처에 놀이공원이 없어도 나와요. 붐비는 정도는 요일로만 짐작해요", + "sentences": { + "0": "비 오거나 바람이 세서 멈추는 기구가 많아요.", + "30": "덥거나 추워서 줄 서기 힘들어요. 실내 놀거리 위주로!", + "60": "놀러 가기 괜찮아요. 줄 설 때 쓸 모자나 겉옷 챙겨요.", + "80": "맑고 선선해서 하루 종일 타기 좋은 날 🎡" + }, + "sort_order": 55, + "priority": 2, + "months": [] + }, + { + "code": "date", + "name": "데이트각", + "icon": "date", + "category": 1, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "오후 2시~밤 10시, 밖에서 걸으며 데이트하기 좋은 정도", + "windows": [ + { + "from": 14, + "to": 22 + } + ], + "weight_temp": 30, + "weight_rain": 30, + "weight_wind": 10, + "weight_humidity": 0, + "weight_air": 15, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 15, + "factor_rules": { + "temp": { + "type": "range", + "lo": 15, + "hi": 25, + "best": 20 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 4, + "limit": 12 + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "fri": 100, + "sat": 100, + "sun": 90, + "holiday": 90, + "default": 70 + } + }, + "zero_rules": [], + "limit_description": "가게 예약·붐비는 정도는 반영하지 못해요", + "sentences": { + "0": "비가 와요. 오늘은 카페·전시·영화로 실내 데이트!", + "30": "밖은 춥거나 더워요. 실내 데이트 코스가 나아요.", + "60": "걷기 괜찮은 날이에요. 산책하고 카페 가요.", + "80": "바람 좋고 하늘 맑아요. 밖에서 걷는 데이트 각 💕" + }, + "sort_order": 56, + "priority": 2, + "months": [] + }, + { + "code": "frizz", + "name": "곱슬머리각", + "icon": "frizz", + "category": 4, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "오전 8시~저녁 8시, 습기에 머리가 부풀기 쉬운 정도", + "windows": [ + { + "from": 8, + "to": 20 + } + ], + "weight_temp": 10, + "weight_rain": 25, + "weight_wind": 0, + "weight_humidity": 60, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 5, + "factor_rules": { + "temp": { + "type": "higher", + "zero": 15, + "full": 28 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "higher" + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [], + "limit_description": "실내 습도와 머릿결은 반영하지 못해요", + "sentences": { + "0": "공기가 보송해요. 고데기한 머리 하루 종일 가요.", + "30": "조금 눅눅해요. 앞머리만 살짝 신경 써요.", + "60": "습해서 머리가 부풀기 쉬워요. 픽서 챙겨요.", + "80": "습기 가득, 고데기 해도 금방 풀려요. 묶는 게 답 💦" + }, + "sort_order": 57, + "priority": 2, + "months": [] + }, + { + "code": "boiler", + "name": "보일러각", + "icon": "boiler", + "category": 3, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "밤 9시~다음 날 아침 7시, 보일러를 켜야 하는 정도", + "windows": [ + { + "from": 21, + "to": 31 + } + ], + "weight_temp": 70, + "weight_rain": 10, + "weight_wind": 0, + "weight_humidity": 15, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 5, + "factor_rules": { + "temp": { + "type": "lower", + "zero": 20, + "full": 3 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "higher" + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [], + "limit_description": "집 단열과 실내 온도는 반영하지 못해요", + "sentences": { + "0": "밤에도 따뜻해요. 보일러는 쉬어도 돼요.", + "30": "밤에 살짝 서늘해요. 이불 하나 더면 충분해요.", + "60": "밤에 쌀쌀해요. 잘 때 보일러 잠깐 돌려요.", + "80": "밤새 추워요. 보일러 켜고 자요 🔥" + }, + "sort_order": 58, + "priority": 2, + "months": [] + }, + { + "code": "sunscreen", + "name": "선크림각", + "icon": "sunscreen", + "category": 4, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "오전 10시~오후 4시, 선크림을 꼭 발라야 하는 정도", + "windows": [ + { + "from": 10, + "to": 16 + } + ], + "weight_temp": 15, + "weight_rain": 0, + "weight_wind": 0, + "weight_humidity": 0, + "weight_air": 0, + "weight_uv": 80, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 5, + "factor_rules": { + "temp": { + "type": "higher", + "zero": 5, + "full": 25 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "fixed", + "value": 100 + }, + "uv": { + "zero": 1, + "full": 7 + } + }, + "zero_rules": [], + "limit_description": "그늘·실내에 있는 시간은 반영하지 못해요", + "sentences": { + "0": "해가 약해요. 선크림 안 발라도 괜찮아요.", + "30": "햇볕이 조금 있어요. 오래 밖에 있으면 발라요.", + "60": "흐려 보여도 햇볕이 세요. 선크림 발라요.", + "80": "햇볕이 아주 세요. 선크림 꼭, 자주 덧발라요 ☀️" + }, + "sort_order": 59, + "priority": 2, + "months": [] + }, + { + "code": "mosquito", + "name": "모기각", + "icon": "mosquito", + "category": 4, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "저녁 7시~자정, 모기가 많이 나오는 정도", + "windows": [ + { + "from": 19, + "to": 24 + } + ], + "weight_temp": 50, + "weight_rain": 0, + "weight_wind": 20, + "weight_humidity": 25, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 5, + "factor_rules": { + "temp": { + "type": "higher", + "zero": 16, + "full": 27 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 2, + "limit": 6 + }, + "humidity": { + "type": "higher" + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [], + "limit_description": "물웅덩이·풀숲 같은 동네 환경은 반영하지 못해요", + "sentences": { + "0": "서늘하거나 바람이 불어 모기가 잠잠해요.", + "30": "모기가 가끔 보여요. 방충망만 확인해요.", + "60": "모기가 활발해요. 밖에 나갈 땐 기피제 뿌려요.", + "80": "덥고 습하고 바람도 없어요. 기피제·모기향 필수 🦟" + }, + "sort_order": 60, + "priority": 2, + "months": [ + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + { + "code": "tennis", + "name": "테니스각", + "icon": "tennis", + "category": 1, + "is_fun": false, + "is_core": false, + "has_detail": true, + "description": "아침·저녁, 야외 코트에서 테니스 치기 좋은 정도", + "windows": [ + { + "from": 7, + "to": 11 + }, + { + "from": 17, + "to": 21 + } + ], + "weight_temp": 30, + "weight_rain": 25, + "weight_wind": 25, + "weight_humidity": 5, + "weight_air": 10, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 5, + "factor_rules": { + "temp": { + "type": "range", + "lo": 10, + "hi": 25, + "best": 18 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 3, + "limit": 8 + }, + "humidity": { + "type": "range", + "lo": 30, + "hi": 65, + "best": 45 + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + }, + { + "field": "rain_prob", + "op": ">=", + "value": 60 + }, + { + "field": "wind_ms", + "op": ">=", + "value": 8 + } + ], + "limit_description": "앞서 내린 비로 젖은 코트는 반영하지 못해요", + "sentences": { + "0": "비 오거나 바람이 세요. 공이 제멋대로 날아가요.", + "30": "덥거나 춥거나 바람이 있어요. 가볍게 랠리만!", + "60": "치기 괜찮아요. 바람 방향만 신경 써요.", + "80": "바람 잔잔, 공기 선선. 서브 잘 들어가는 날 🎾" + }, + "sort_order": 61, + "priority": 2, + "months": [] + }, + { + "code": "hyodo", + "name": "효도각", + "icon": "hyodo", + "category": 1, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "오전 10시~오후 4시, 부모님 모시고 나들이하기 좋은 정도", + "windows": [ + { + "from": 10, + "to": 16 + } + ], + "weight_temp": 30, + "weight_rain": 25, + "weight_wind": 10, + "weight_humidity": 0, + "weight_air": 15, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 20, + "factor_rules": { + "temp": { + "type": "range", + "lo": 16, + "hi": 24, + "best": 20 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 4, + "limit": 10 + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "sat": 100, + "sun": 100, + "holiday": 100, + "default": 50 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + }, + { + "field": "feels_c", + "op": ">=", + "value": 30 + }, + { + "field": "feels_c", + "op": "<", + "value": 0 + } + ], + "limit_description": "계단·걷는 거리 같은 장소 사정은 반영하지 못해요", + "sentences": { + "0": "비 오거나 바람이 거세요. 오늘은 전화 한 통으로 효도!", + "30": "어르신이 나가시기엔 춥거나 더워요. 실내 식당 나들이가 좋아요.", + "60": "모시고 나가기 괜찮아요. 겉옷 하나 챙겨 드려요.", + "80": "햇볕 따뜻하고 바람 순해요. 부모님 모시고 나들이 각 🌸" + }, + "sort_order": 62, + "priority": 2, + "months": [] + }, + { + "code": "thanks", + "name": "감사각", + "icon": "thanks", + "category": 4, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "저녁 6~10시, 날씨 핑계로 안부 문자 보내기 좋은 정도", + "windows": [ + { + "from": 18, + "to": 22 + } + ], + "weight_temp": 50, + "weight_rain": 30, + "weight_wind": 0, + "weight_humidity": 0, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 20, + "factor_rules": { + "temp": { + "type": "away", + "lo": 15, + "hi": 24 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [], + "limit_description": "어제보다 날씨가 얼마나 바뀌었는지는 반영하지 못해요", + "sentences": { + "0": "날씨가 무난해요. 안부는 평소처럼!", + "30": "날씨 얘기로 말 걸기 괜찮은 날이에요.", + "60": "춥거나 덥거나 비가 와요. \"감기 조심해\" 한마디 보내기 좋아요.", + "80": "날씨가 거세요. 고마운 사람한테 안부 문자 보내기 딱 좋은 날 💌" + }, + "sort_order": 63, + "priority": 3, + "months": [] + }, + { + "code": "gift", + "name": "선물각", + "icon": "gift", + "category": 4, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "오전 11시~저녁 7시, 꽃·선물 들고 찾아가기 좋은 정도", + "windows": [ + { + "from": 11, + "to": 19 + } + ], + "weight_temp": 40, + "weight_rain": 35, + "weight_wind": 15, + "weight_humidity": 0, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 10, + "factor_rules": { + "temp": { + "type": "range", + "lo": 12, + "hi": 22, + "best": 17 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 4, + "limit": 12 + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "sat": 100, + "sun": 100, + "holiday": 100, + "default": 70 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + }, + { + "field": "rain_prob", + "op": ">=", + "value": 70 + } + ], + "limit_description": "선물 종류와 이동 거리는 반영하지 못해요", + "sentences": { + "0": "비가 와요. 선물은 택배나 모바일로 보내요.", + "30": "덥거나 추워요. 꽃·케이크는 오래 들고 다니지 마요.", + "60": "선물 들고 가기 괜찮아요.", + "80": "선선하고 맑아요. 꽃 한 다발 들고 걷기 좋은 날 💐" + }, + "sort_order": 64, + "priority": 3, + "months": [] + }, + { + "code": "party", + "name": "파티각", + "icon": "party", + "category": 3, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "저녁 6시~자정, 집에 모여 홈파티하기 좋은 정도", + "windows": [ + { + "from": 18, + "to": 24 + } + ], + "weight_temp": 25, + "weight_rain": 25, + "weight_wind": 0, + "weight_humidity": 0, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 50, + "factor_rules": { + "temp": { + "type": "away", + "lo": 15, + "hi": 24 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "fri": 100, + "sat": 100, + "holiday": 90, + "sun": 60, + "default": 30 + } + }, + "zero_rules": [], + "limit_description": "모일 사람과 집 사정은 반영하지 못해요", + "sentences": { + "0": "평일인데 밖도 좋아요. 파티보다 산책!", + "30": "파티는 주말에 몰아서 해요.", + "60": "친구들 불러 집에서 한잔하기 괜찮아요.", + "80": "금요일 밤, 밖은 궂어요. 집으로 다 모여 홈파티 각 🎉" + }, + "sort_order": 65, + "priority": 3, + "months": [] + }, + { + "code": "game", + "name": "게임각", + "icon": "game", + "category": 3, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "밤 8시~다음 날 새벽 2시, 집에서 게임하기 좋은 정도", + "windows": [ + { + "from": 20, + "to": 26 + } + ], + "weight_temp": 30, + "weight_rain": 40, + "weight_wind": 0, + "weight_humidity": 0, + "weight_air": 15, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 15, + "factor_rules": { + "temp": { + "type": "away", + "lo": 15, + "hi": 24 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "ignore" + }, + "humidity": { + "type": "ignore" + }, + "time": { + "type": "weekday", + "fri": 100, + "sat": 100, + "holiday": 100, + "default": 70 + }, + "air": { + "zero": 15, + "full": 75 + } + }, + "zero_rules": [], + "limit_description": "다음 날 일정은 반영하지 못해요", + "sentences": { + "0": "밖이 너무 좋아요. 게임은 내일 해도 돼요.", + "30": "한두 판만 하고 자요.", + "60": "밖에 나가기 애매해요. 게임 한 판 각.", + "80": "비 오고 밖은 별로예요. 오늘 밤은 패드 잡는 날 🎮" + }, + "sort_order": 66, + "priority": 3, + "months": [] + }, + { + "code": "selfie", + "name": "셀카각", + "icon": "selfie", + "category": 4, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "오전 10시~오후 5시, 자연광에 셀카 찍기 좋은 정도", + "windows": [ + { + "from": 10, + "to": 17 + } + ], + "weight_temp": 0, + "weight_rain": 20, + "weight_wind": 15, + "weight_humidity": 30, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 25, + "weight_view": 0, + "weight_time": 10, + "factor_rules": { + "temp": { + "type": "range", + "lo": 0, + "hi": 40 + }, + "rain": { + "dir": "dry" + }, + "wind": { + "type": "calm", + "ok": 3, + "limit": 10 + }, + "humidity": { + "type": "lower" + }, + "time": { + "type": "fixed", + "value": 100 + }, + "sun": { + "zero": 0.1, + "full": 0.7 + } + }, + "zero_rules": [ + { + "field": "rain", + "op": "==", + "value": "yes" + } + ], + "limit_description": "실내 조명과 장소는 반영하지 못해요", + "sentences": { + "0": "비 오거나 바람에 머리가 날려요. 실내 조명 셀카로!", + "30": "습해서 머리가 금방 부풀어요. 사진은 일찍 찍어요.", + "60": "햇빛이 괜찮아요. 창가에서 찍어 봐요.", + "80": "햇빛 좋고 공기 보송, 머리도 얌전해요. 셀카 각 📸" + }, + "sort_order": 67, + "priority": 3, + "months": [] + }, + { + "code": "sentimental", + "name": "센치각", + "icon": "sentimental", + "category": 4, + "is_fun": true, + "is_core": false, + "has_detail": true, + "description": "저녁 6~11시, 괜히 센치해지는 정도", + "windows": [ + { + "from": 18, + "to": 23 + } + ], + "weight_temp": 35, + "weight_rain": 30, + "weight_wind": 10, + "weight_humidity": 10, + "weight_air": 0, + "weight_uv": 0, + "weight_sun": 0, + "weight_view": 0, + "weight_time": 15, + "factor_rules": { + "temp": { + "type": "range", + "lo": 8, + "hi": 18, + "best": 13 + }, + "rain": { + "dir": "wet" + }, + "wind": { + "type": "moderate" + }, + "humidity": { + "type": "higher" + }, + "time": { + "type": "fixed", + "value": 100 + } + }, + "zero_rules": [], + "limit_description": "흐린 정도는 비 확률로만 짐작해요", + "sentences": { + "0": "덥고 쨍해요. 감성보다 시원한 게 필요해요.", + "30": "그냥 평범한 저녁이에요.", + "60": "선선한 저녁이에요. 좋아하는 노래 틀고 걸어요.", + "80": "쌀쌀한 바람에 하늘도 흐려요. 괜히 센치해지는 밤 🍂" + }, + "sort_order": 68, + "priority": 3, + "months": [] } ] diff --git a/backend/services/calc/my_gak_calc.py b/backend/services/calc/my_gak_calc.py new file mode 100644 index 0000000..4231f8b --- /dev/null +++ b/backend/services/calc/my_gak_calc.py @@ -0,0 +1,52 @@ +from dataclasses import dataclass +from types import SimpleNamespace +from typing import Literal, Optional + +from services.calc.day_slot import NIGHT_END_HOUR, SLOTS + +Rain = Literal["dry", "wet"] +Air = Literal["good", "normal"] + +# 미세먼지 허용 단계 → 초미세먼지(㎍/㎥) 점수 규칙. 단계 경계(좋음 15·보통 35)까지 100, 넘으면 깎는다 +_AIR = {"good": {"zero": 35, "full": 15}, "normal": {"zero": 75, "full": 35}} +_WIND_LIMIT_OVER = 6 # 바람 상한에서 이만큼 더 세지면 0점 + + +def _n(v: float) -> float: + """근거 문구에 15.0° 대신 15° 로 나오게.""" + return int(v) if float(v).is_integer() else v + + +@dataclass(frozen=True) +class MyRule: + """사용자가 정한 내 각 조건. None 인 항목은 보지 않는다.""" + + temp: Optional[tuple[float, float]] = None # 체감온도 범위(°) + rain: Optional[Rain] = None # dry: 안 와야, wet: 와야 + wind_max: Optional[float] = None # 바람 상한(m/s) + air: Optional[Air] = None # 미세먼지 허용 단계 + humidity: Optional[tuple[int, int]] = None # 습도 범위(%) + slots: tuple[str, ...] = SLOTS # 볼 시간대 + + +def axes(rule: MyRule) -> list[str]: + return [a for a, on in (("temp", rule.temp), ("rain", rule.rain), ("wind", rule.wind_max is not None), ("air", rule.air), ("humidity", rule.humidity)) if on] + + +def definition(rule: MyRule) -> SimpleNamespace: + """공식 각과 같은 계산(evaluate)에 넣을 정의. 고른 조건끼리 가중치를 똑같이 나눈다.""" + used = axes(rule) + share = {a: 100 // len(used) + (1 if i < 100 % len(used) else 0) for i, a in enumerate(used)} if used else {} + return SimpleNamespace( + **{f"weight_{a}": share.get(a, 0) for a in ("temp", "rain", "wind", "humidity", "air", "uv", "sun", "view", "time")}, + factor_rules={ + "temp": {"type": "range", "lo": _n(rule.temp[0]), "hi": _n(rule.temp[1])} if rule.temp else {"type": "range", "lo": -50, "hi": 60}, + "rain": {"dir": rule.rain or "dry"}, + "wind": {"type": "calm", "ok": _n(rule.wind_max), "limit": rule.wind_max + _WIND_LIMIT_OVER} if rule.wind_max is not None else {"type": "ignore"}, + "humidity": {"type": "range", "lo": rule.humidity[0], "hi": rule.humidity[1]} if rule.humidity else {"type": "ignore"}, + "air": _AIR[rule.air] if rule.air else None, + "time": {"type": "fixed", "value": 100}, + }, + zero_rules=[{"field": "rain", "op": "==", "value": "yes", "cap": 20}] if rule.rain == "dry" else [], + windows=[{"from": NIGHT_END_HOUR, "to": 24 + NIGHT_END_HOUR}], + ) diff --git a/backend/services/feed_service.py b/backend/services/feed_service.py index 6f4d209..e171563 100644 --- a/backend/services/feed_service.py +++ b/backend/services/feed_service.py @@ -76,12 +76,13 @@ def sido_of(region_code: str) -> str: def post_scope(post_type: PostType, region_code: str) -> str: return NATIONAL_SCOPE if post_type in NATIONAL_TYPES else sido_of(region_code) -# 시간대별 순서. 목록에 없는 종류는 그 시간대에 꺼진다. '오늘 하루 날씨'는 히어로 바로 아래 고정이라 따로 둔다. 행사는 사이사이 무작위. +# 시간대별 순서. 목록에 없는 종류는 그 시간대에 꺼진다. '오늘 하루 날씨'는 히어로 바로 아래 고정이라 따로 둔다. 행사는 앞쪽 절반 사이사이 무작위. +# 알림은 비·특보가 있을 때만 켜지니 맨 앞, 주말·노을처럼 공유할 만한 카드를 그다음, 공기·자외선·상식 같은 평이한 정보는 뒤로. ORDER = { - "morning": [PostType.ALERT, PostType.AIR, PostType.UV, PostType.GAK, PostType.GAK, PostType.GAK, PostType.SEASON, PostType.SUNSET, PostType.TIP, PostType.WEEK, PostType.WEEKEND_PLAN, PostType.WEEKEND_PLAN, PostType.DAY_TRIP, PostType.MOON, PostType.QUOTE], - "day": [PostType.GAK, PostType.ALERT, PostType.AIR, PostType.UV, PostType.GAK, PostType.GAK, PostType.SUNSET, PostType.WEEK, PostType.WEEKEND_PLAN, PostType.SEASON, PostType.WEEKEND_PLAN, PostType.DAY_TRIP, PostType.TIP, PostType.MOON, PostType.QUOTE], - "evening": [PostType.SUNSET, PostType.GAK, PostType.MOON, PostType.ALERT, PostType.GAK, PostType.GAK, PostType.AIR, PostType.TOMORROW, PostType.WEEK, PostType.WEEKEND_PLAN, PostType.SEASON, PostType.WEEKEND_PLAN, PostType.DAY_TRIP, PostType.TIP, PostType.QUOTE], - "night": [PostType.TOMORROW, PostType.MOON, PostType.ALERT, PostType.SUNSET, PostType.WEEK, PostType.GAK, PostType.WEEKEND_PLAN, PostType.GAK, PostType.GAK, PostType.WEEKEND_PLAN, PostType.DAY_TRIP, PostType.AIR, PostType.SEASON, PostType.TIP, PostType.QUOTE], + "morning": [PostType.ALERT, PostType.WEEK, PostType.WEEKEND_PLAN, PostType.SUNSET, PostType.GAK, PostType.DAY_TRIP, PostType.WEEKEND_PLAN, PostType.GAK, PostType.SEASON, PostType.GAK, PostType.MOON, PostType.AIR, PostType.UV, PostType.TIP, PostType.QUOTE], + "day": [PostType.ALERT, PostType.SUNSET, PostType.WEEK, PostType.WEEKEND_PLAN, PostType.GAK, PostType.DAY_TRIP, PostType.WEEKEND_PLAN, PostType.GAK, PostType.SEASON, PostType.GAK, PostType.MOON, PostType.AIR, PostType.UV, PostType.TIP, PostType.QUOTE], + "evening": [PostType.SUNSET, PostType.ALERT, PostType.WEEK, PostType.MOON, PostType.WEEKEND_PLAN, PostType.GAK, PostType.TOMORROW, PostType.DAY_TRIP, PostType.WEEKEND_PLAN, PostType.GAK, PostType.SEASON, PostType.GAK, PostType.AIR, PostType.TIP, PostType.QUOTE], + "night": [PostType.TOMORROW, PostType.ALERT, PostType.MOON, PostType.WEEK, PostType.SUNSET, PostType.WEEKEND_PLAN, PostType.GAK, PostType.DAY_TRIP, PostType.WEEKEND_PLAN, PostType.GAK, PostType.SEASON, PostType.GAK, PostType.AIR, PostType.TIP, PostType.QUOTE], } _SKY_MODE = {"morning": "morning", "day": "day", "evening": "sunset", "night": "night"} _CATEGORY_META = {ArticleCategory.SEASON.value: "계절 소식", ArticleCategory.TIP.value: "날씨 상식", ArticleCategory.GAK.value: "각 원리", ArticleCategory.QUOTE.value: "한 문장"} @@ -220,7 +221,8 @@ def arrange(cards: list[PostData], slot: str, now: datetime, sunset_at: datetime if slot == "night": rest = [c for c in rest if c.post_type is not PostType.QUOTE] + [c for c in rest if c.post_type is PostType.QUOTE] events = pool.get(PostType.EVENT, []) - gaps = sorted(random.Random(seed).sample(range(1, len(rest)), min(len(events), max(0, len(rest) - 1))), reverse=True) + front = range(1, max(1, len(rest) // 2 + 1)) + gaps = sorted(random.Random(seed).sample(front, min(len(events), len(front))), reverse=True) for gap, e in zip(gaps, reversed(events[:len(gaps)])): rest.insert(gap, e) return head + rest diff --git a/backend/services/hero_stats.py b/backend/services/hero_stats.py index cfb75f8..b83adcd 100644 --- a/backend/services/hero_stats.py +++ b/backend/services/hero_stats.py @@ -11,7 +11,6 @@ Tone = Literal["normal", "warn", "rain"] UV_HIGH = 6.0 MUGGY_DI = 75 # 불쾌지수 '불쾌'가 시작되는 값 -DISCOMFORT_MONTHS = range(6, 10) # 기상청처럼 6~9월에만. 더위 지표라 선선한 철엔 비 와도 '쾌적'으로 나온다 HUMID_DRY, HUMID_WET = 30, 60 # 습도 % : 이 아래 건조, 이 위 습함 TEMP_SWING_C = 10.0 WIND_CHILL_C = 3.0 @@ -67,11 +66,11 @@ def humidity_label(h: int) -> str: def hero_status(x: HeroInput) -> list[HeroStatItem]: - """히어로 상태 한 줄: 습도·불쾌지수(6~9월)·자외선(해 있을 때, 저녁 포함)·미세먼지를 단계 이름으로. 값이 없는 칸은 뺀다. 조심할 것만 warn.""" + """히어로 상태 한 줄: 습도·불쾌지수(늘)·자외선(해 있을 때, 저녁 포함)·미세먼지를 단계 이름으로. 값이 없는 칸은 뺀다. 조심할 것만 warn.""" out: list[HeroStatItem] = [] if x.humidity is not None: out.append(HeroStatItem("humidity", "muggy", "습도", humidity_label(x.humidity))) - if x.discomfort is not None and x.now.month in DISCOMFORT_MONTHS: + if x.discomfort is not None: out.append(HeroStatItem("discomfort", "muggy", "불쾌지수", discomfort_label(x.discomfort), "warn" if x.discomfort >= MUGGY_DI else "normal")) if not x.after_dark and x.uv is not None: out.append(HeroStatItem("uv", "glasses", "자외선", uv_label(x.uv), "warn" if x.uv >= UV_HIGH else "normal")) diff --git a/backend/services/index_service.py b/backend/services/index_service.py index a615e8c..2837ea4 100644 --- a/backend/services/index_service.py +++ b/backend/services/index_service.py @@ -365,6 +365,36 @@ class IndexService: region=region, day=today, weather_score=weather_parts.get(cur), items=items, weather_slots=_shown_parts(weather_parts, cur), ) + async def custom(self, region_code: str, defns: list) -> tuple[ErrorType, Optional[tuple[str, list[dict[str, Result]]]]]: + """공식 각이 아닌 정의(내 각)들을 그 동네 오늘 아침·낮·저녁·밤으로 계산한다. (지금 구간, 정의마다 구간별 결과)""" + err, region = await DB_SESSION_MNG.execute_lambda(lambda s: self.regions.get(s, region_code)) + if err is not ErrorType.SUCCESS: + return err, None + if region is None: + return ErrorType.NOT_FOUND, None + now = now_kst() + _, _, ultra = await asyncio.gather(self.weather_service.ensure_vilage(region, now), self.air_service.ensure(now), ultra_hours(region, now)) + today = now.date() + start = kst_midnight(today) + err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.weather.hourly_between(s, region.code, start - timedelta(days=1), start + timedelta(days=2))) + if err is not ErrorType.SUCCESS: + return err, None + if not rows: + return ErrorType.EXTERNAL_API_ERROR, None + air = await self.air_service.nearest(region) + by_at = with_ultra_rain({r.forecast_at: r for r in rows}, ultra) + ctx = Context( + day=today, is_holiday=False, moon=0, sunset_score=None, lookahead_rain_prob=0, rain_hours=rain_hours(by_at, today), wind_warning=False, + pm25=air.pm25 if air else None, air_label=GRADE_LABEL[AirGrade(air.grade)] if air and air.grade else None, + ) + sunset_at = sun_times(today, float(region.lat), float(region.lon)).sunset_at + cur = current_slot(now, sunset_at) + out = [] + for d in defns: + parts = slot_results(d, today, region, by_at, {}, ctx, sunset_at, now) + out.append({shown_slot(k): r for k, r in parts.items() if k != ("night" if cur == EARLY else EARLY)}) + return ErrorType.SUCCESS, (shown_slot(cur), out) + async def ensure(self, region: Region, now: datetime) -> tuple[ErrorType, Optional[dict[str, int]]]: """재료(예보·미세먼지)가 지수 계산 뒤에 바뀌었으면 오늘~모레와 이번 주말을 다시 계산한다. 오늘 구간별 날씨 점수도 같이 낸다.""" _, _, _, warnings, ultra = await asyncio.gather( diff --git a/backend/services/my_gak_service.py b/backend/services/my_gak_service.py index ee91f23..7f7e6d1 100644 --- a/backend/services/my_gak_service.py +++ b/backend/services/my_gak_service.py @@ -1,48 +1,77 @@ +import re from typing import Optional from fastapi import Depends from common.database.db_session_manager import DB_SESSION_MNG from common.database.model.models import MyGak, User -from common.enums import ErrorType, IndexCategory -from crud.index_crud import IndexCRUD +from common.enums import ErrorType from crud.my_gak_crud import MyGakCRUD +from services.calc.day_slot import SLOTS +from services.calc.my_gak_calc import MyRule, axes, definition +from services.index_service import IndexService -# 한 사람이 만들 수 있는 조합 수 +# 한 사람이 만들 수 있는 내 각 수 MAX_PER_USER = 20 +_LINK = re.compile(r"https?://|www\.|[a-z0-9-]+\.(?:com|net|kr|co|org|io|me|ly|gl)\b|\d{3,}", re.I) + + +def gak_name(name: str) -> Optional[str]: + """앞뒤 공백을 빼고 끝에 '각'을 붙인다. 링크·긴 숫자(전화번호 등)는 받지 않는다.""" + name = " ".join(name.split()) + if not name or _LINK.search(name): + return None + name = name if name.endswith("각") else f"{name}각" + return name if len(name) <= 12 else None + + +def my_rule(rule: dict) -> MyRule: + return MyRule( + temp=tuple(rule["temp"]) if rule.get("temp") else None, rain=rule.get("rain"), wind_max=rule.get("wind_max"), air=rule.get("air"), + humidity=tuple(rule["humidity"]) if rule.get("humidity") else None, slots=tuple(s for s in SLOTS if s in (rule.get("slots") or SLOTS)), + ) class MyGakService: - def __init__(self, crud: MyGakCRUD = Depends(MyGakCRUD), index: IndexCRUD = Depends(IndexCRUD)) -> None: + def __init__(self, crud: MyGakCRUD = Depends(MyGakCRUD), index: IndexService = Depends(IndexService)) -> None: self.crud, self.index = crud, index - async def mixable(self) -> tuple[ErrorType, list[int]]: - """섞을 수 있는 공식 각. 생활 고민(우산·교통체증처럼 불편한 날을 알리는 각)은 좋은 날 각과 섞으면 뜻이 뒤집혀 뺀다.""" - err, defs = await DB_SESSION_MNG.execute_lambda(lambda s: self.index.definitions(s)) - if err is not ErrorType.SUCCESS: - return err, [] - return ErrorType.SUCCESS, [d.index_id for d in defs if d.category != IndexCategory.LIFE.value] - async def mine(self, user: User) -> tuple[ErrorType, list[MyGak]]: err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.of_user(s, user.user_id)) return err, rows or [] - async def add(self, user: User, index_ids: list[int]) -> tuple[ErrorType, Optional[MyGak]]: - a, b = sorted(index_ids) - err, ok = await self.mixable() - if err is not ErrorType.SUCCESS: - return err, None - if a == b or a not in ok or b not in ok: + async def add(self, user: User, name: str, rule: dict) -> tuple[ErrorType, Optional[MyGak]]: + name = gak_name(name) + if name is None: return ErrorType.INVALID_INPUT, None err, n = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.count(s, user.user_id)) if err is not ErrorType.SUCCESS: return err, None if n >= MAX_PER_USER: return ErrorType.INVALID_INPUT, None - return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, a, b)) + return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, name, rule)) async def delete(self, user: User, my_gak_id: int) -> ErrorType: err, found = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.delete(s, user.user_id, my_gak_id)) if err is not ErrorType.SUCCESS: return err return ErrorType.SUCCESS if found else ErrorType.NOT_FOUND + + async def score(self, region_code: str, rules: list[dict]) -> tuple[ErrorType, Optional[tuple[str, list[dict]]]]: + """조건마다 그 동네 오늘 시간대별 점수. 지금 시간대를 골랐으면 그 점수, 아니면 고른 시간대 중 가장 좋은 점수.""" + mine = [my_rule(r) for r in rules] + err, got = await self.index.custom(region_code, [definition(r) for r in mine]) + if err is not ErrorType.SUCCESS or got is None: + return err, None + now_slot, parts = got + out = [] + for r, p in zip(mine, parts): + picked = {k: v for k, v in p.items() if k in r.slots} + key = now_slot if now_slot in picked else max(picked, key=lambda k: picked[k].score, default=None) + res = picked.get(key) if key else None + out.append({ + "score": res.score if res else None, "slot": key if res else None, + "slots": {k: v.score for k, v in picked.items()}, + "reasons": [res.notes[a] for a in axes(r) if res.notes.get(a)] if res else [], + }) + return ErrorType.SUCCESS, (now_slot, out) diff --git a/backend/services/reaction_service.py b/backend/services/reaction_service.py index 5592902..bbdc157 100644 --- a/backend/services/reaction_service.py +++ b/backend/services/reaction_service.py @@ -7,6 +7,7 @@ from fastapi import Depends from common.database.db_session_manager import DB_SESSION_MNG from common.database.model.models import Comment, Post, User from common.enums import ErrorType +from common.liker import Liker from crud.feed_crud import FeedCRUD from crud.reaction_crud import ReactionCRUD @@ -41,11 +42,11 @@ class ReactionService: return err return ErrorType.SUCCESS if post is not None else ErrorType.NOT_FOUND - async def like_post(self, post_id: int, user: User, on: bool) -> tuple[ErrorType, Optional[int]]: + async def like_post(self, post_id: int, who: Liker, on: bool) -> tuple[ErrorType, Optional[int]]: err = await self._post_exists(post_id) if err is not ErrorType.SUCCESS: return err, None - return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_post_like(s, post_id, user.user_id, on)) + return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_post_like(s, post_id, who, on)) async def save_post(self, post_id: int, user: User, on: bool) -> ErrorType: err = await self._post_exists(post_id) @@ -60,6 +61,12 @@ class ReactionService: err, marks = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.my_marks(s, user.user_id, post_ids)) return marks if err is ErrorType.SUCCESS else (set(), set()) + async def anon_liked(self, ip_hash: str, post_ids: list[int]) -> set[int]: + if not post_ids: + return set() + err, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.anon_liked_posts(s, ip_hash, post_ids)) + return liked if err is ErrorType.SUCCESS else set() + async def counts(self, post_ids: list[int]) -> dict[int, tuple[int, int]]: """피드는 캐시돼 있어서 좋아요·댓글 수는 매번 DB 에서 덮어쓴다.""" if not post_ids: @@ -71,13 +78,16 @@ class ReactionService: err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.saved_posts(s, user.user_id, cursor, PAGE)) return err, [SavedView(post=p, saved_at=ps.created_at) for p, ps in rows or []] - async def comments(self, post_id: int, user: Optional[User], cursor: Optional[int]) -> tuple[ErrorType, list[CommentView]]: + async def comments(self, post_id: int, user: Optional[User], ip_hash: str, cursor: Optional[int]) -> tuple[ErrorType, list[CommentView]]: err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.comments(s, post_id, cursor, PAGE)) if err is not ErrorType.SUCCESS: return err, [] liked: set[int] = set() + ids = [c.comment_id for c, *_ in rows] if user is not None and rows: - _, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.liked_comments(s, user.user_id, [c.comment_id for c, *_ in rows])) + _, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.liked_comments(s, user.user_id, ids)) + elif rows: + _, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.anon_liked_comments(s, ip_hash, ids)) return ErrorType.SUCCESS, [ CommentView(comment=c, nickname=n, character=ch, color=co, mood=mo, liked=c.comment_id in (liked or set()), mine=user is not None and c.user_id == user.user_id) for c, n, ch, co, mo in rows @@ -99,8 +109,8 @@ class ReactionService: return err return ErrorType.SUCCESS if ok else ErrorType.NOT_FOUND - async def like_comment(self, comment_id: int, user: User, on: bool) -> tuple[ErrorType, Optional[int]]: - err, count = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_comment_like(s, comment_id, user.user_id, on)) + async def like_comment(self, comment_id: int, who: Liker, on: bool) -> tuple[ErrorType, Optional[int]]: + err, count = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_comment_like(s, comment_id, who, on)) if err is not ErrorType.SUCCESS: return err, None return (ErrorType.NOT_FOUND, None) if count is None else (ErrorType.SUCCESS, count) diff --git a/backend/services/talk_image.py b/backend/services/talk_image.py new file mode 100644 index 0000000..24923bc --- /dev/null +++ b/backend/services/talk_image.py @@ -0,0 +1,45 @@ +import io +import os +import re +import uuid +from typing import Optional + +from PIL import Image, ImageOps, UnidentifiedImageError + +from config.settings import settings +from common.enums import ErrorType + +MAX_BYTES = 10 * 1024 * 1024 # 올릴 수 있는 원본 크기 +MAX_SIDE = 1080 # 긴 변을 이만큼으로 줄인다 +URL_PREFIX = "/v1/talk/image/" +_NAME = re.compile(r"^[0-9a-f]{32}\.webp$") + + +def folder() -> str: + path = os.path.join(settings.upload_dir, "talk") + os.makedirs(path, exist_ok=True) + return path + + +def file_of(url: str) -> Optional[str]: + """올린 사진 주소 → 저장된 파일 경로. 우리가 만든 이름이 아니거나 파일이 없으면 None.""" + name = url.removeprefix(URL_PREFIX) + if not url.startswith(URL_PREFIX) or not _NAME.match(name): + return None + path = os.path.join(folder(), name) + return path if os.path.isfile(path) else None + + +def save(data: bytes) -> tuple[ErrorType, Optional[str]]: + """사진을 다시 그려 저장한다. 다시 그리면 찍은 위치(GPS)·기기 같은 메타데이터가 모두 빠진다. 돌려준 값은 글에 붙일 주소.""" + if len(data) > MAX_BYTES: + return ErrorType.INVALID_INPUT, None + try: + with Image.open(io.BytesIO(data)) as src: + img = ImageOps.exif_transpose(src).convert("RGB") + except (UnidentifiedImageError, OSError, Image.DecompressionBombError): + return ErrorType.INVALID_INPUT, None + img.thumbnail((MAX_SIDE, MAX_SIDE)) + name = f"{uuid.uuid4().hex}.webp" + img.save(os.path.join(folder(), name), "WEBP", quality=82) + return ErrorType.SUCCESS, URL_PREFIX + name diff --git a/backend/services/talk_service.py b/backend/services/talk_service.py index 22a3051..215e862 100644 --- a/backend/services/talk_service.py +++ b/backend/services/talk_service.py @@ -8,10 +8,12 @@ from fastapi import Depends from common.database.db_session_manager import DB_SESSION_MNG from common.database.model.models import Talk, User, WeatherHourly from common.enums import ErrorType, RainType, Sky, TalkReport +from common.liker import Liker from common.utils.kma_time import kst_midnight, now_kst from crud.region_crud import RegionCRUD from crud.talk_crud import TalkCRUD from crud.weather_crud import WeatherCRUD +from services.talk_image import file_of BODY_MAX = 100 DAILY_MAX = 5 @@ -49,14 +51,18 @@ class TalkService: def __init__(self, crud: TalkCRUD = Depends(TalkCRUD), regions: RegionCRUD = Depends(RegionCRUD), weather: WeatherCRUD = Depends(WeatherCRUD)) -> None: self.crud, self.regions, self.weather = crud, regions, weather - async def page(self, user: Optional[User], cursor: Optional[int]) -> tuple[ErrorType, list[TalkView]]: + async def page(self, user: Optional[User], ip_hash: str, cursor: Optional[int]) -> tuple[ErrorType, list[TalkView]]: viewer = user.user_id if user else None err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.page(s, viewer, cursor, PAGE)) if err is not ErrorType.SUCCESS: return err, [] liked: set[int] = set() - if user is not None and rows: - err, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.liked(s, user.user_id, [t.talk_id for t, *_ in rows])) + if rows: + ids = [t.talk_id for t, *_ in rows] + if user is not None: + err, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.liked(s, user.user_id, ids)) + else: + err, liked = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.anon_liked(s, ip_hash, ids)) if err is not ErrorType.SUCCESS: return err, [] return ErrorType.SUCCESS, [TalkView(talk=t, author=u, region_name=name, liked=t.talk_id in liked, mine=viewer == t.user_id) for t, u, name in rows] @@ -69,10 +75,12 @@ class TalkService: return None return weather_line(min(rows, key=lambda r: abs(r.forecast_at - now))) - async def add(self, user: User, region_code: str, body: str) -> tuple[ErrorType, Optional[TalkView]]: + async def add(self, user: User, region_code: str, body: str, image: Optional[str] = None) -> tuple[ErrorType, Optional[TalkView]]: body = " ".join(body.split()) if not body or len(body) > BODY_MAX: return ErrorType.INVALID_INPUT, None + if image is not None and file_of(image) is None: + return ErrorType.INVALID_INPUT, None if _LINK.search(body) or _PHONE.search(body): return ErrorType.LINK_NOT_ALLOWED, None err, region = await DB_SESSION_MNG.execute_lambda(lambda s: self.regions.get(s, region_code)) @@ -87,7 +95,7 @@ class TalkService: if n >= DAILY_MAX: return ErrorType.DAILY_LIMIT, None weather = await self._weather_now(region_code) - err, t = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, region_code, body, weather)) + err, t = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, region_code, body, weather, image)) if err is not ErrorType.SUCCESS or t is None: return err, None return ErrorType.SUCCESS, TalkView(talk=t, author=user, region_name=region.short_name, liked=False, mine=True) @@ -104,11 +112,11 @@ class TalkService: return err, None return (ErrorType.SUCCESS, t) if t is not None else (ErrorType.NOT_FOUND, None) - async def like(self, user: User, talk_id: int, on: bool) -> tuple[ErrorType, Optional[int]]: + async def like(self, who: Liker, talk_id: int, on: bool) -> tuple[ErrorType, Optional[int]]: err, _ = await self._talk(talk_id) if err is not ErrorType.SUCCESS: return err, None - return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_like(s, talk_id, user.user_id, on)) + return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.toggle_like(s, talk_id, who, on)) async def report(self, user: User, talk_id: int, reason: TalkReport) -> ErrorType: err, t = await self._talk(talk_id) diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 4b433f2..1b4f297 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -43,7 +43,7 @@ def anyio_backend(): _VOLATILE = ( "weather_hourly", "weather_daily", "cloud_hourly", "openmeteo_hourly", "air_station", "air_quality", "weather_warning", "sun_time", - "sky_score", "index_score", "post", "post_like", "post_save", "comment", "comment_like", "holiday", "solar_term", "users", + "sky_score", "index_score", "post", "post_like", "post_like_anon", "post_save", "comment", "comment_like", "comment_like_anon", "holiday", "solar_term", "users", ) diff --git a/backend/tests/test_anon_like.py b/backend/tests/test_anon_like.py new file mode 100644 index 0000000..e956a54 --- /dev/null +++ b/backend/tests/test_anon_like.py @@ -0,0 +1,87 @@ +import pytest +from httpx import ASGITransport, AsyncClient + +from router.router import app + +REGION = "1144000000" +IP_A = {"X-Forwarded-For": "203.0.113.10"} +IP_B = {"X-Forwarded-For": "203.0.113.20"} + + +def client(): + return AsyncClient(transport=ASGITransport(app=app), base_url="http://test") + + +async def _login(c, login_id: str) -> dict: + body = (await c.post("/v1/auth/signup", json={"login_id": login_id, "password": "password1", "nickname": login_id})).json() + return {"Authorization": f"Bearer {body['access_token']}"} + + +@pytest.mark.anyio +async def test_anon_post_like_counts_once_per_ip(offline): + async with client() as c: + post_id = (await c.get("/v1/feed", params={"region": REGION})).json()["posts"][0]["post_id"] + url = f"/v1/reaction/post/{post_id}/like" + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_B)).json()["like_count"] == 2 + h = await _login(c, "anon_like_01") + assert (await c.post(url, headers={**h, **IP_A})).json()["like_count"] == 3 + + feed_a = (await c.get("/v1/feed", params={"region": REGION}, headers=IP_A)).json() + p = next(x for x in feed_a["posts"] if x["post_id"] == post_id) + assert p["liked"] is True and p["like_count"] == 3 and "saved" not in p + other = (await c.get("/v1/feed", params={"region": REGION}, headers={"X-Forwarded-For": "203.0.113.30"})).json() + assert next(x for x in other["posts"] if x["post_id"] == post_id)["liked"] is False + + assert (await c.delete(url, headers=IP_A)).json()["like_count"] == 2 + assert (await c.delete(url, headers=IP_A)).json()["like_count"] == 2 + + +@pytest.mark.anyio +async def test_only_last_forwarded_ip_counts(offline): + """클라이언트가 X-Forwarded-For 앞쪽을 바꿔도 nginx 가 붙인 마지막 주소가 같으면 같은 사람이다.""" + async with client() as c: + post_id = (await c.get("/v1/feed", params={"region": REGION})).json()["posts"][0]["post_id"] + url = f"/v1/reaction/post/{post_id}/like" + assert (await c.post(url, headers={"X-Forwarded-For": "1.1.1.1, 203.0.113.10"})).json()["like_count"] == 1 + assert (await c.post(url, headers={"X-Forwarded-For": "2.2.2.2, 203.0.113.10"})).json()["like_count"] == 1 + + +@pytest.mark.anyio +async def test_anon_comment_like(offline): + async with client() as c: + post_id = (await c.get("/v1/feed", params={"region": REGION})).json()["posts"][0]["post_id"] + h = await _login(c, "anon_like_02") + comment_id = (await c.post(f"/v1/reaction/post/{post_id}/comment", headers=h, json={"body": "맑아요"})).json()["comment"]["comment_id"] + url = f"/v1/reaction/comment/{comment_id}/like" + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_B)).json()["like_count"] == 2 + assert (await c.post(url, headers=h)).json()["like_count"] == 3 + + listed = (await c.get(f"/v1/reaction/post/{post_id}/comment/list", headers=IP_A)).json()["comments"] + assert listed[0]["liked"] is True + listed = (await c.get(f"/v1/reaction/post/{post_id}/comment/list", headers={"X-Forwarded-For": "203.0.113.30"})).json()["comments"] + assert listed[0]["liked"] is False + + assert (await c.delete(url, headers=IP_B)).json()["like_count"] == 2 + + +@pytest.mark.anyio +async def test_anon_talk_like(): + async with client() as c: + h = await _login(c, "anon_like_03") + talk_id = (await c.post("/v1/talk", json={"region_code": REGION, "body": "바람 불어요"}, headers=h)).json()["talk"]["talk_id"] + url = f"/v1/talk/{talk_id}/like" + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_A)).json()["like_count"] == 1 + assert (await c.post(url, headers=IP_B)).json()["like_count"] == 2 + assert (await c.post(url, headers=h)).json()["like_count"] == 3 + + talks = (await c.get("/v1/talk/list", headers=IP_A)).json()["talks"] + assert next(x for x in talks if x["talk_id"] == talk_id)["liked"] is True + talks = (await c.get("/v1/talk/list", headers={"X-Forwarded-For": "203.0.113.30"})).json()["talks"] + assert next(x for x in talks if x["talk_id"] == talk_id)["liked"] is False + + assert (await c.delete(url, headers=IP_A)).json()["like_count"] == 2 diff --git a/backend/tests/test_auth_reaction.py b/backend/tests/test_auth_reaction.py index fd8f1af..4d4b749 100644 --- a/backend/tests/test_auth_reaction.py +++ b/backend/tests/test_auth_reaction.py @@ -50,11 +50,11 @@ async def test_signup_rejects_bad_input(): @pytest.mark.anyio -async def test_reactions_require_login_and_update_feed(offline): +async def test_comment_requires_login_and_reactions_update_feed(offline): async with client() as c: feed = (await c.get("/v1/feed", params={"region": REGION})).json() post_id = feed["posts"][0]["post_id"] - assert (await c.post(f"/v1/reaction/post/{post_id}/like")).status_code == 401 + assert (await c.post(f"/v1/reaction/post/{post_id}/comment", json={"body": "안녕"})).status_code == 401 token = (await _signup(c))["access_token"] h = {"Authorization": f"Bearer {token}"} diff --git a/backend/tests/test_feed.py b/backend/tests/test_feed.py index bfba8ae..af08fe6 100644 --- a/backend/tests/test_feed.py +++ b/backend/tests/test_feed.py @@ -151,6 +151,27 @@ def test_arrange_orders_by_slot_and_keeps_same_types_apart(): assert night[:3] == [PostType.ALERT, PostType.WEATHER, PostType.TOMORROW] and night[-1] is PostType.QUOTE +def test_arrange_puts_shareable_cards_before_plain_info(): + """주말·노을·행사는 앞쪽 절반, 공기·자외선·상식은 각 뒤로.""" + from datetime import datetime + + from common.utils.kma_time import KST + from services.feed_service import arrange + + sunset = datetime(2026, 10, 1, 18, 10, tzinfo=KST) + cards = [_card(t, n) for n, t in enumerate([ + PostType.WEATHER, PostType.ALERT, PostType.GAK, PostType.GAK, PostType.GAK, PostType.SUNSET, PostType.TOMORROW, PostType.WEEK, + PostType.EVENT, PostType.EVENT, PostType.SEASON, PostType.TIP, PostType.QUOTE, PostType.WEEKEND_PLAN, PostType.AIR, PostType.UV, PostType.MOON, + ])] + for slot, h in (("morning", 8), ("day", 13), ("evening", 17), ("evening", 19), ("night", 22)): + out = [c.post_type for c in arrange(cards, slot, datetime(2026, 10, 1, h, tzinfo=KST), sunset, False, "2026-10-01:1114000000")] + half = len(out) // 2 + assert PostType.SUNSET in out[:half] and PostType.WEEK in out[:half], (slot, out) + assert all(i < half + 2 for i, t in enumerate(out) if t is PostType.EVENT), (slot, out) + first_gak = out.index(PostType.GAK) + assert all(out.index(t) > first_gak for t in (PostType.AIR, PostType.TIP) if t in out), (slot, out) + + def test_arrange_scatters_up_to_three_events_same_spot_all_day(): from datetime import datetime diff --git a/backend/tests/test_hero_stats.py b/backend/tests/test_hero_stats.py index 4749aff..6e75985 100644 --- a/backend/tests/test_hero_stats.py +++ b/backend/tests/test_hero_stats.py @@ -60,10 +60,9 @@ def test_status_line_has_four_by_day_and_warns_only_caution(): assert _status(x) == [("습도", "습함", "normal"), ("불쾌지수", "쾌적", "normal"), ("자외선", "높음", "warn"), ("미세먼지", "나쁨", "warn")] -def test_status_line_shows_discomfort_only_june_to_september(): - """불쾌지수는 더위 지표라 10월 비 오는 날에도 '쾌적'이 나온다. 기상청처럼 6~9월에만.""" +def test_status_line_shows_discomfort_all_year(): x = HeroInput(now=NOW, night=False, humidity=95, discomfort=66, uv=1.0, air=AirGrade.GOOD) - assert [s.label for s in hero_status(x)] == ["습도", "자외선", "미세먼지"] + assert [s.label for s in hero_status(x)] == ["습도", "불쾌지수", "자외선", "미세먼지"] def test_status_line_drops_uv_at_night_and_missing_values(): diff --git a/backend/tests/test_index_calc.py b/backend/tests/test_index_calc.py index 3ea3c38..1f80e31 100644 --- a/backend/tests/test_index_calc.py +++ b/backend/tests/test_index_calc.py @@ -275,6 +275,28 @@ def test_seasonal_gak_good_day_high_bad_day_low(code, good, bad): assert _seed_score(code, **bad) <= 30 +@pytest.mark.parametrize("code, good, bad", [ + ("hangang", dict(feels=20.0, wind=1.5, hum=45), dict(feels=18.0, prob=80, rain=RainType.RAIN)), + ("themepark", dict(day=_WED, feels=20.0, wind=2.0), dict(feels=18.0, prob=80, rain=RainType.RAIN)), + ("date", dict(feels=20.0, wind=1.5), dict(feels=5.0, prob=90, rain=RainType.RAIN, pm25=60)), + ("frizz", dict(feels=28.0, prob=90, rain=RainType.RAIN, hum=90), dict(feels=12.0, hum=35)), + ("boiler", dict(feels=2.0, hum=85, prob=60), dict(feels=22.0, hum=40)), + ("sunscreen", dict(feels=26.0, uv=8.0), dict(feels=8.0, uv=0.5)), + ("mosquito", dict(feels=27.0, hum=85, wind=0.5), dict(feels=15.0, hum=40, wind=6.0)), + ("tennis", dict(feels=18.0, wind=1.0, hum=45), dict(feels=18.0, prob=80, rain=RainType.RAIN)), + ("hyodo", dict(feels=20.0, wind=1.5), dict(feels=20.0, prob=80, rain=RainType.RAIN)), + ("thanks", dict(feels=0.0, prob=90, rain=RainType.RAIN), dict(feels=20.0)), + ("gift", dict(feels=17.0, wind=1.5), dict(feels=17.0, prob=80, rain=RainType.RAIN)), + ("party", dict(feels=3.0, prob=90, rain=RainType.RAIN), dict(day=_WED, feels=20.0)), + ("game", dict(feels=3.0, prob=90, rain=RainType.RAIN, pm25=70), dict(day=_WED, feels=20.0)), + ("selfie", dict(wind=1.0, hum=35, sunshine_ratio=0.8), dict(prob=90, rain=RainType.RAIN, hum=90, wind=8.0, sunshine_ratio=0.0)), + ("sentimental", dict(feels=13.0, prob=90, rain=RainType.RAIN, wind=3.0, hum=85), dict(feels=28.0, hum=40, wind=0.5)), +]) +def test_trend_and_mood_gak_good_day_high_bad_day_low(code, good, bad): + assert _seed_score(code, **good) >= 80 + assert _seed_score(code, **bad) <= 30 + + def test_new_gak_100_only_when_every_factor_is_perfect(): perfect = dict(feels=19.5, wind=1.0, hum=35) assert _seed_score("golf", **perfect) == 100 diff --git a/backend/tests/test_my_gak.py b/backend/tests/test_my_gak.py index 998e2f7..b57368f 100644 --- a/backend/tests/test_my_gak.py +++ b/backend/tests/test_my_gak.py @@ -1,10 +1,15 @@ +from datetime import date + import pytest from httpx import ASGITransport, AsyncClient -from common.database.db_session_manager import DB_SESSION_MNG -from crud.index_crud import IndexCRUD +from common.enums import RainType, Sky from router.router import app -from services.my_gak_service import MAX_PER_USER +from services.calc.index_calc import Context, Hour, evaluate +from services.calc.my_gak_calc import MyRule, axes, definition +from services.my_gak_service import MAX_PER_USER, gak_name + +RULE = {"temp": [15, 25], "rain": "dry", "slots": ["evening", "night"]} def client(): @@ -12,48 +17,70 @@ def client(): async def _login(c, login_id: str) -> dict: - body = (await c.post("/v1/auth/signup", json={"login_id": login_id, "password": "password1", "nickname": "섞기토끼"})).json() + body = (await c.post("/v1/auth/signup", json={"login_id": login_id, "password": "password1", "nickname": "조건토끼"})).json() return {"Authorization": f"Bearer {body['access_token']}"} -@pytest.mark.anyio -async def test_mixable_without_login_excludes_life_gak(): - async with client() as c: - body = (await c.get("/v1/my-gak")).json() - _, defs = await DB_SESSION_MNG.execute_lambda(lambda s: IndexCRUD().definitions(s)) - ids = {d.name: d.index_id for d in defs} - assert body["items"] == [] - mixable = set(body["mixable"]) - assert {ids["러닝각"], ids["치맥각"]} <= mixable - assert not {ids["우산각"], ids["교통체증각"]} & mixable +def _hours(feels: float, rain: RainType = RainType.NONE, prob: int = 0, wind: float = 1.0, humidity: int = 50) -> list[Hour]: + return [Hour(hour=h, feels_c=feels, rain_type=rain, rain_prob=prob, wind_ms=wind, humidity=humidity, sky=Sky.CLEAR) for h in (19, 20, 21)] + + +def _score(rule: MyRule, hours: list[Hour], pm25: int | None = 10) -> int: + ctx = Context(day=date(2026, 10, 20), is_holiday=False, pm25=pm25, air_label=None, moon=0, sunset_score=None, wind_warning=False, lookahead_rain_prob=0) + return evaluate(definition(rule), [hours], ctx).score + + +def test_name_gets_gak_suffix_and_rejects_links_and_numbers(): + assert gak_name(" 소맥 ") == "소맥각" + assert gak_name("야독각") == "야독각" + assert gak_name("naver.com") is None + assert gak_name("01012345678") is None + assert gak_name("가" * 12) is None + + +def test_only_chosen_conditions_count_and_score_falls_with_distance(): + rule = MyRule(temp=(15, 25), rain="dry") + assert axes(rule) == ["temp", "rain"] + inside = _score(rule, _hours(20)) + near = _score(rule, _hours(27)) + far = _score(rule, _hours(33)) + assert inside >= 90 and inside > near > far + # 고르지 않은 바람·습도는 아무리 나빠도 점수에 안 들어간다 + assert _score(rule, _hours(20, wind=15, humidity=95)) == inside + + +def test_dry_rule_caps_when_raining_and_wet_rule_likes_rain(): + assert _score(MyRule(rain="dry"), _hours(20, RainType.RAIN, 90)) <= 20 + assert _score(MyRule(rain="wet"), _hours(20, RainType.RAIN, 90)) >= 90 + + +def test_wind_and_air_limits(): + assert _score(MyRule(wind_max=4), _hours(20, wind=2)) > _score(MyRule(wind_max=4), _hours(20, wind=9)) + assert _score(MyRule(air="good"), _hours(20), pm25=10) > _score(MyRule(air="good"), _hours(20), pm25=40) @pytest.mark.anyio -async def test_add_list_delete_and_same_pair_is_one(): +async def test_add_list_delete_and_limits(): async with client() as c: - assert (await c.post("/v1/my-gak", json={"index_ids": [1, 2]})).status_code == 401 - h = await _login(c, "mix_01") - a, b = sorted((await c.get("/v1/my-gak")).json()["mixable"])[:2] - first = (await c.post("/v1/my-gak", json={"index_ids": [b, a]}, headers=h)).json()["item"] - assert first["index_ids"] == [a, b] - again = (await c.post("/v1/my-gak", json={"index_ids": [a, b]}, headers=h)).json()["item"] - assert again["my_gak_id"] == first["my_gak_id"] - assert [g["my_gak_id"] for g in (await c.get("/v1/my-gak", headers=h)).json()["items"]] == [first["my_gak_id"]] - assert (await c.delete(f"/v1/my-gak/{first['my_gak_id']}", headers=h)).json()["result"]["success"] is True - assert (await c.get("/v1/my-gak", headers=h)).json()["items"] == [] - assert (await c.delete(f"/v1/my-gak/{first['my_gak_id']}", headers=h)).json()["result"]["desc"] == "NOT_FOUND" + assert (await c.post("/v1/my-gak", json={"name": "소맥", "rule": RULE})).status_code == 401 + h = await _login(c, "rule_01") + assert (await c.get("/v1/my-gak")).json()["items"] == [] + item = (await c.post("/v1/my-gak", json={"name": "소맥", "rule": RULE}, headers=h)).json()["item"] + assert item["name"] == "소맥각" and item["rule"]["temp"] == [15, 25] and item["rule"]["slots"] == ["evening", "night"] + assert [g["my_gak_id"] for g in (await c.get("/v1/my-gak", headers=h)).json()["items"]] == [item["my_gak_id"]] + assert (await c.delete(f"/v1/my-gak/{item['my_gak_id']}", headers=h)).json()["result"]["success"] is True + assert (await c.delete(f"/v1/my-gak/{item['my_gak_id']}", headers=h)).json()["result"]["desc"] == "NOT_FOUND" + for i in range(MAX_PER_USER): + assert (await c.post("/v1/my-gak", json={"name": f"각{chr(0xAC00 + i)}", "rule": RULE}, headers=h)).json()["item"] + assert (await c.post("/v1/my-gak", json={"name": "하나더", "rule": RULE}, headers=h)).json()["result"]["desc"] == "INVALID_INPUT" @pytest.mark.anyio -async def test_rejects_same_gak_unmixable_and_over_limit(): +async def test_rejects_bad_rules(): async with client() as c: - h = await _login(c, "mix_02") - mixable = sorted((await c.get("/v1/my-gak")).json()["mixable"]) - bad = lambda ids: c.post("/v1/my-gak", json={"index_ids": ids}, headers=h) # noqa: E731 - assert (await bad([mixable[0], mixable[0]])).json()["result"]["desc"] == "INVALID_INPUT" - assert (await bad([mixable[0], 9999])).json()["result"]["desc"] == "INVALID_INPUT" - assert (await bad([mixable[0]])).status_code == 422 - pairs = [(mixable[0], x) for x in mixable[1 : MAX_PER_USER + 1]] - for p in pairs: - assert (await bad(list(p))).json()["item"] - assert (await bad([mixable[1], mixable[2]])).json()["result"]["desc"] == "INVALID_INPUT" + h = await _login(c, "rule_02") + bad = lambda rule: c.post("/v1/my-gak", json={"name": "야독", "rule": rule}, headers=h) # noqa: E731 + assert (await bad({})).status_code == 422 + assert (await bad({"temp": [25, 15]})).status_code == 422 + assert (await bad({"temp": [15, 25], "slots": []})).status_code == 422 + assert (await bad({"humidity": [10, 120]})).status_code == 422 diff --git a/backend/tests/test_talk_image.py b/backend/tests/test_talk_image.py new file mode 100644 index 0000000..90f839a --- /dev/null +++ b/backend/tests/test_talk_image.py @@ -0,0 +1,59 @@ +import io + +import pytest +from httpx import ASGITransport, AsyncClient +from PIL import Image + +from router.router import app + +REGION = "1144000000" +GPS_IFD = 0x8825 + + +def client(): + return AsyncClient(transport=ASGITransport(app=app), base_url="http://test") + + +async def _login(c, login_id: str) -> dict: + body = (await c.post("/v1/auth/signup", json={"login_id": login_id, "password": "password1", "nickname": login_id})).json() + return {"Authorization": f"Bearer {body['access_token']}"} + + +def _jpeg_with_gps(w: int = 2400, h: int = 1600) -> bytes: + exif = Image.Exif() + exif[0x010F] = "PhoneMaker" + exif[GPS_IFD] = {1: "N", 2: (37.0, 33.0, 0.0), 3: "E", 4: (126.0, 58.0, 0.0)} + buf = io.BytesIO() + Image.new("RGB", (w, h), (120, 180, 230)).save(buf, "JPEG", exif=exif) + return buf.getvalue() + + +@pytest.mark.anyio +async def test_upload_strips_location_resizes_and_attaches_to_talk(): + src = _jpeg_with_gps() + assert Image.open(io.BytesIO(src)).getexif().get_ifd(GPS_IFD) + async with client() as c: + assert (await c.post("/v1/talk/image", files={"file": ("a.jpg", src, "image/jpeg")})).status_code == 401 + h = await _login(c, "photo_01") + url = (await c.post("/v1/talk/image", files={"file": ("a.jpg", src, "image/jpeg")}, headers=h)).json()["image"] + got = await c.get(url) + assert got.status_code == 200 and got.headers["content-type"] == "image/webp" + img = Image.open(io.BytesIO(got.content)) + assert max(img.size) == 1080 + assert not img.getexif() + talk = (await c.post("/v1/talk", json={"region_code": REGION, "body": "하늘 사진", "image": url}, headers=h)).json()["talk"] + assert talk["image"] == url + listed = (await c.get("/v1/talk/list")).json()["talks"][0] + assert listed["image"] == url + + +@pytest.mark.anyio +async def test_rejects_non_images_and_foreign_paths(): + async with client() as c: + h = await _login(c, "photo_02") + bad = (await c.post("/v1/talk/image", files={"file": ("a.txt", b"not an image", "text/plain")}, headers=h)).json() + assert bad["result"]["desc"] == "INVALID_INPUT" + for image in ("https://evil.example/a.webp", "/v1/talk/image/../../etc/passwd", "/v1/talk/image/" + "0" * 32 + ".webp"): + res = (await c.post("/v1/talk", json={"region_code": REGION, "body": "안녕", "image": image}, headers=h)).json() + assert res["result"]["desc"] == "INVALID_INPUT" + assert (await c.get("/v1/talk/image/" + "0" * 32 + ".webp")).status_code == 404 diff --git a/compose.yaml b/compose.yaml index 67d2d47..1d73674 100644 --- a/compose.yaml +++ b/compose.yaml @@ -43,6 +43,8 @@ services: REDIS_PORT: "6379" ports: - "${API_BIND:-9810}:9800" + volumes: + - uploads:/app/uploads # 사람 글 사진 depends_on: postgres: condition: service_healthy @@ -104,3 +106,4 @@ services: volumes: pgdata: redisdata: + uploads: diff --git a/docs/각_계산기준.md b/docs/각_계산기준.md index 3aedaca..1e3e182 100644 --- a/docs/각_계산기준.md +++ b/docs/각_계산기준.md @@ -17,39 +17,73 @@ | 순서 | 각 | 코드 | 분류 | 중요도 | 시간대 | 기온 | 비 | 바람 | 습도 | 미세먼지 | 시간 | 재미 각 | 계절 핵심 | |---:|---|---|---|:---:|---|---:|---:|---:|---:|---:|---:|:---:|:---:| | 1 | 야장각 | `yajang` | 먹고 마시기 | 중 | 18~24시 | 30% | 25% | 15% | 10% | 10% | 10% | ○ | | -| 2 | 피크닉각 | `picnic` | 밖에서 놀기 | 상 | 11~16시 | 25% | 25% | 15% | 5% | 10% | 10% | | ○ | +| 2 | 피크닉각 | `picnic` | 밖에서 놀기 | 상 | 11~16시 | 20% | 20% | 15% | 5% | 10% | 10% | | ○ | | 3 | 치맥각 | `chimaek` | 먹고 마시기 | 중 | 18~23시 | 30% | 20% | 15% | 15% | 10% | 10% | ○ | | | 4 | 산책각 | `walk` | 밖에서 놀기 | 상 | 18~22시 | 30% | 25% | 15% | 10% | 15% | 5% | | | -| 5 | 환기각 | `vent` | 집안일 | 하 | 10~12시 / 12~14시 / 14~16시 / 16~18시 | 10% | 15% | 15% | 10% | 45% | 5% | | | -| 6 | 등산각 | `hiking` | 밖에서 놀기 | 상 | 7~12시 | 25% | 25% | 20% | 5% | 10% | 5% | | ○ | -| 7 | 세차각 | `carwash` | 집안일 | 하 | 9~18시 (비는 2일 뒤까지 봄) | 5% | 60% | 10% | 10% | 10% | 5% | | | -| 8 | 캠핑각 | `camping` | 밖에서 놀기 | 상 | 18~다음 날 8시 | 30% | 25% | 15% | 15% | 10% | 5% | | ○ | -| 9 | 러닝각 | `running` | 밖에서 놀기 | 상 | 6~8시 / 19~22시 | 35% | 20% | 10% | 15% | 10% | 5% | | | +| 5 | 환기각 | `vent` | 집안일 | 하 | 10~12시 / 12~14시 / 14~16시 / 16~18시 | 10% | 15% | 15% | 20% | 35% | 5% | | | +| 6 | 등산각 | `hiking` | 밖에서 놀기 | 상 | 7~12시 | 20% | 20% | 15% | 5% | 10% | 5% | | ○ | +| 7 | 세차각 | `carwash` | 집안일 | 하 | 9~18시 (비는 2일 뒤까지 봄) | 5% | 40% | 10% | 10% | 10% | 5% | | | +| 8 | 캠핑각 | `camping` | 밖에서 놀기 | 상 | 18~다음 날 8시 | 40% | 25% | 15% | 5% | 10% | 5% | | ○ | +| 9 | 러닝각 | `running` | 밖에서 놀기 | 상 | 6~8시 / 19~22시 | 35% | 20% | 10% | 15% | 15% | 5% | | | | 10 | 별보기각 | `stars` | 밖에서 놀기 | 중 | 21~다음 날 2시 | 5% | 10% | 5% | 5% | 15% | 45% | | ○ | -| 11 | 짬뽕각 | `jjamppong` | 먹고 마시기 | 하 | 11~14시 / 17~20시 | 40% | 25% | 15% | 10% | 5% | 5% | ○ | | -| 12 | 막걸리각 | `makgeolli` | 먹고 마시기 | 하 | 17~22시 | 15% | 50% | 10% | 15% | 5% | 5% | ○ | | -| 13 | 뜨아각 | `iced_hot` | 먹고 마시기 | 하 | 7~10시 | 50% | 10% | 15% | 10% | 5% | 10% | ○ | | +| 11 | 짬뽕각 | `jjamppong` | 먹고 마시기 | 하 | 9~24시 | 50% | 25% | 5% | 10% | 5% | 5% | ○ | | +| 12 | 막걸리각 | `makgeolli` | 먹고 마시기 | 하 | 9~24시 | 15% | 55% | 5% | 15% | 5% | 5% | ○ | | +| 13 | 뜨아각 | `iced_hot` | 먹고 마시기 | 하 | 7~10시 | 90% | 0% | 0% | 0% | 0% | 10% | ○ | | | 14 | 빨래각 | `laundry` | 집안일 | 상 | 9~16시 | 15% | 30% | 15% | 10% | 0% | 5% | | | -| 15 | 자전거각 | `bike` | 밖에서 놀기 | 상 | 9~19시 | 25% | 25% | 25% | 5% | 10% | 5% | | | -| 16 | 멍뭉산책각 | `dog` | 밖에서 놀기 | 중 | 7~9시 / 17~20시 | 35% | 25% | 10% | 5% | 15% | 5% | | | -| 17 | 김서림각 | `glasses` | 생활 고민 | 중 | 7~9시 | 50% | 10% | 5% | 30% | 0% | 5% | | | -| 18 | 화장붕괴각 | `makeup` | 생활 고민 | 중 | 10~18시 | 40% | 10% | 10% | 35% | 0% | 5% | | | -| 19 | 냉면각 | `naengmyeon` | 먹고 마시기 | 하 | 11~14시 | 55% | 15% | 5% | 15% | 5% | 5% | ○ | | -| 20 | 택시대란각 | `taxi` | 생활 고민 | 중 | 22~다음 날 2시 | 15% | 55% | 10% | 5% | 0% | 15% | | | -| 21 | 배달폭주각 | `delivery` | 생활 고민 | 중 | 17~21시 | 20% | 50% | 10% | 5% | 5% | 10% | | | -| 22 | 가드닝각 | `garden` | 집안일 | 하 | 7~10시 | 25% | 30% | 10% | 15% | 10% | 5% | | | +| 15 | 자전거각 | `bike` | 밖에서 놀기 | 상 | 9~19시 | 20% | 20% | 20% | 5% | 10% | 5% | | | +| 16 | 멍뭉산책각 | `dog` | 밖에서 놀기 | 중 | 7~9시 / 17~20시 | 40% | 25% | 10% | 5% | 15% | 5% | | | +| 17 | 김서림각 | `glasses` | 생활 고민 | 중 | 7~9시 | 70% | 10% | 0% | 15% | 0% | 5% | | | +| 18 | 화장붕괴각 | `makeup` | 생활 고민 | 중 | 10~18시 | 55% | 5% | 0% | 35% | 0% | 5% | | | +| 19 | 냉면각 | `naengmyeon` | 먹고 마시기 | 하 | 11~14시 | 65% | 15% | 5% | 5% | 5% | 5% | ○ | | +| 20 | 택시대란각 | `taxi` | 생활 고민 | 중 | 22~다음 날 2시 | 20% | 65% | 0% | 0% | 0% | 15% | | | +| 21 | 배달폭주각 | `delivery` | 생활 고민 | 중 | 17~21시 | 20% | 65% | 5% | 0% | 0% | 10% | | | +| 22 | 가드닝각 | `garden` | 집안일 | 하 | 7~10시 | 20% | 25% | 10% | 10% | 10% | 5% | | | | 23 | 사진산책각 | `photo` | 밖에서 놀기 | 중 | 일몰 앞뒤 1시간 | 10% | 25% | 10% | 5% | 10% | 30% | | | -| 24 | 야구각 | `baseball` | 밖에서 놀기 | 하 | 18~22시 | 25% | 40% | 10% | 5% | 10% | 10% | ○ | | -| 25 | 공부각 | `study` | 집안일 | 하 | 13~18시 | 35% | 35% | 10% | 5% | 5% | 10% | ○ | | -| 26 | 넷플릭스각 | `netflix` | 집안일 | 하 | 20~24시 | 30% | 35% | 15% | 5% | 0% | 15% | ○ | | -| 27 | 군밤각 | `chestnut` | 먹고 마시기 | 하 | 17~21시 | 55% | 25% | 10% | 0% | 5% | 5% | ○ | | +| 24 | 야구각 | `baseball` | 밖에서 놀기 | 하 | 18~22시 | 35% | 35% | 10% | 0% | 10% | 10% | ○ | | +| 25 | 공부각 | `study` | 집안일 | 하 | 9~24시 | 40% | 35% | 5% | 5% | 5% | 10% | ○ | | +| 26 | 넷플릭스각 | `netflix` | 집안일 | 하 | 9~24시 | 30% | 50% | 5% | 0% | 0% | 15% | ○ | | +| 27 | 군밤각 | `chestnut` | 먹고 마시기 | 하 | 17~21시 | 60% | 25% | 5% | 0% | 5% | 5% | ○ | | | 28 | 골프각 | `golf` | 밖에서 놀기 | 중 | 7~12시 / 12~17시 | 30% | 30% | 25% | 5% | 5% | 5% | | | -| 29 | 집콕각 | `jipkok` | 집안일 | 하 | 10~18시 | 30% | 30% | 10% | 5% | 20% | 5% | ○ | | +| 29 | 집콕각 | `jipkok` | 집안일 | 하 | 9~24시 | 35% | 30% | 5% | 5% | 20% | 5% | ○ | | | 30 | 낚시각 | `fishing` | 밖에서 놀기 | 중 | 5~9시 / 16~19시 | 25% | 25% | 35% | 0% | 5% | 10% | | | | 31 | 드라이브각 | `drive` | 밖에서 놀기 | 상 | 10~17시 | 20% | 30% | 5% | 5% | 15% | 10% | | | | 32 | 연날리기각 | `kite` | 밖에서 놀기 | 하 | 11~16시 | 20% | 25% | 45% | 0% | 5% | 5% | | | | 33 | 물놀이각 | `waterplay` | 밖에서 놀기 | 중 | 11~17시 | 40% | 25% | 10% | 0% | 0% | 5% | | | | 34 | 김장각 | `kimjang` | 집안일 | 하 | 9~16시 | 50% | 25% | 10% | 0% | 5% | 10% | | | +| 35 | 꽃구경각 | `flower` | 밖에서 놀기 | 중 | 10~17시 | 20% | 25% | 10% | 0% | 15% | 5% | | | +| 36 | 이불빨래각 | `blanket` | 집안일 | 중 | 9~16시 | 10% | 30% | 15% | 15% | 10% | 0% | | | +| 37 | 빙수각 | `bingsu` | 먹고 마시기 | 하 | 13~18시 | 70% | 10% | 5% | 10% | 0% | 5% | ○ | | +| 38 | 실내건조각 | `indoordry` | 집안일 | 하 | 9~21시 | 15% | 60% | 0% | 20% | 0% | 5% | | | +| 39 | 한강밤바람각 | `riverwind` | 밖에서 놀기 | 중 | 19~23시 | 30% | 30% | 20% | 10% | 5% | 5% | | | +| 40 | 단풍각 | `foliage` | 밖에서 놀기 | 중 | 9~16시 | 15% | 25% | 10% | 0% | 10% | 5% | | | +| 41 | 억새각 | `silvergrass` | 밖에서 놀기 | 하 | 일몰 앞뒤 2시간 | 10% | 25% | 15% | 0% | 10% | 30% | | | +| 42 | 군고구마각 | `sweetpotato` | 먹고 마시기 | 하 | 16~21시 | 65% | 20% | 5% | 0% | 5% | 5% | ○ | | +| 43 | 해돋이각 | `sunrise` | 밖에서 놀기 | 중 | 일몰 앞뒤 1시간 | 10% | 20% | 10% | 0% | 5% | 40% | | | +| 44 | 눈사람각 | `snowman` | 밖에서 놀기 | 하 | 9~16시 | 50% | 10% | 20% | 0% | 0% | 20% | ○ | | +| 45 | 붕어빵각 | `bungeoppang` | 먹고 마시기 | 하 | 15~21시 | 70% | 15% | 5% | 0% | 5% | 5% | ○ | | +| 46 | 귤까먹기각 | `tangerine` | 집안일 | 하 | 19~24시 | 75% | 5% | 10% | 0% | 5% | 5% | ○ | | +| 47 | 우산각 | `umbrella` | 생활 고민 | 중 | 6~24시 | 0% | 90% | 0% | 0% | 0% | 10% | | | +| 48 | 파전각 | `pajeon` | 먹고 마시기 | 하 | 9~24시 | 20% | 70% | 0% | 0% | 0% | 10% | ○ | | +| 49 | 감성노래각 | `mood_song` | 집안일 | 하 | 9~24시 | 25% | 60% | 0% | 0% | 0% | 15% | ○ | | +| 50 | 트로트각 | `trot` | 밖에서 놀기 | 하 | 10~17시 | 30% | 25% | 0% | 0% | 0% | 30% | ○ | | +| 51 | 싱잉인더레인각 | `singing_rain` | 밖에서 놀기 | 하 | 6~24시 | 30% | 50% | 15% | 0% | 0% | 5% | ○ | | +| 52 | 우산분실각 | `umbrella_lost` | 생활 고민 | 중 | 9~11시 / 11~13시 / 13~15시 / 15~17시 / 17~19시 / 19~22시 | 0% | 80% | 0% | 0% | 0% | 20% | | | +| 53 | 교통체증각 | `traffic` | 생활 고민 | 중 | 7~10시 / 17~20시 | 10% | 70% | 0% | 0% | 0% | 20% | | | +| 54 | 한강각 | `hangang` | 밖에서 놀기 | 상 | 14~22시 | 30% | 25% | 15% | 5% | 10% | 15% | | | +| 55 | 놀이공원각 | `themepark` | 밖에서 놀기 | 중 | 10~20시 | 30% | 35% | 15% | 0% | 5% | 15% | | | +| 56 | 데이트각 | `date` | 밖에서 놀기 | 중 | 14~22시 | 30% | 30% | 10% | 0% | 15% | 15% | ○ | | +| 57 | 곱슬머리각 | `frizz` | 생활 고민 | 중 | 8~20시 | 10% | 25% | 0% | 60% | 0% | 5% | | | +| 58 | 보일러각 | `boiler` | 집안일 | 중 | 21~다음 날 7시 | 70% | 10% | 0% | 15% | 0% | 5% | | | +| 59 | 선크림각 | `sunscreen` | 생활 고민 | 중 | 10~16시 | 15% | 0% | 0% | 0% | 0% | 5% | | | +| 60 | 모기각 | `mosquito` | 생활 고민 | 중 | 19~24시 | 50% | 0% | 20% | 25% | 0% | 5% | | | +| 61 | 테니스각 | `tennis` | 밖에서 놀기 | 중 | 7~11시 / 17~21시 | 30% | 25% | 25% | 5% | 10% | 5% | | | +| 62 | 효도각 | `hyodo` | 밖에서 놀기 | 중 | 10~16시 | 30% | 25% | 10% | 0% | 15% | 20% | ○ | | +| 63 | 감사각 | `thanks` | 생활 고민 | 하 | 18~22시 | 50% | 30% | 0% | 0% | 0% | 20% | ○ | | +| 64 | 선물각 | `gift` | 생활 고민 | 하 | 11~19시 | 40% | 35% | 15% | 0% | 0% | 10% | ○ | | +| 65 | 파티각 | `party` | 집안일 | 하 | 18~24시 | 25% | 25% | 0% | 0% | 0% | 50% | ○ | | +| 66 | 게임각 | `game` | 집안일 | 하 | 20~다음 날 2시 | 30% | 40% | 0% | 0% | 15% | 15% | ○ | | +| 67 | 셀카각 | `selfie` | 생활 고민 | 하 | 10~17시 | 0% | 20% | 15% | 30% | 0% | 10% | ○ | | +| 68 | 센치각 | `sentimental` | 생활 고민 | 하 | 18~23시 | 35% | 30% | 10% | 10% | 0% | 15% | ○ | | ## 각별 자세히 @@ -65,7 +99,7 @@ - 습도 10%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 금 100, 토 100, 일 85, 그 외 78 -- 점수 깎이는 조건: 비 확률 80% 이상이면 0점, 바람 14m/s 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 14m/s 이상이면 0점 - 반영 못 하는 것: 모기, 가게 영업 여부, 자리 경쟁은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 오거나 바람이 쌩쌩, 오늘 야장은 접어요. 실내 포차로 피신! @@ -79,14 +113,15 @@ - 분류: 밖에서 놀기 · 중요도 상 · 아이콘 `picnic` · 재미 각 아니오 · 계절 핵심 예 · 계산 근거 화면 있음 - 시간대: 11~16시 - 요소별 규칙 (비중): - - 기온 25%: 체감 20~26°가 좋음 - - 비 25%: 비 안 올수록 좋음 + - 기온 20%: 체감 20~26°가 좋음 + - 비 20%: 비 안 올수록 좋음 - 바람 15%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 9m면 0점) - 습도 5%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 자외선 10%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 햇빛 10%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 10%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 -- 점수 깎이는 조건: 비 확률 60% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 - 반영 못 하는 것: 잔디 상태, 공원 혼잡도는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 소식이 있어요. 돗자리는 집에 고이 두기! @@ -106,7 +141,7 @@ - 습도 15%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 금 100, 토 100, 그 외 74 -- 점수 깎이는 조건: 체감 10° 미만이면 0점, 비 확률 80% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 체감 10° 미만이면 0점, 비 확률 70% 이상이면 0점 - 반영 못 하는 것: 야구 경기 같은 이벤트는 아직 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 체감 10° 아래거나 비가 와요. 치킨은 배달, 맥주는 집에서! @@ -126,7 +161,7 @@ - 습도 10%: 30~60%가 좋음 (최적 35%) - 미세먼지 15%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 55점 -- 점수 깎이는 조건: 비 확률 90% 이상이면 0점, 초미세먼지 75㎍/㎥ 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 초미세먼지 75㎍/㎥ 이상이면 0점 - 반영 못 하는 것: 길 공사, 조명은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 쏟아지거나 초미세먼지가 매우 나빠요. 오늘은 실내 걷기로! @@ -143,10 +178,10 @@ - 기온 10%: 체감 15~26°가 좋음 - 비 15%: 비 안 올수록 좋음 - 바람 15%: 적당한 바람(초속 2~5m)이 좋음 - - 습도 10%: 30~60%가 좋음 (최적 35%) - - 미세먼지 45%: 초미세먼지 낮을수록 좋음 + - 습도 20%: 30~60%가 좋음 (최적 35%) + - 미세먼지 35%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 초미세먼지 75㎍/㎥ 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 초미세먼지 75㎍/㎥ 이상이면 0점, 비 확률 70% 이상이면 최대 20점, 습도 85% 이상이면 최대 40점 - 반영 못 하는 것: 집 방향과 주변 공사 먼지는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 초미세먼지가 매우 나빠요. 창문 꼭 닫고 공기청정기 ON! @@ -160,15 +195,16 @@ - 분류: 밖에서 놀기 · 중요도 상 · 아이콘 `hiking` · 재미 각 아니오 · 계절 핵심 예 · 계산 근거 화면 있음 - 시간대: 7~12시 - 요소별 규칙 (비중): - - 기온 25%: 체감 10~20°가 좋음, 산 정상 보정 -6° - - 비 25%: 비 안 올수록 좋음 - - 바람 20%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 기온 20%: 체감 10~20°가 좋음, 산 정상 보정 -6° + - 비 20%: 비 안 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) - 습도 5%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - - 자외선 5%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 자외선 10%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 햇빛 10%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 가시거리 5%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 50 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점, wind 특보가 있으면 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, wind 특보가 있으면 - 반영 못 하는 것: 등산로 통제, 낙석 정보는 산림청 안내를 확인하세요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 소식이나 강풍 특보가 있어요. 오늘 산은 쉬어요! @@ -183,12 +219,14 @@ - 시간대: 9~18시 (비는 2일 뒤까지 봄) - 요소별 규칙 (비중): - 기온 5%: 체감 5~28°가 좋음 - - 비 60%: 비 안 올수록 좋음 + - 비 40%: 비 안 올수록 좋음 - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 10m면 0점) - 습도 10%: 낮을수록 좋음 (90%=0점 → 40%=100점) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 자외선 10%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 햇빛 10%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 비 확률 70% 이상이면 최대 20점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 최대 20점 - 반영 못 하는 것: 황사·꽃가루 같은 하늘 먼지는 일부만 반영해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 곧 비가 와요. 지금 세차하면 물 낭비! @@ -202,13 +240,13 @@ - 분류: 밖에서 놀기 · 중요도 상 · 아이콘 `camping` · 재미 각 아니오 · 계절 핵심 예 · 계산 근거 화면 있음 - 시간대: 18~다음 날 8시 - 요소별 규칙 (비중): - - 기온 30%: 체감 12~22°가 좋음 + - 기온 40%: 체감 12~22°가 좋음 - 비 25%: 비 안 올수록 좋음 - 바람 15%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 9m면 0점) - - 습도 15%: 낮을수록 좋음 (90%=0점 → 40%=100점) + - 습도 5%: 낮을수록 좋음 (90%=0점 → 40%=100점) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 요일별 점수: 금 100, 토 100, 그 외 60 -- 점수 깎이는 조건: 비 확률 60% 이상이면 0점, 바람 14m/s 이상이면 0점, 돌풍 15m/s 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점, 바람 14m/s 이상이면 0점, 돌풍 15m/s 이상이면 0점 - 반영 못 하는 것: 캠핑장 예약 상황은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 오거나 바람이 너무 세요. 텐트 날아가요! @@ -226,10 +264,9 @@ - 비 20%: 비 안 올수록 좋음 - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 10m면 0점) - 습도 15%: 낮을수록 좋음 (90%=0점 → 40%=100점) - - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - - 자외선 5%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 미세먼지 15%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 체감 35° 이상이면 0점, 비 확률 90% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 체감 35° 이상이면 0점, 비 확률 70% 이상이면 0점 - 반영 못 하는 것: 노면 상태는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 체감 35° 넘거나 비가 쏟아져요. 오늘은 러닝머신으로! @@ -250,7 +287,7 @@ - 미세먼지 15%: 초미세먼지 낮을수록 좋음 - 가시거리 15%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) - 시간·요일 45%: 달이 어두울수록 좋음 (보름 20점 → 그믐 100점) -- 점수 깎이는 조건: 흐린 시간 비율 80% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 흐린 시간 비율 80% 이상이면 0점, 비 확률 60% 이상이면 0점 - 반영 못 하는 것: 도시 불빛은 지역 평균으로만 반영해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 구름이 하늘을 꽉 덮었어요. 별은 다음 기회에! @@ -260,13 +297,13 @@ ### 짬뽕각 (`jjamppong`) -- 설명: 뜨끈한 국물이 당기는 정도 +- 설명: 오전 9시~자정, 뜨끈한 국물이 당기는 정도 - 분류: 먹고 마시기 · 중요도 하 · 아이콘 `jjamppong` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 -- 시간대: 11~14시 / 17~20시 +- 시간대: 9~24시 - 요소별 규칙 (비중): - - 기온 40%: 추울수록 좋음 (25°=0점 → 5°=100점) + - 기온 50%: 추울수록 좋음 (25°=0점 → 5°=100점) - 비 25%: 비 올수록 좋음 - - 바람 15%: 셀수록 좋음 (초속 8m=100점) + - 바람 5%: 셀수록 좋음 (초속 8m=100점) - 습도 10%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 @@ -280,13 +317,13 @@ ### 막걸리각 (`makgeolli`) -- 설명: 비 오는 날 파전에 막걸리가 당기는 정도 +- 설명: 오전 9시~자정, 비 오는 날 파전에 막걸리가 당기는 정도 - 분류: 먹고 마시기 · 중요도 하 · 아이콘 `makgeolli` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 -- 시간대: 17~22시 +- 시간대: 9~24시 - 요소별 규칙 (비중): - 기온 15%: 추울수록 좋음 (28°=0점 → 10°=100점) - - 비 50%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 비 55%: 비 올수록 좋음 + - 바람 5%: 셀수록 좋음 (초속 8m=100점) - 습도 15%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 요일별 점수: 금 100, 토 100, 그 외 50 @@ -304,11 +341,11 @@ - 분류: 먹고 마시기 · 중요도 하 · 아이콘 `iced_hot` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 7~10시 - 요소별 규칙 (비중): - - 기온 50%: 추울수록 좋음 (22°=0점 → 8°=100점) - - 비 10%: 비 올수록 좋음 - - 바람 15%: 셀수록 좋음 (초속 8m=100점) - - 습도 10%: 높을수록 좋음 (40%=0점 → 90%=100점) - - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 기온 90%: 추울수록 좋음 (22°=0점 → 8°=100점) + - 비 0%: 비 올수록 좋음 + - 바람 0%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 고정 100점 - 점수 깎이는 조건: 없음 - 반영 못 하는 것: 사람마다 달라서 재미로 봐 주세요 @@ -331,7 +368,7 @@ - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 햇빛 25%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 비 확률 60% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 - 반영 못 하는 것: 집 방향·그늘 일조량은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 소식이 있어요. 오늘 빨래는 실내 건조로! @@ -345,14 +382,15 @@ - 분류: 밖에서 놀기 · 중요도 상 · 아이콘 `bike` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 9~19시 - 요소별 규칙 (비중): - - 기온 25%: 체감 15~24°가 좋음 - - 비 25%: 비 안 올수록 좋음 - - 바람 25%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 8m면 0점) + - 기온 20%: 체감 15~24°가 좋음 + - 비 20%: 비 안 올수록 좋음 + - 바람 20%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 8m면 0점) - 습도 5%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - - 자외선 5%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 자외선 10%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 햇빛 10%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 70 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점, 바람 10m/s 이상이면 0점, 돌풍 15m/s 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 10m/s 이상이면 0점, 돌풍 15m/s 이상이면 0점 - 반영 못 하는 것: 자전거 도로 공사는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 오거나 바람이 10m/s 넘어요. 자전거는 쉬어요! @@ -366,14 +404,13 @@ - 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `dog` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 7~9시 / 17~20시 - 요소별 규칙 (비중): - - 기온 35%: 체감 5~22°가 좋음 + - 기온 40%: 체감 5~22°가 좋음 - 비 25%: 비 안 올수록 좋음 - 바람 10%: 잔잔할수록 좋음 (초속 5m까지 괜찮음, 12m면 0점) - 습도 5%: 30~60%가 좋음 (최적 35%) - 미세먼지 15%: 초미세먼지 낮을수록 좋음 - - 자외선 5%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 체감 33° 이상이면 0점, 초미세먼지 75㎍/㎥ 이상이면 0점, 지면 온도 45° 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 체감 33° 이상이면 0점, 초미세먼지 75㎍/㎥ 이상이면 0점, 지면 온도 45° 이상이면 0점, 비 확률 70% 이상이면 최대 20점 - 반영 못 하는 것: 지표면 온도는 예보 모델 값이라 실제 노면 온도와 달라요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 체감 33° 넘거나 초미세먼지가 매우 나빠요. 발바닥도 폐도 위험, 실내 놀이로! @@ -387,10 +424,10 @@ - 분류: 생활 고민 · 중요도 중 · 아이콘 `glasses` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 7~9시 - 요소별 규칙 (비중): - - 기온 50%: 추울수록 좋음 (15°=0점 → -5°=100점) + - 기온 70%: 추울수록 좋음 (15°=0점 → -5°=100점) - 비 10%: 비 올수록 좋음 - - 바람 5%: 상관없음 (50점 고정) - - 습도 30%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 바람 0%: 상관없음 (50점 고정) + - 습도 15%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 - 점수 깎이는 조건: 없음 @@ -407,9 +444,9 @@ - 분류: 생활 고민 · 중요도 중 · 아이콘 `makeup` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 10~18시 - 요소별 규칙 (비중): - - 기온 40%: 더울수록 좋음 (20°=0점 → 32°=100점) - - 비 10%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 기온 55%: 더울수록 좋음 (20°=0점 → 32°=100점) + - 비 5%: 비 올수록 좋음 + - 바람 0%: 셀수록 좋음 (초속 8m=100점) - 습도 35%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 @@ -427,10 +464,10 @@ - 분류: 먹고 마시기 · 중요도 하 · 아이콘 `naengmyeon` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 11~14시 - 요소별 규칙 (비중): - - 기온 55%: 더울수록 좋음 (18°=0점 → 32°=100점) + - 기온 65%: 더울수록 좋음 (18°=0점 → 32°=100점) - 비 15%: 비 안 올수록 좋음 - 바람 5%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) - - 습도 15%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 습도 5%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 - 점수 깎이는 조건: 없음 @@ -447,10 +484,10 @@ - 분류: 생활 고민 · 중요도 중 · 아이콘 `taxi` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 22~다음 날 2시 - 요소별 규칙 (비중): - - 기온 15%: 추울수록 좋음 (15°=0점 → -5°=100점) - - 비 55%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) - - 습도 5%: 상관없음 (50점 고정) + - 기온 20%: 추울수록 좋음 (25°=0점 → -5°=100점) + - 비 65%: 비 올수록 좋음 + - 바람 0%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 15%: 요일별 점수: 금 100, 토 100, 그 외 40 - 점수 깎이는 조건: 없음 @@ -467,11 +504,11 @@ - 분류: 생활 고민 · 중요도 중 · 아이콘 `delivery` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 17~21시 - 요소별 규칙 (비중): - - 기온 20%: 추울수록 좋음 (22°=0점 → 0°=100점) - - 비 50%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) - - 습도 5%: 상관없음 (50점 고정) - - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 기온 20%: 체감이 10~25°에서 멀수록(덥거나 추울수록) 좋음 + - 비 65%: 비 올수록 좋음 + - 바람 5%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 금 100, 토 100, 일 100, 그 외 60 - 점수 깎이는 조건: 없음 - 반영 못 하는 것: 실제 배달 앱 지표로 검증하기 전이에요 @@ -487,14 +524,15 @@ - 분류: 집안일 · 중요도 하 · 아이콘 `garden` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 7~10시 - 요소별 규칙 (비중): - - 기온 25%: 체감 12~25°가 좋음 - - 비 30%: 비 안 올수록 좋음 + - 기온 20%: 체감 12~25°가 좋음 + - 비 25%: 비 안 올수록 좋음 - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 10m면 0점) - - 습도 15%: 30~60%가 좋음 (최적 35%) + - 습도 10%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - - 자외선 5%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 자외선 10%: 자외선 2 이하면 만점, 8 이상이면 0점 (Open-Meteo) + - 햇빛 10%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점 - 반영 못 하는 것: 식물 종류는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 소식이 있어요. 물 주기는 하늘에 맡겨요! @@ -515,7 +553,7 @@ - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 가시거리 10%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) - 시간·요일 30%: 그날 노을 점수를 그대로 씀 -- 점수 깎이는 조건: 비 확률 80% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점 - 반영 못 하는 것: 장소 혼잡도는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 와요. 카메라는 쉬어요! @@ -529,13 +567,13 @@ - 분류: 밖에서 놀기 · 중요도 하 · 아이콘 `baseball` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 18~22시 - 요소별 규칙 (비중): - - 기온 25%: 체감 15~25°가 좋음 - - 비 40%: 비 안 올수록 좋음 + - 기온 35%: 체감 15~25°가 좋음 + - 비 35%: 비 안 올수록 좋음 - 바람 10%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 10m면 0점) - - 습도 5%: 30~60%가 좋음 (최적 35%) + - 습도 0%: 30~60%가 좋음 (최적 35%) - 미세먼지 10%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 월 10, 그 외 100 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점 - 반영 못 하는 것: 경기 일정과 시즌(3~10월)은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 70% 넘어요. 우천 취소 각! @@ -545,15 +583,15 @@ ### 공부각 (`study`) -- 설명: 오후 1~6시, 밖에 나가기 싫어서 공부가 잘되는 정도 +- 설명: 오전 9시~자정, 밖에 나가기 싫어서 공부가 잘되는 정도 - 분류: 집안일 · 중요도 하 · 아이콘 `study` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 -- 시간대: 13~18시 +- 시간대: 9~24시 - 요소별 규칙 (비중): - - 기온 35%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 + - 기온 40%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 - 비 35%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 바람 5%: 셀수록 좋음 (초속 8m=100점) - 습도 5%: 높을수록 좋음 (40%=0점 → 90%=100점) - - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 미세먼지 5%: 초미세먼지 높을수록 좋음 (15㎍/㎥=0점 → 75㎍/㎥=100점) - 시간·요일 10%: 요일별 점수: 토 50, 일 50, 공휴일 50, 그 외 100 - 점수 깎이는 조건: 없음 - 반영 못 하는 것: 사람마다 달라서 재미로 봐 주세요 @@ -565,14 +603,14 @@ ### 넷플릭스각 (`netflix`) -- 설명: 밤 8시~자정, 집에서 영화 보기 좋은 정도 +- 설명: 오전 9시~자정, 집에서 영화 보기 좋은 정도 - 분류: 집안일 · 중요도 하 · 아이콘 `netflix` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 -- 시간대: 20~24시 +- 시간대: 9~24시 - 요소별 규칙 (비중): - 기온 30%: 추울수록 좋음 (22°=0점 → 0°=100점) - - 비 35%: 비 올수록 좋음 - - 바람 15%: 셀수록 좋음 (초속 8m=100점) - - 습도 5%: 상관없음 (50점 고정) + - 비 50%: 비 올수록 좋음 + - 바람 5%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 시간·요일 15%: 요일별 점수: 금 100, 토 100, 그 외 60 - 점수 깎이는 조건: 없음 @@ -589,13 +627,13 @@ - 분류: 먹고 마시기 · 중요도 하 · 아이콘 `chestnut` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 - 시간대: 17~21시 - 요소별 규칙 (비중): - - 기온 55%: 추울수록 좋음 (18°=0점 → 0°=100점) + - 기온 60%: 추울수록 좋음 (18°=0점 → 0°=100점) - 비 25%: 비 안 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 바람 5%: 셀수록 좋음 (초속 8m=100점) - 습도 0%: 상관없음 (50점 고정) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 고정 100점 -- 점수 깎이는 조건: 없음 +- 점수 깎이는 조건: 체감 18° 이상이면 최대 20점 - 반영 못 하는 것: 군밤 노점이 있는지는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 아직 18° 넘어요. 군밤은 조금 더 추워지면! @@ -615,7 +653,7 @@ - 습도 5%: 30~60%가 좋음 (최적 35%) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 70 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점, 바람 12m/s 이상이면 0점, wind 특보가 있으면 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 12m/s 이상이면 0점, wind 특보가 있으면 - 반영 못 하는 것: 골프장 예약, 잔디 상태, 낙뢰는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 70% 넘거나 바람이 너무 세요. 오늘은 스크린으로! @@ -625,13 +663,13 @@ ### 집콕각 (`jipkok`) -- 설명: 오전 10시~오후 6시, 나가기 싫어 집에 있고 싶은 정도 +- 설명: 오전 9시~자정, 나가기 싫어 집에 있고 싶은 정도 - 분류: 집안일 · 중요도 하 · 아이콘 `jipkok` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 -- 시간대: 10~18시 +- 시간대: 9~24시 - 요소별 규칙 (비중): - - 기온 30%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 + - 기온 35%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 - 비 30%: 비 올수록 좋음 - - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 바람 5%: 셀수록 좋음 (초속 8m=100점) - 습도 5%: 높을수록 좋음 (40%=0점 → 90%=100점) - 미세먼지 20%: 초미세먼지 높을수록 좋음 (15㎍/㎥=0점 → 75㎍/㎥=100점) - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 @@ -655,7 +693,7 @@ - 습도 0%: 상관없음 (50점 고정) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점, 바람 10m/s 이상이면 0점, wind 특보가 있으면 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 10m/s 이상이면 0점, wind 특보가 있으면 - 반영 못 하는 것: 물때·수온·파도 높이는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비 70% 넘거나 바람이 거세요. 물가는 위험, 오늘은 쉬어요! @@ -676,7 +714,7 @@ - 미세먼지 15%: 초미세먼지 낮을수록 좋음 - 가시거리 15%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) - 시간·요일 10%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 -- 점수 깎이는 조건: 비 확률 70% 이상이면 최대 20점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 최대 20점 - 반영 못 하는 것: 길 막힘과 도로 공사는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 쏟아져요. 와이퍼만 바쁜 날, 드라이브는 다음에! @@ -696,7 +734,7 @@ - 습도 0%: 상관없음 (50점 고정) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 70 -- 점수 깎이는 조건: 비 확률 70% 이상이면 0점, 돌풍 13m/s 이상이면 0점, 바람 1m/s 미만이면 최대 30점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 돌풍 13m/s 이상이면 0점, 바람 1m/s 미만이면 최대 30점, 바람 8m/s 이상이면 최대 50점 - 반영 못 하는 것: 전깃줄·나무 없는 넓은 곳인지는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 비가 오거나 돌풍이 불어요. 연이 날아가 버려요! @@ -717,7 +755,7 @@ - 미세먼지 0%: 초미세먼지 낮을수록 좋음 - 햇빛 20%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 -- 점수 깎이는 조건: 비 확률 60% 이상이면 0점, 체감 20° 미만이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점, 체감 20° 미만이면 0점 - 반영 못 하는 것: 수온, 파도 높이, 계곡 물살은 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 체감 20° 아래거나 비 소식이 있어요. 물놀이는 여름에! @@ -737,7 +775,7 @@ - 습도 0%: 상관없음 (50점 고정) - 미세먼지 5%: 초미세먼지 낮을수록 좋음 - 시간·요일 10%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 50 -- 점수 깎이는 조건: 체감 18° 이상이면 0점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 체감 18° 이상이면 0점, 비 확률 70% 이상이면 최대 40점 - 반영 못 하는 것: 배추 작황과 값, 집집마다 김장 날짜는 반영하지 못해요 - 점수 구간별 설명 (상세 창에 나옴): - 0~29점: 아직 18° 넘어요. 지금 담그면 김치가 금방 쉬어요! @@ -745,3 +783,693 @@ - 60~79점: 김장할 만해요! 고무장갑 안에 면장갑 하나 더. - 80~100점: 0~10°에 비 없고 바람 잔잔, 김장 날 잡는 날 🥬 +### 꽃구경각 (`flower`) + +- 설명: 오전 10시~오후 5시, 꽃 보러 나들이 가기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `flower` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~17시 +- 요소별 규칙 (비중): + - 기온 20%: 체감 14~24°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 10m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 15%: 초미세먼지 낮을수록 좋음 + - 햇빛 20%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) + - 가시거리 5%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) + - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 +- 반영 못 하는 것: 꽃이 피었는지(개화 시기)는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 소식이 있어요. 꽃구경은 다음 맑은 날로! + - 30~59점: 쌀쌀하거나 공기가 탁해요. 잠깐 보고 오기 좋아요. + - 60~79점: 꽃 보러 나가기 괜찮은 날이에요. + - 80~100점: 햇살 좋고 바람 잔잔, 꽃길 걷기 딱 좋아요 🌸 + +### 이불빨래각 (`blanket`) + +- 설명: 이불처럼 두꺼운 빨래가 하루 만에 마르는 정도 +- 분류: 집안일 · 중요도 중 · 아이콘 `blanket` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~16시 +- 요소별 규칙 (비중): + - 기온 10%: 더울수록 좋음 (8°=0점 → 22°=100점) + - 비 30%: 비 안 올수록 좋음 + - 바람 15%: 적당한 바람(초속 2~5m)이 좋음 + - 습도 15%: 낮을수록 좋음 (90%=0점 → 40%=100점) + - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 햇빛 20%: 해 난 비율 90% 이상이면 만점, 30% 이하면 0점 (Open-Meteo) + - 시간·요일 0%: 고정 100점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 40% 이상이면 0점 +- 반영 못 하는 것: 베란다 방향·햇빛 드는 시간은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 소식이 있어요. 이불은 다음에! + - 30~59점: 두꺼운 건 덜 마를 수 있어요. 얇은 이불만! + - 60~79점: 이불 널기 괜찮은 날이에요. 오후에 한 번 뒤집어요. + - 80~100점: 햇볕 쨍쨍에 바람 솔솔, 이불 빨래하는 날 ☀️ + +### 빙수각 (`bingsu`) + +- 설명: 오후 1~6시, 시원한 빙수가 당기는 정도 +- 분류: 먹고 마시기 · 중요도 하 · 아이콘 `bingsu` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 13~18시 +- 요소별 규칙 (비중): + - 기온 70%: 더울수록 좋음 (22°=0점 → 33°=100점) + - 비 10%: 비 안 올수록 좋음 + - 바람 5%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 10%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 재미로 보는 지수예요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 아직 선선해요. 빙수는 더운 날에! + - 30~59점: 시원한 게 살짝 당기는 정도예요. + - 60~79점: 오후가 덥네요. 빙수 한 그릇 생각나요! + - 80~100점: 푹푹 찌는 오후, 팥빙수 확정 🍧 + +### 실내건조각 (`indoordry`) + +- 설명: 밖에 못 너는 날, 집 안에서 빨래 말리기 좋은 정도 +- 분류: 집안일 · 중요도 하 · 아이콘 `indoordry` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~21시 +- 요소별 규칙 (비중): + - 기온 15%: 더울수록 좋음 (15°=0점 → 28°=100점) + - 비 60%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 20%: 낮을수록 좋음 (90%=0점 → 40%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 비 확률 40% 미만이면 최대 20점 +- 반영 못 하는 것: 집 안 습도·환기·제습기 여부는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 밖에 널어도 되는 날이에요. 빨래각을 봐요! + - 30~59점: 눅눅해서 실내에서도 잘 안 말라요. 선풍기를 같이 틀어요. + - 60~79점: 비 와도 실내에선 그럭저럭 말라요. + - 80~100점: 비는 오지만 덜 습해서, 실내 건조로 충분해요 👕 + +### 한강밤바람각 (`riverwind`) + +- 설명: 저녁 7~11시, 강가에서 밤바람 쐬기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `riverwind` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 19~23시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 20~28°가 좋음 + - 비 30%: 비 안 올수록 좋음 + - 바람 20%: 적당한 바람(초속 2~5m)이 좋음 + - 습도 10%: 40~75%가 좋음 (최적 55%) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 +- 반영 못 하는 것: 강가 모기·혼잡도는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 소식이 있어요. 오늘 밤은 집에서! + - 30~59점: 바람이 없거나 너무 눅눅해요. 잠깐만 나가요. + - 60~79점: 밤바람 쐬러 나가기 괜찮아요. + - 80~100점: 선선한 바람 솔솔, 강가 돗자리 각 🌙 + +### 단풍각 (`foliage`) + +- 설명: 오전 9시~오후 4시, 단풍 구경 가기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `maple` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~16시 +- 요소별 규칙 (비중): + - 기온 15%: 체감 10~22°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 햇빛 20%: 해 난 비율 80% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) + - 가시거리 15%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) + - 시간·요일 5%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 +- 반영 못 하는 것: 단풍이 얼마나 물들었는지는 반영하지 못해요. 계절 소식의 단풍 시기를 같이 봐요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 소식이 있어요. 단풍은 다음 맑은 날로! + - 30~59점: 하늘이 흐리거나 뿌예서 색이 덜 살아요. + - 60~79점: 단풍 보러 가기 괜찮은 날이에요. + - 80~100점: 하늘 맑고 멀리까지 잘 보여요, 단풍 나들이 각 🍁 + +### 억새각 (`silvergrass`) + +- 설명: 해 지기 전후, 억새밭 걷기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 하 · 아이콘 `sheaf` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 일몰 앞뒤 2시간 +- 요소별 규칙 (비중): + - 기온 10%: 체감 10~24°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 15%: 적당한 바람(초속 2~5m)이 좋음 + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 가시거리 10%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) + - 시간·요일 30%: 그날 노을 점수를 그대로 씀 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점 +- 반영 못 하는 것: 억새밭 위치·개화 정도는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 소식이 있어요. 억새는 다음에! + - 30~59점: 노을이 약하거나 하늘이 흐려요. 낮에 잠깐 보고 와요. + - 60~79점: 해 질 무렵 억새 보러 가기 괜찮아요. + - 80~100점: 바람에 일렁이는 억새에 노을까지, 사진 각 🌾 + +### 군고구마각 (`sweetpotato`) + +- 설명: 오후 4~9시, 따끈한 군고구마가 당기는 정도 +- 분류: 먹고 마시기 · 중요도 하 · 아이콘 `sweet_potato` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 16~21시 +- 요소별 규칙 (비중): + - 기온 65%: 추울수록 좋음 (18°=0점 → 2°=100점) + - 비 20%: 비 안 올수록 좋음 + - 바람 5%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 재미로 보는 지수예요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 아직 포근해요. 군고구마는 더 추워지면! + - 30~59점: 저녁이 선선해졌어요. 군고구마가 슬슬 생각나요. + - 60~79점: 쌀쌀한 저녁, 군고구마 한 봉지 어때요? + - 80~100점: 찬 바람 부는 저녁, 호호 불어 먹는 군고구마 🍠 + +### 해돋이각 (`sunrise`) + +- 설명: 해 뜰 무렵, 해돋이 보러 가기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `sunset` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 일몰 앞뒤 1시간 +- 요소별 규칙 (비중): + - 기온 10%: 더울수록 좋음 (-15°=0점 → 5°=100점) + - 비 20%: 비 안 올수록 좋음 + - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 가시거리 15%: 20km 이상이면 만점, 5km 이하면 0점 (Open-Meteo) + - 시간·요일 40%: 그날 일출 하늘 점수를 그대로 씀 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점 +- 반영 못 하는 것: 바다·산처럼 동쪽이 트인 곳인지는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비나 눈 소식이 있어요. 해돋이는 다음에! + - 30~59점: 구름이 많아 해가 가려질 수 있어요. + - 60~79점: 해돋이 보러 가기 괜찮아요. 따뜻하게 입어요. + - 80~100점: 하늘 맑고 멀리까지 보여요, 해돋이 각 🌅 + +### 눈사람각 (`snowman`) + +- 설명: 눈 온 날 낮, 눈사람 만들기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 하 · 아이콘 `snow` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~16시 +- 요소별 규칙 (비중): + - 기온 50%: 체감 -5~2°가 좋음 + - 비 10%: 비 올수록 좋음 + - 바람 20%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 10m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 20%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 60 +- 점수 깎이는 조건: 눈 소식이 없으면 0점, 체감 4° 이상이면 최대 30점, 체감 -10° 미만이면 최대 40점 +- 반영 못 하는 것: 쌓인 눈의 양은 반영하지 못해요. 눈 오는 시간만 봐요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 눈 소식이 없어요. 눈사람은 눈 오는 날에! + - 30~59점: 눈은 오지만 너무 춥거나 녹아서 잘 안 뭉쳐요. + - 60~79점: 눈사람 만들기 괜찮아요. 장갑 꼭 챙겨요. + - 80~100점: 포슬포슬 잘 뭉쳐지는 눈, 눈사람 각 ⛄ + +### 붕어빵각 (`bungeoppang`) + +- 설명: 오후 3~9시, 붕어빵이 당기는 정도 +- 분류: 먹고 마시기 · 중요도 하 · 아이콘 `bungeoppang` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 15~21시 +- 요소별 규칙 (비중): + - 기온 70%: 추울수록 좋음 (12°=0점 → -5°=100점) + - 비 15%: 비 안 올수록 좋음 + - 바람 5%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 붕어빵 노점이 있는지는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 아직 덜 추워요. 붕어빵은 더 추워지면! + - 30~59점: 쌀쌀해졌어요. 붕어빵 노점이 생각나요. + - 60~79점: 손이 시려요. 붕어빵 한 봉지 어때요? + - 80~100점: 꽁꽁 언 오후, 따끈한 붕어빵 확정 🐟 + +### 귤까먹기각 (`tangerine`) + +- 설명: 저녁 7시~자정, 이불 속에서 귤 까먹고 싶은 정도 +- 분류: 집안일 · 중요도 하 · 아이콘 `tangerine` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 19~24시 +- 요소별 규칙 (비중): + - 기온 75%: 추울수록 좋음 (12°=0점 → -5°=100점) + - 비 5%: 비 올수록 좋음 + - 바람 10%: 셀수록 좋음 (초속 8m=100점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 재미로 보는 지수예요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 밤이 포근해요. 산책이라도 나가 봐요! + - 30~59점: 살짝 쌀쌀한 밤, 귤 한두 개 생각나요. + - 60~79점: 추운 밤이에요. 이불 속 귤 까먹기 좋아요. + - 80~100점: 바람 쌩쌩 추운 밤, 귤 한 상자 각 🍊 + +### 우산각 (`umbrella`) + +- 설명: 오전 6시~자정, 밖에 나갈 때 우산을 챙겨야 하는 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `umbrella` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 6~24시 +- 요소별 규칙 (비중): + - 기온 0%: 체감 0~40°가 좋음 + - 비 90%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 10%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 소나기처럼 갑자기 오는 비는 놓칠 수 있어요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 하늘이 말짱해요. 우산은 두고 가도 돼요. + - 30~59점: 비 소식이 조금 있어요. 작은 우산 하나 챙기면 든든해요. + - 60~79점: 비가 와요. 우산 꼭 챙기세요. + - 80~100점: 비가 제법 쏟아져요. 큰 우산에 신발도 신경 써요. + +### 파전각 (`pajeon`) + +- 설명: 오전 9시~자정, 비 오는 날 파전이 당기는 정도 +- 분류: 먹고 마시기 · 중요도 하 · 아이콘 `pajeon` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~24시 +- 요소별 규칙 (비중): + - 기온 20%: 추울수록 좋음 (26°=0점 → 10°=100점) + - 비 70%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 10%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 실제 판매량으로 검증하기 전이에요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 맑은 날엔 파전보다 바깥 나들이! + - 30~59점: 꾸물꾸물한 하늘, 파전 생각이 슬슬 나요. + - 60~79점: 빗소리 들리면 파전 부칠 시간이에요. + - 80~100점: 지글지글 빗소리, 오늘은 무조건 파전! + +### 감성노래각 (`mood_song`) + +- 설명: 오전 9시~자정, 비 오는 날 감성 노래 듣기 좋은 정도 +- 분류: 집안일 · 중요도 하 · 아이콘 `rain` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~24시 +- 요소별 규칙 (비중): + - 기온 25%: 추울수록 좋음 (26°=0점 → 8°=100점) + - 비 60%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 15%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 음악 취향은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 쨍한 날엔 신나는 노래가 더 어울려요. + - 30~59점: 구름 낀 하늘, 잔잔한 노래 한 곡 어때요? + - 60~79점: 창밖에 빗소리, 플레이리스트 꺼낼 시간이에요. + - 80~100점: 빗소리에 옛날 노래까지, 감성 가득한 밤이에요. + +### 트로트각 (`trot`) + +- 설명: 오전 10시~오후 5시, 나들이 가며 트로트 크게 틀고 싶은 정도 +- 분류: 밖에서 놀기 · 중요도 하 · 아이콘 `trot` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~17시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 15~25°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 햇빛 15%: 해 난 비율 90% 이상이면 만점, 20% 이하면 0점 (Open-Meteo) + - 시간·요일 30%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 40 +- 점수 깎이는 조건: 비 소식이 있으면 최대 20점 +- 반영 못 하는 것: 노래 취향은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 오늘은 조용히 집에서 쉬어요. + - 30~59점: 날은 그럭저럭, 흥얼흥얼 한 곡만. + - 60~79점: 볕 좋은 날, 꺾기 한 소절 나와요. + - 80~100점: 관광버스 부르는 날씨, 트로트 메들리 시작! + +### 싱잉인더레인각 (`singing_rain`) + +- 설명: 오전 6시~자정, 비 오는 날 우산 쓰고 노래하며 걷기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 하 · 아이콘 `singing_rain` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 6~24시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 15~25°가 좋음 + - 비 50%: 비 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 10m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 빗길 미끄러움은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비가 없어요. 노래는 다음 비 오는 날에! + - 30~59점: 빗방울은 조금, 콧노래 정도만. + - 60~79점: 우산 들고 첨벙첨벙 걷기 좋은 비예요. + - 80~100점: 포근한 빗속, 우산 돌리며 노래하고 싶은 날! + +### 우산분실각 (`umbrella_lost`) + +- 설명: 오전 9시~밤 10시, 비가 그쳐서 우산을 두고 오기 쉬운 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `umbrella` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 9~11시 / 11~13시 / 13~15시 / 15~17시 / 17~19시 / 19~22시 +- 요소별 규칙 (비중): + - 기온 0%: 체감 0~40°가 좋음 + - 비 80%: 비 안 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 20%: 고정 100점 +- 점수 깎이는 조건: 앞서 내린 비가 없으면 0점, 비 소식이 있으면 0점 +- 반영 못 하는 것: 비가 언제 그칠지는 예보만큼만 맞아요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 우산 두고 올 일 없는 날이에요. + - 30~59점: 비가 오락가락해요. 우산 손에 꼭 쥐어요. + - 60~79점: 비가 그쳤어요. 카페·버스에 우산 두고 오기 딱 좋아요. + - 80~100점: 비 끝, 하늘 맑음! 일어날 때 우산부터 챙겨요 ☂️ + +### 교통체증각 (`traffic`) + +- 설명: 출퇴근길 비·눈·추위로 차가 막히는 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `drive` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 7~10시 / 17~20시 +- 요소별 규칙 (비중): + - 기온 10%: 추울수록 좋음 (10°=0점 → -5°=100점) + - 비 70%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 20%: 요일별 점수: 월 100, 화 100, 수 100, 목 100, 금 100, 토 40, 일 40, 공휴일 30 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 사고·공사·행사로 막히는 건 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 길이 수월해요. 평소처럼 나가요. + - 30~59점: 조금 더뎌 수 있어요. 10분 일찍! + - 60~79점: 빗길에 차가 막혀요. 대중교통이 나아요. + - 80~100점: 출퇴근길 주차장 예상! 30분 일찍 나서요 🚗 + +### 한강각 (`hangang`) + +- 설명: 오후 2시~밤 10시, 강가에 돗자리 펴고 놀기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 상 · 아이콘 `hangang` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 14~22시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 15~25°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 5%: 30~65%가 좋음 (최적 45%) + - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 시간·요일 15%: 요일별 점수: 토 100, 일 100, 공휴일 100, 금 90, 그 외 60 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 12m/s 이상이면 0점 +- 반영 못 하는 것: 근처에 강이 없어도 나와요. 자리 경쟁은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 오거나 바람이 거세요. 한강은 다음에! + - 30~59점: 춥거나 더워서 오래 앉아 있긴 힘들어요. 잠깐 걷기만! + - 60~79점: 돗자리 펴기 괜찮은 날이에요. 겉옷 하나 챙겨요. + - 80~100점: 바람 살랑, 햇볕 따뜻. 돗자리 들고 한강 가요 🧺 + +### 놀이공원각 (`themepark`) + +- 설명: 오전 10시~저녁 8시, 놀이공원에서 놀기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `themepark` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~20시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 15~25°가 좋음 + - 비 35%: 비 안 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 5m까지 괜찮음, 14m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 5%: 초미세먼지 낮을수록 좋음 + - 시간·요일 15%: 요일별 점수: 토 80, 일 80, 공휴일 80, 그 외 100 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점, 바람 14m/s 이상이면 0점, 체감 33° 이상이면 최대 30점 +- 반영 못 하는 것: 근처에 놀이공원이 없어도 나와요. 붐비는 정도는 요일로만 짐작해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 오거나 바람이 세서 멈추는 기구가 많아요. + - 30~59점: 덥거나 추워서 줄 서기 힘들어요. 실내 놀거리 위주로! + - 60~79점: 놀러 가기 괜찮아요. 줄 설 때 쓸 모자나 겉옷 챙겨요. + - 80~100점: 맑고 선선해서 하루 종일 타기 좋은 날 🎡 + +### 데이트각 (`date`) + +- 설명: 오후 2시~밤 10시, 밖에서 걸으며 데이트하기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `date` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 14~22시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 15~25°가 좋음 + - 비 30%: 비 안 올수록 좋음 + - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 15%: 초미세먼지 낮을수록 좋음 + - 시간·요일 15%: 요일별 점수: 금 100, 토 100, 일 90, 공휴일 90, 그 외 70 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 가게 예약·붐비는 정도는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비가 와요. 오늘은 카페·전시·영화로 실내 데이트! + - 30~59점: 밖은 춥거나 더워요. 실내 데이트 코스가 나아요. + - 60~79점: 걷기 괜찮은 날이에요. 산책하고 카페 가요. + - 80~100점: 바람 좋고 하늘 맑아요. 밖에서 걷는 데이트 각 💕 + +### 곱슬머리각 (`frizz`) + +- 설명: 오전 8시~저녁 8시, 습기에 머리가 부풀기 쉬운 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `frizz` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 8~20시 +- 요소별 규칙 (비중): + - 기온 10%: 더울수록 좋음 (15°=0점 → 28°=100점) + - 비 25%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 60%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 실내 습도와 머릿결은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 공기가 보송해요. 고데기한 머리 하루 종일 가요. + - 30~59점: 조금 눅눅해요. 앞머리만 살짝 신경 써요. + - 60~79점: 습해서 머리가 부풀기 쉬워요. 픽서 챙겨요. + - 80~100점: 습기 가득, 고데기 해도 금방 풀려요. 묶는 게 답 💦 + +### 보일러각 (`boiler`) + +- 설명: 밤 9시~다음 날 아침 7시, 보일러를 켜야 하는 정도 +- 분류: 집안일 · 중요도 중 · 아이콘 `boiler` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 21~다음 날 7시 +- 요소별 규칙 (비중): + - 기온 70%: 추울수록 좋음 (20°=0점 → 3°=100점) + - 비 10%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 15%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 집 단열과 실내 온도는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 밤에도 따뜻해요. 보일러는 쉬어도 돼요. + - 30~59점: 밤에 살짝 서늘해요. 이불 하나 더면 충분해요. + - 60~79점: 밤에 쌀쌀해요. 잘 때 보일러 잠깐 돌려요. + - 80~100점: 밤새 추워요. 보일러 켜고 자요 🔥 + +### 선크림각 (`sunscreen`) + +- 설명: 오전 10시~오후 4시, 선크림을 꼭 발라야 하는 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `sunscreen` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~16시 +- 요소별 규칙 (비중): + - 기온 15%: 더울수록 좋음 (5°=0점 → 25°=100점) + - 비 0%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 자외선 80%: 자외선 7 이상이면 만점, 1 이하면 0점 (Open-Meteo) + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 그늘·실내에 있는 시간은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 해가 약해요. 선크림 안 발라도 괜찮아요. + - 30~59점: 햇볕이 조금 있어요. 오래 밖에 있으면 발라요. + - 60~79점: 흐려 보여도 햇볕이 세요. 선크림 발라요. + - 80~100점: 햇볕이 아주 세요. 선크림 꼭, 자주 덧발라요 ☀️ + +### 모기각 (`mosquito`) + +- 설명: 저녁 7시~자정, 모기가 많이 나오는 정도 +- 분류: 생활 고민 · 중요도 중 · 아이콘 `mosquito` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 19~24시 +- 요소별 규칙 (비중): + - 기온 50%: 더울수록 좋음 (16°=0점 → 27°=100점) + - 비 0%: 비 안 올수록 좋음 + - 바람 20%: 잔잔할수록 좋음 (초속 2m까지 괜찮음, 6m면 0점) + - 습도 25%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 물웅덩이·풀숲 같은 동네 환경은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 서늘하거나 바람이 불어 모기가 잠잠해요. + - 30~59점: 모기가 가끔 보여요. 방충망만 확인해요. + - 60~79점: 모기가 활발해요. 밖에 나갈 땐 기피제 뿌려요. + - 80~100점: 덥고 습하고 바람도 없어요. 기피제·모기향 필수 🦟 + +### 테니스각 (`tennis`) + +- 설명: 아침·저녁, 야외 코트에서 테니스 치기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `tennis` · 재미 각 아니오 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 7~11시 / 17~21시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 10~25°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 25%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 8m면 0점) + - 습도 5%: 30~65%가 좋음 (최적 45%) + - 미세먼지 10%: 초미세먼지 낮을수록 좋음 + - 시간·요일 5%: 고정 100점 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 60% 이상이면 0점, 바람 8m/s 이상이면 0점 +- 반영 못 하는 것: 앞서 내린 비로 젖은 코트는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 오거나 바람이 세요. 공이 제멋대로 날아가요. + - 30~59점: 덥거나 춥거나 바람이 있어요. 가볍게 랠리만! + - 60~79점: 치기 괜찮아요. 바람 방향만 신경 써요. + - 80~100점: 바람 잔잔, 공기 선선. 서브 잘 들어가는 날 🎾 + +### 효도각 (`hyodo`) + +- 설명: 오전 10시~오후 4시, 부모님 모시고 나들이하기 좋은 정도 +- 분류: 밖에서 놀기 · 중요도 중 · 아이콘 `hyodo` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~16시 +- 요소별 규칙 (비중): + - 기온 30%: 체감 16~24°가 좋음 + - 비 25%: 비 안 올수록 좋음 + - 바람 10%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 10m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 15%: 초미세먼지 낮을수록 좋음 + - 시간·요일 20%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 50 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 체감 30° 이상이면 0점, 체감 0° 미만이면 0점 +- 반영 못 하는 것: 계단·걷는 거리 같은 장소 사정은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 오거나 바람이 거세요. 오늘은 전화 한 통으로 효도! + - 30~59점: 어르신이 나가시기엔 춥거나 더워요. 실내 식당 나들이가 좋아요. + - 60~79점: 모시고 나가기 괜찮아요. 겉옷 하나 챙겨 드려요. + - 80~100점: 햇볕 따뜻하고 바람 순해요. 부모님 모시고 나들이 각 🌸 + +### 감사각 (`thanks`) + +- 설명: 저녁 6~10시, 날씨 핑계로 안부 문자 보내기 좋은 정도 +- 분류: 생활 고민 · 중요도 하 · 아이콘 `thanks` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 18~22시 +- 요소별 규칙 (비중): + - 기온 50%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 + - 비 30%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 20%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 어제보다 날씨가 얼마나 바뀌었는지는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 날씨가 무난해요. 안부는 평소처럼! + - 30~59점: 날씨 얘기로 말 걸기 괜찮은 날이에요. + - 60~79점: 춥거나 덥거나 비가 와요. "감기 조심해" 한마디 보내기 좋아요. + - 80~100점: 날씨가 거세요. 고마운 사람한테 안부 문자 보내기 딱 좋은 날 💌 + +### 선물각 (`gift`) + +- 설명: 오전 11시~저녁 7시, 꽃·선물 들고 찾아가기 좋은 정도 +- 분류: 생활 고민 · 중요도 하 · 아이콘 `gift` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 11~19시 +- 요소별 규칙 (비중): + - 기온 40%: 체감 12~22°가 좋음 + - 비 35%: 비 안 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 4m까지 괜찮음, 12m면 0점) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 10%: 요일별 점수: 토 100, 일 100, 공휴일 100, 그 외 70 +- 점수 깎이는 조건: 비 소식이 있으면 0점, 비 확률 70% 이상이면 0점 +- 반영 못 하는 것: 선물 종류와 이동 거리는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비가 와요. 선물은 택배나 모바일로 보내요. + - 30~59점: 덥거나 추워요. 꽃·케이크는 오래 들고 다니지 마요. + - 60~79점: 선물 들고 가기 괜찮아요. + - 80~100점: 선선하고 맑아요. 꽃 한 다발 들고 걷기 좋은 날 💐 + +### 파티각 (`party`) + +- 설명: 저녁 6시~자정, 집에 모여 홈파티하기 좋은 정도 +- 분류: 집안일 · 중요도 하 · 아이콘 `party` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 18~24시 +- 요소별 규칙 (비중): + - 기온 25%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 + - 비 25%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 50%: 요일별 점수: 금 100, 토 100, 공휴일 90, 일 60, 그 외 30 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 모일 사람과 집 사정은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 평일인데 밖도 좋아요. 파티보다 산책! + - 30~59점: 파티는 주말에 몰아서 해요. + - 60~79점: 친구들 불러 집에서 한잔하기 괜찮아요. + - 80~100점: 금요일 밤, 밖은 궂어요. 집으로 다 모여 홈파티 각 🎉 + +### 게임각 (`game`) + +- 설명: 밤 8시~다음 날 새벽 2시, 집에서 게임하기 좋은 정도 +- 분류: 집안일 · 중요도 하 · 아이콘 `game` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 20~다음 날 2시 +- 요소별 규칙 (비중): + - 기온 30%: 체감이 15~24°에서 멀수록(덥거나 추울수록) 좋음 + - 비 40%: 비 올수록 좋음 + - 바람 0%: 상관없음 (50점 고정) + - 습도 0%: 상관없음 (50점 고정) + - 미세먼지 15%: 초미세먼지 높을수록 좋음 (15㎍/㎥=0점 → 75㎍/㎥=100점) + - 시간·요일 15%: 요일별 점수: 금 100, 토 100, 공휴일 100, 그 외 70 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 다음 날 일정은 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 밖이 너무 좋아요. 게임은 내일 해도 돼요. + - 30~59점: 한두 판만 하고 자요. + - 60~79점: 밖에 나가기 애매해요. 게임 한 판 각. + - 80~100점: 비 오고 밖은 별로예요. 오늘 밤은 패드 잡는 날 🎮 + +### 셀카각 (`selfie`) + +- 설명: 오전 10시~오후 5시, 자연광에 셀카 찍기 좋은 정도 +- 분류: 생활 고민 · 중요도 하 · 아이콘 `selfie` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 10~17시 +- 요소별 규칙 (비중): + - 기온 0%: 체감 0~40°가 좋음 + - 비 20%: 비 안 올수록 좋음 + - 바람 15%: 잔잔할수록 좋음 (초속 3m까지 괜찮음, 10m면 0점) + - 습도 30%: 낮을수록 좋음 (90%=0점 → 40%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 햇빛 25%: 해 난 비율 70% 이상이면 만점, 10% 이하면 0점 (Open-Meteo) + - 시간·요일 10%: 고정 100점 +- 점수 깎이는 조건: 비 소식이 있으면 0점 +- 반영 못 하는 것: 실내 조명과 장소는 반영하지 못해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 비 오거나 바람에 머리가 날려요. 실내 조명 셀카로! + - 30~59점: 습해서 머리가 금방 부풀어요. 사진은 일찍 찍어요. + - 60~79점: 햇빛이 괜찮아요. 창가에서 찍어 봐요. + - 80~100점: 햇빛 좋고 공기 보송, 머리도 얌전해요. 셀카 각 📸 + +### 센치각 (`sentimental`) + +- 설명: 저녁 6~11시, 괜히 센치해지는 정도 +- 분류: 생활 고민 · 중요도 하 · 아이콘 `sentimental` · 재미 각 예 · 계절 핵심 아니오 · 계산 근거 화면 있음 +- 시간대: 18~23시 +- 요소별 규칙 (비중): + - 기온 35%: 체감 8~18°가 좋음 + - 비 30%: 비 올수록 좋음 + - 바람 10%: 적당한 바람(초속 2~5m)이 좋음 + - 습도 10%: 높을수록 좋음 (40%=0점 → 90%=100점) + - 미세먼지 0%: 초미세먼지 낮을수록 좋음 + - 시간·요일 15%: 고정 100점 +- 점수 깎이는 조건: 없음 +- 반영 못 하는 것: 흐린 정도는 비 확률로만 짐작해요 +- 점수 구간별 설명 (상세 창에 나옴): + - 0~29점: 덥고 쨍해요. 감성보다 시원한 게 필요해요. + - 30~59점: 그냥 평범한 저녁이에요. + - 60~79점: 선선한 저녁이에요. 좋아하는 노래 틀고 걸어요. + - 80~100점: 쌀쌀한 바람에 하늘도 흐려요. 괜히 센치해지는 밤 🍂 + diff --git a/frontend/public/icons/boiler.png b/frontend/public/icons/boiler.png new file mode 100644 index 0000000..1a64093 Binary files /dev/null and b/frontend/public/icons/boiler.png differ diff --git a/frontend/public/icons/date.png b/frontend/public/icons/date.png new file mode 100644 index 0000000..1a64993 Binary files /dev/null and b/frontend/public/icons/date.png differ diff --git a/frontend/public/icons/frizz.png b/frontend/public/icons/frizz.png new file mode 100644 index 0000000..76f7221 Binary files /dev/null and b/frontend/public/icons/frizz.png differ diff --git a/frontend/public/icons/game.png b/frontend/public/icons/game.png new file mode 100644 index 0000000..fba3ef5 Binary files /dev/null and b/frontend/public/icons/game.png differ diff --git a/frontend/public/icons/gift.png b/frontend/public/icons/gift.png new file mode 100644 index 0000000..71519d8 Binary files /dev/null and b/frontend/public/icons/gift.png differ diff --git a/frontend/public/icons/hangang.png b/frontend/public/icons/hangang.png new file mode 100644 index 0000000..a42777e Binary files /dev/null and b/frontend/public/icons/hangang.png differ diff --git a/frontend/public/icons/hyodo.png b/frontend/public/icons/hyodo.png new file mode 100644 index 0000000..aa1ea39 Binary files /dev/null and b/frontend/public/icons/hyodo.png differ diff --git a/frontend/public/icons/mosquito.png b/frontend/public/icons/mosquito.png new file mode 100644 index 0000000..bc87284 Binary files /dev/null and b/frontend/public/icons/mosquito.png differ diff --git a/frontend/public/icons/party.png b/frontend/public/icons/party.png new file mode 100644 index 0000000..a39aca8 Binary files /dev/null and b/frontend/public/icons/party.png differ diff --git a/frontend/public/icons/selfie.png b/frontend/public/icons/selfie.png new file mode 100644 index 0000000..9a144b3 Binary files /dev/null and b/frontend/public/icons/selfie.png differ diff --git a/frontend/public/icons/sentimental.png b/frontend/public/icons/sentimental.png new file mode 100644 index 0000000..e5a4014 Binary files /dev/null and b/frontend/public/icons/sentimental.png differ diff --git a/frontend/public/icons/sunscreen.png b/frontend/public/icons/sunscreen.png new file mode 100644 index 0000000..6e42c80 Binary files /dev/null and b/frontend/public/icons/sunscreen.png differ diff --git a/frontend/public/icons/tennis.png b/frontend/public/icons/tennis.png new file mode 100644 index 0000000..5211971 Binary files /dev/null and b/frontend/public/icons/tennis.png differ diff --git a/frontend/public/icons/thanks.png b/frontend/public/icons/thanks.png new file mode 100644 index 0000000..21e46d0 Binary files /dev/null and b/frontend/public/icons/thanks.png differ diff --git a/frontend/public/icons/themepark.png b/frontend/public/icons/themepark.png new file mode 100644 index 0000000..3025ce9 Binary files /dev/null and b/frontend/public/icons/themepark.png differ diff --git a/frontend/public/post-bg/bike-a.webp b/frontend/public/post-bg/bike-a.webp new file mode 100644 index 0000000..ea729dc Binary files /dev/null and b/frontend/public/post-bg/bike-a.webp differ diff --git a/frontend/public/post-bg/bike-b.webp b/frontend/public/post-bg/bike-b.webp new file mode 100644 index 0000000..265ecee Binary files /dev/null and b/frontend/public/post-bg/bike-b.webp differ diff --git a/frontend/public/post-bg/bike-c.webp b/frontend/public/post-bg/bike-c.webp new file mode 100644 index 0000000..bc6e0e7 Binary files /dev/null and b/frontend/public/post-bg/bike-c.webp differ diff --git a/frontend/public/post-bg/bike-d.webp b/frontend/public/post-bg/bike-d.webp new file mode 100644 index 0000000..286ffb1 Binary files /dev/null and b/frontend/public/post-bg/bike-d.webp differ diff --git a/frontend/public/post-bg/camping.webp b/frontend/public/post-bg/camping.webp new file mode 100644 index 0000000..04ca385 Binary files /dev/null and b/frontend/public/post-bg/camping.webp differ diff --git a/frontend/public/post-bg/event-a.webp b/frontend/public/post-bg/event-a.webp new file mode 100644 index 0000000..72b76b8 Binary files /dev/null and b/frontend/public/post-bg/event-a.webp differ diff --git a/frontend/public/post-bg/event-b.webp b/frontend/public/post-bg/event-b.webp new file mode 100644 index 0000000..19d9a92 Binary files /dev/null and b/frontend/public/post-bg/event-b.webp differ diff --git a/frontend/public/post-bg/event-c.webp b/frontend/public/post-bg/event-c.webp new file mode 100644 index 0000000..f27491d Binary files /dev/null and b/frontend/public/post-bg/event-c.webp differ diff --git a/frontend/public/post-bg/event-d.webp b/frontend/public/post-bg/event-d.webp new file mode 100644 index 0000000..061a8a7 Binary files /dev/null and b/frontend/public/post-bg/event-d.webp differ diff --git a/frontend/public/post-bg/hangang.webp b/frontend/public/post-bg/hangang.webp new file mode 100644 index 0000000..620842d Binary files /dev/null and b/frontend/public/post-bg/hangang.webp differ diff --git a/frontend/public/post-bg/hiking.webp b/frontend/public/post-bg/hiking.webp new file mode 100644 index 0000000..c4a15ba Binary files /dev/null and b/frontend/public/post-bg/hiking.webp differ diff --git a/frontend/public/post-bg/picnic.webp b/frontend/public/post-bg/picnic.webp new file mode 100644 index 0000000..5b2ac38 Binary files /dev/null and b/frontend/public/post-bg/picnic.webp differ diff --git a/frontend/public/post-bg/stars.webp b/frontend/public/post-bg/stars.webp new file mode 100644 index 0000000..121dd85 Binary files /dev/null and b/frontend/public/post-bg/stars.webp differ diff --git a/frontend/public/post-bg/walk.webp b/frontend/public/post-bg/walk.webp new file mode 100644 index 0000000..ea91e30 Binary files /dev/null and b/frontend/public/post-bg/walk.webp differ diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3bd3bdd..88502e3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -3,7 +3,6 @@ import { BLayout } from './b/BLayout' import { GakPage } from './b/GakPage' import { SeasonPage } from './b/SeasonPage' import { SkyPage } from './b/SkyPage' -import { TalkPage } from './b/talk' import { TodayPage } from './b/TodayPage' import { WeekPage } from './b/WeekPage' @@ -18,7 +17,6 @@ export default function App() { } /> } /> } /> - } /> } /> diff --git a/frontend/src/api/client/@tanstack/react-query.gen.ts b/frontend/src/api/client/@tanstack/react-query.gen.ts index 91a5f5d..f46d6c0 100644 --- a/frontend/src/api/client/@tanstack/react-query.gen.ts +++ b/frontend/src/api/client/@tanstack/react-query.gen.ts @@ -3,8 +3,8 @@ import { type DefaultError, type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query'; import { client } from '../client.gen'; -import { addComment, addMyGak, addTalk, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe } from '../sdk.gen'; -import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, RefreshData, RefreshError, RefreshResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, SignupData, SignupError, SignupResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse } from '../types.gen'; +import { addComment, addMyGak, addTalk, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from '../sdk.gen'; +import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, RefreshData, RefreshError, RefreshResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse } from '../types.gen'; export type QueryKey = [ Pick & { @@ -466,7 +466,7 @@ export const unlikePostMutation = (options?: Partial>): }; /** - * 좋아요 + * 좋아요 (로그인 없으면 IP 당 한 번) */ export const likePostMutation = (options?: Partial>): UseMutationOptions> => { const mutationOptions: UseMutationOptions> = { @@ -693,7 +693,7 @@ export const unlikeCommentMutation = (options?: Partial>): UseMutationOptions> => { const mutationOptions: UseMutationOptions> = { @@ -712,7 +712,7 @@ export const likeCommentMutation = (options?: Partial>) export const listMyGakQueryKey = (options?: Options) => createQueryKey('listMyGak', options); /** - * 내 각과 섞을 수 있는 공식 각 (로그인 없이도 섞을 수 있는 목록은 보임) + * 내 각 목록 (로그인하지 않았으면 빈 목록) */ export const listMyGakOptions = (options?: Options) => queryOptions>({ queryFn: async ({ queryKey, signal }) => { @@ -728,7 +728,7 @@ export const listMyGakOptions = (options?: Options) => queryOptio }); /** - * 공식 각 두 개를 섞어 내 각 만들기 (같은 조합이면 있는 것을 돌려줌) + * 이름과 날씨 조건으로 내 각 만들기 */ export const addMyGakMutation = (options?: Partial>): UseMutationOptions> => { const mutationOptions: UseMutationOptions> = { @@ -744,6 +744,23 @@ export const addMyGakMutation = (options?: Partial>): UseM return mutationOptions; }; +/** + * 조건들의 그 동네 오늘 점수 (로그인 없이, 받은 링크의 각도) + */ +export const scoreMyGakMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await scoreMyGak({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; + /** * 내 각 지우기 */ @@ -826,6 +843,41 @@ export const addTalkMutation = (options?: Partial>): UseMut return mutationOptions; }; +/** + * 글에 붙일 사진 올리기 (10MB까지, 위치 정보를 지우고 1080px로 줄여 저장) + */ +export const uploadTalkImageMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await uploadTalkImage({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; +}; + +export const getTalkImageQueryKey = (options: Options) => createQueryKey('getTalkImage', options); + +/** + * 올린 사진 + */ +export const getTalkImageOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getTalkImage({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getTalkImageQueryKey(options) +}); + /** * 내 이야기 지우기 */ @@ -861,7 +913,7 @@ export const unlikeTalkMutation = (options?: Partial>): }; /** - * 이야기 좋아요 + * 이야기 좋아요 (로그인 없으면 IP 당 한 번) */ export const likeTalkMutation = (options?: Partial>): UseMutationOptions> => { const mutationOptions: UseMutationOptions> = { diff --git a/frontend/src/api/client/client.gen.ts b/frontend/src/api/client/client.gen.ts index ae3d1b8..da6ade3 100644 --- a/frontend/src/api/client/client.gen.ts +++ b/frontend/src/api/client/client.gen.ts @@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen'; */ export type CreateClientConfig = (override?: Config) => Config & T>; -export const client: Client = createClient(createConfig({ baseUrl: 'http://localhost:9810', throwOnError: true })); +export const client: Client = createClient(createConfig({ baseUrl: 'http://localhost:9811', throwOnError: true })); diff --git a/frontend/src/api/client/index.ts b/frontend/src/api/client/index.ts index c2dabb0..f525aef 100644 --- a/frontend/src/api/client/index.ts +++ b/frontend/src/api/client/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { addComment, addMyGak, addTalk, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe } from './sdk.gen'; -export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListMyGakData, type ListMyGakError, type ListMyGakErrors, type ListMyGakResponse, type ListMyGakResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type ListTalksData, type ListTalksError, type ListTalksErrors, type ListTalksResponse, type ListTalksResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type MyGakData, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReportTalkData, type ReportTalkError, type ReportTalkErrors, type ReportTalkResponse, type ReportTalkResponses, type ReqComment, type ReqLogin, type ReqMyGak, type ReqRefresh, type ReqSignup, type ReqTalk, type ReqTalkReport, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResMyGak, type ResMyGakList, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResTalk, type ResTalkLike, type ResTalkList, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TalkData, TalkReport, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnlikeTalkData, type UnlikeTalkError, type UnlikeTalkErrors, type UnlikeTalkResponse, type UnlikeTalkResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekGak, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen'; +export { addComment, addMyGak, addTalk, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from './sdk.gen'; +export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type ClientOptions, type CommentData, type CommuteData, Confidence, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HourCell, type HoursSlide, type HttpValidationError, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListMyGakData, type ListMyGakError, type ListMyGakErrors, type ListMyGakResponse, type ListMyGakResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type ListTalksData, type ListTalksError, type ListTalksErrors, type ListTalksResponse, type ListTalksResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, type MeData, type MeError, type MeErrors, type MeResponse, type MeResponses, type MyGakData, type MyGakRule, type MyGakScore, type NearestRegionData, type NearestRegionError, type NearestRegionErrors, type NearestRegionResponse, type NearestRegionResponses, type PlaceData, type PlanSlide, type PlanSpot, type PlanStep, type PostData, PostType, type Rain2h, type RainHourData, RainType, type RankData, type RefreshData, type RefreshError, type RefreshErrors, type RefreshResponse, type RefreshResponses, type RegionData, type ReportTalkData, type ReportTalkError, type ReportTalkErrors, type ReportTalkResponse, type ReportTalkResponses, type ReqComment, type ReqLogin, type ReqMyGak, type ReqMyGakScore, type ReqRefresh, type ReqSignup, type ReqTalk, type ReqTalkReport, type ReqUpdateMe, type ResArticle, type ResArticleList, type ResAuth, type ResComment, type ResCommentLike, type ResCommentList, type ResEventList, type ResFeed, type ResHealth, type ResIndexDetail, type ResIndexList, type ResLogout, type ResMe, type ResMyGak, type ResMyGakList, type ResMyGakScore, type ResPlaceList, type ResPost, type ResPostLike, type ResPostSave, type ResRegion, type ResRegionList, type ResSavedList, type ResSeasonWeek, type ResSky, type ResSkyRanking, type ResTalk, type ResTalkImage, type ResTalkLike, type ResTalkList, type ResWatchSummary, type ResWeatherNow, type ResWeatherToday, type ResWebPacketProtocol, type ResWeek, type ResWeekRanking, type Row, type RowsSlide, type SavedPost, type SavePostData, type SavePostError, type SavePostErrors, type SavePostResponse, type SavePostResponses, type ScoreBand, type ScoreMyGakData, type ScoreMyGakError, type ScoreMyGakErrors, type ScoreMyGakResponse, type ScoreMyGakResponses, type SignupData, type SignupError, type SignupErrors, type SignupResponse, type SignupResponses, Sky, SkyGrade, type SkyPlanData, type SkyScoreData, SkySituation, SkyType, type SlotPoint, SlotTone, type SpotData, type SunsetSlide, type TalkData, TalkReport, type TermData, type Tomorrow, type TopIndex, type TrendPoint, type UnlikeCommentData, type UnlikeCommentError, type UnlikeCommentErrors, type UnlikeCommentResponse, type UnlikeCommentResponses, type UnlikePostData, type UnlikePostError, type UnlikePostErrors, type UnlikePostResponse, type UnlikePostResponses, type UnlikeTalkData, type UnlikeTalkError, type UnlikeTalkErrors, type UnlikeTalkResponse, type UnlikeTalkResponses, type UnsavePostData, type UnsavePostError, type UnsavePostErrors, type UnsavePostResponse, type UnsavePostResponses, type UpdateMeData, type UpdateMeError, type UpdateMeErrors, type UpdateMeResponse, type UpdateMeResponses, type UploadTalkImageData, type UploadTalkImageError, type UploadTalkImageErrors, type UploadTalkImageResponse, type UploadTalkImageResponses, type ValidationError, type WarningData, WarningLevel, WarningType, type WatchEvent, type WatchNow, type WatchSlot, type WatchSunset, type WatchTimeline, type WeatherSlot, type WeekDay, type WeekGak, type WeekRankDay, type WeekRankItem, type WeekSlide } from './types.gen'; diff --git a/frontend/src/api/client/sdk.gen.ts b/frontend/src/api/client/sdk.gen.ts index 2084bd6..f9e26f6 100644 --- a/frontend/src/api/client/sdk.gen.ts +++ b/frontend/src/api/client/sdk.gen.ts @@ -1,8 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client'; +import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client'; import { client } from './client.gen'; -import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, RefreshData, RefreshErrors, RefreshResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, SignupData, SignupErrors, SignupResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses } from './types.gen'; +import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, RefreshData, RefreshErrors, RefreshResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses, UploadTalkImageData, UploadTalkImageErrors, UploadTalkImageResponses } from './types.gen'; export type Options = Options2 & { /** @@ -167,7 +167,7 @@ export const updateMe = (options: Options(options: Options): RequestResult => (options.client ?? client).delete({ url: '/v1/reaction/post/{post_id}/like', ...options }); /** - * 좋아요 + * 좋아요 (로그인 없으면 IP 당 한 번) */ export const likePost = (options: Options): RequestResult => (options.client ?? client).post({ url: '/v1/reaction/post/{post_id}/like', ...options }); @@ -214,17 +214,17 @@ export const deleteComment = (options: Opti export const unlikeComment = (options: Options): RequestResult => (options.client ?? client).delete({ url: '/v1/reaction/comment/{comment_id}/like', ...options }); /** - * 댓글 좋아요 + * 댓글 좋아요 (로그인 없으면 IP 당 한 번) */ export const likeComment = (options: Options): RequestResult => (options.client ?? client).post({ url: '/v1/reaction/comment/{comment_id}/like', ...options }); /** - * 내 각과 섞을 수 있는 공식 각 (로그인 없이도 섞을 수 있는 목록은 보임) + * 내 각 목록 (로그인하지 않았으면 빈 목록) */ export const listMyGak = (options?: Options): RequestResult => (options?.client ?? client).get({ url: '/v1/my-gak', ...options }); /** - * 공식 각 두 개를 섞어 내 각 만들기 (같은 조합이면 있는 것을 돌려줌) + * 이름과 날씨 조건으로 내 각 만들기 */ export const addMyGak = (options: Options): RequestResult => (options.client ?? client).post({ url: '/v1/my-gak', @@ -235,6 +235,18 @@ export const addMyGak = (options: Options(options: Options): RequestResult => (options.client ?? client).post({ + url: '/v1/my-gak/score', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + /** * 내 각 지우기 */ @@ -257,6 +269,24 @@ export const addTalk = (options: Options(options: Options): RequestResult => (options.client ?? client).post({ + ...formDataBodySerializer, + url: '/v1/talk/image', + ...options, + headers: { + 'Content-Type': null, + ...options.headers + } +}); + +/** + * 올린 사진 + */ +export const getTalkImage = (options: Options): RequestResult => (options.client ?? client).get({ url: '/v1/talk/image/{name}', ...options }); + /** * 내 이야기 지우기 */ @@ -268,7 +298,7 @@ export const deleteTalk = (options: Options export const unlikeTalk = (options: Options): RequestResult => (options.client ?? client).delete({ url: '/v1/talk/{talk_id}/like', ...options }); /** - * 이야기 좋아요 + * 이야기 좋아요 (로그인 없으면 IP 당 한 번) */ export const likeTalk = (options: Options): RequestResult => (options.client ?? client).post({ url: '/v1/talk/{talk_id}/like', ...options }); diff --git a/frontend/src/api/client/types.gen.ts b/frontend/src/api/client/types.gen.ts index 610ac72..3d33e6f 100644 --- a/frontend/src/api/client/types.gen.ts +++ b/frontend/src/api/client/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: `${string}://${string}` | (string & {}); + baseUrl: 'http://localhost:9811' | (string & {}); }; /** @@ -238,6 +238,16 @@ export type BestTime = { end?: string | null; }; +/** + * Body_upload_talk_image_v1_talk_image_post + */ +export type BodyUploadTalkImageV1TalkImagePost = { + /** + * File + */ + file: Blob | File; +}; + /** * CommentData */ @@ -839,11 +849,90 @@ export type MyGakData = { */ my_gak_id: number; /** - * Index Ids - * - * 섞은 공식 각 두 개. 점수는 두 각의 오늘 점수 중 낮은 쪽 + * Name */ - index_ids: Array; + name: string; + rule: MyGakRule; +}; + +/** + * MyGakRule + */ +export type MyGakRule = { + /** + * Temp + * + * 체감온도 범위 [최저, 최고]° (-20~40) + */ + temp?: [ + number, + number + ] | null; + /** + * Rain + * + * dry: 비 안 와야 / wet: 비 와야 / 없으면 상관없음 + */ + rain?: 'dry' | 'wet' | null; + /** + * Wind Max + * + * 바람 상한 m/s + */ + wind_max?: number | null; + /** + * Air + * + * 미세먼지 허용 단계: good 좋음까지 / normal 보통까지 + */ + air?: 'good' | 'normal' | null; + /** + * Humidity + * + * 습도 범위 [최저, 최고]% + */ + humidity?: [ + number, + number + ] | null; + /** + * Slots + * + * 볼 시간대 + */ + slots?: Array<'morning' | 'day' | 'evening' | 'night'>; +}; + +/** + * MyGakScore + */ +export type MyGakScore = { + /** + * Score + * + * 지금 시간대 점수. 지금이 고른 시간대가 아니면 고른 시간대 중 가장 좋은 점수. 예보가 없으면 null + */ + score?: number | null; + /** + * Slot + * + * score 가 어느 시간대 점수인지 + */ + slot?: 'morning' | 'day' | 'evening' | 'night' | null; + /** + * Slots + * + * 고른 시간대별 점수 (아침·낮·저녁·밤 순) + */ + slots?: { + [key: string]: number; + }; + /** + * Reasons + * + * score 근거: 조건마다 그 시간대 실제 값 + */ + reasons?: Array; }; /** @@ -1240,14 +1329,26 @@ export type ReqLogin = { */ export type ReqMyGak = { /** - * Index Ids + * Name * - * 섞을 공식 각 두 개 + * 내 각 이름 (끝에 '각'이 없으면 붙인다) */ - index_ids: [ - number, - number - ]; + name: string; + rule: MyGakRule; +}; + +/** + * Req_MyGakScore + */ +export type ReqMyGakScore = { + /** + * Region Code + */ + region_code: string; + /** + * Rules + */ + rules: Array; }; /** @@ -1292,6 +1393,12 @@ export type ReqTalk = { * 공백을 줄인 뒤 100자까지 */ body: string; + /** + * Image + * + * 먼저 올린 사진 주소 (POST /v1/talk/image 결과) + */ + image?: string | null; }; /** @@ -1610,12 +1717,6 @@ export type ResMyGakList = { * Msg */ msg?: string | null; - /** - * Mixable - * - * 섞을 수 있는 공식 각 index_id - */ - mixable?: Array; /** * Items * @@ -1624,6 +1725,25 @@ export type ResMyGakList = { items?: Array; }; +/** + * Res_MyGakScore + */ +export type ResMyGakScore = { + result?: ErrorInfo; + /** + * Msg + */ + msg?: string | null; + /** + * Now Slot + */ + now_slot?: 'morning' | 'day' | 'evening' | 'night' | null; + /** + * Scores + */ + scores?: Array; +}; + /** * Res_PlaceList */ @@ -1861,6 +1981,23 @@ export type ResTalk = { talk?: TalkData | null; }; +/** + * Res_TalkImage + */ +export type ResTalkImage = { + result?: ErrorInfo; + /** + * Msg + */ + msg?: string | null; + /** + * Image + * + * 글에 붙일 사진 주소 + */ + image?: string | null; +}; + /** * Res_TalkLike */ @@ -2544,6 +2681,12 @@ export type TalkData = { * Body */ body: string; + /** + * Image + * + * 올린 사진 주소 + */ + image?: string | null; /** * Like Count */ @@ -4245,6 +4388,31 @@ export type AddMyGakResponses = { export type AddMyGakResponse = AddMyGakResponses[keyof AddMyGakResponses]; +export type ScoreMyGakData = { + body: ReqMyGakScore; + path?: never; + query?: never; + url: '/v1/my-gak/score'; +}; + +export type ScoreMyGakErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type ScoreMyGakError = ScoreMyGakErrors[keyof ScoreMyGakErrors]; + +export type ScoreMyGakResponses = { + /** + * Successful Response + */ + 200: ResMyGakScore; +}; + +export type ScoreMyGakResponse = ScoreMyGakResponses[keyof ScoreMyGakResponses]; + export type DeleteMyGakData = { body?: never; headers?: { @@ -4348,6 +4516,65 @@ export type AddTalkResponses = { export type AddTalkResponse = AddTalkResponses[keyof AddTalkResponses]; +export type UploadTalkImageData = { + body: BodyUploadTalkImageV1TalkImagePost; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path?: never; + query?: never; + url: '/v1/talk/image'; +}; + +export type UploadTalkImageErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type UploadTalkImageError = UploadTalkImageErrors[keyof UploadTalkImageErrors]; + +export type UploadTalkImageResponses = { + /** + * Successful Response + */ + 200: ResTalkImage; +}; + +export type UploadTalkImageResponse = UploadTalkImageResponses[keyof UploadTalkImageResponses]; + +export type GetTalkImageData = { + body?: never; + path: { + /** + * Name + */ + name: string; + }; + query?: never; + url: '/v1/talk/image/{name}'; +}; + +export type GetTalkImageErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type GetTalkImageError = GetTalkImageErrors[keyof GetTalkImageErrors]; + +export type GetTalkImageResponses = { + /** + * Successful Response + */ + 200: unknown; +}; + export type DeleteTalkData = { body?: never; headers?: { diff --git a/frontend/src/b/BLayout.tsx b/frontend/src/b/BLayout.tsx index ede013c..e06c15e 100644 --- a/frontend/src/b/BLayout.tsx +++ b/frontend/src/b/BLayout.tsx @@ -20,7 +20,6 @@ const TABS = [ { to: '/gak', key: 'gak', label: '각', title: '오늘의 각' }, // 메인인 오늘 탭을 가운데에 { to: '/', key: 'today', label: '오늘', title: null }, - { to: '/talk', key: 'talk', label: '이야기', title: '동네 이야기' }, { to: '/week', key: 'week', label: '주말·행사', title: '주말·행사' }, { to: '/season', key: 'season', label: '계절·상식', title: '계절·상식' }, ] as const diff --git a/frontend/src/b/Post.tsx b/frontend/src/b/Post.tsx index 06f77fc..a97de54 100644 --- a/frontend/src/b/Post.tsx +++ b/frontend/src/b/Post.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState, type CSSProperties, type MouseEvent, type ReactNode } from 'react' +import { useEffect, useRef, useState, type CSSProperties, type MouseEvent, type ReactNode, type RefObject } from 'react' import { createPortal } from 'react-dom' import { PostType, SlotTone, type GakSlide, type HoursSlide, type PlanSlide, type PostData, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen' import { cx } from '../lib/utils' @@ -7,7 +7,6 @@ import type { SlideBg } from './types' import { deg } from './weatherText' import { useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query' import { likePostMutation, unlikePostMutation } from '../api/client/@tanstack/react-query.gen' -import { useAuth } from './authContext' import { useSheet } from './sheetContext' import { CommentIcon, HeartIcon, SendIcon } from './svg' import { useCarousel } from './carousel' @@ -52,6 +51,22 @@ function slideBg(post: PostData, slide: Slide): SlideBg { const DARK = new Set(['dusk', 'night']) +// 그림 배경이 있는 각(code)과 장 수. 여러 장이면 글마다 돌려 쓴다 +const BG_IMAGES: Record = { bike: 4, picnic: 1, hiking: 1, camping: 1, stars: 1, walk: 1, hangang: 1 } +const EVENT_BG_N = 4 + +function bgImage(name: string, n: number, seed: number): CSSProperties { + const file = n > 1 ? `${name}-${'abcd'[seed % n]}` : name + return { backgroundImage: `url(/post-bg/${file}.webp)`, backgroundSize: 'cover', backgroundPosition: 'center' } +} + +/** 그림 배경: 각은 각마다, 사진 없는 행사는 행사용. 없으면 색 배경만 */ +function slideImage(post: PostData, slide: Slide): CSSProperties | undefined { + if (slide.kind === 'gak') return BG_IMAGES[slide.code] ? bgImage(slide.code, BG_IMAGES[slide.code], post.post_id) : undefined + if (post.post_type === PostType.EVENT && slide.kind === 'rows' && !slide.image) return bgImage('event', EVENT_BG_N, post.post_id) + return undefined +} + function Lines({ text }: { text: string }) { return text.split('\n').map((t, i) => ( @@ -79,7 +94,7 @@ function Pic({ name, className }: { name: string; className?: string }) { const slideBase = 'relative flex h-full w-full shrink-0 flex-col px-5 py-[22px]' -function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) { +function SlideView({ slide, bg, img }: { slide: Slide; bg: SlideBg; img?: CSSProperties }) { const { open } = useSheet() if (slide.kind === 'hours') { const temps = slide.hours.flatMap((h) => (h.temp_c == null ? [] : [h.temp_c])) @@ -114,7 +129,7 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) { } if (slide.kind === 'gak') return ( -
+
오늘의 각 · {slide.rank}위 {slide.line} @@ -223,7 +238,7 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
) return ( -
+
{slide.eyebrow} @@ -312,7 +327,6 @@ export function PostCardSkel() { function FullCard({ post }: PostProps) { const { open } = useSheet() - const { loggedIn } = useAuth() const liked = !!post.liked const likeCount = post.like_count const queryClient = useQueryClient() @@ -338,7 +352,6 @@ function FullCard({ post }: PostProps) { // 화면을 먼저 바꾸고, 실패하면 되돌린다 (서버는 실패도 200 + result.success=false 로 준다) const setLike = (on: boolean) => { - if (!loggedIn) return open({ type: 'login' }) if (on === liked || like.isPending || unlike.isPending) return if (on) setPop((p) => p + 1) setLikeFailed(0) @@ -363,7 +376,7 @@ function FullCard({ post }: PostProps) { if ((e.target as HTMLElement).closest('button')) return const now = Date.now() if (now - lastTap.current < 320) { - if (liked && loggedIn) setPop((p) => p + 1) + if (liked) setPop((p) => p + 1) else setLike(true) } lastTap.current = now @@ -401,7 +414,7 @@ function FullCard({ post }: PostProps) { >
{post.slides.map((s, i) => ( - + ))}
@@ -457,3 +470,43 @@ function FullCard({ post }: PostProps) { ) } + +type FrameProps = { title: string; account: string; avatar: string; caption?: ReactNode; more?: ReactNode; shot?: RefObject; children: ReactNode } + +/** 피드 글과 같은 틀(계정 줄·본문·보내기 줄)에 날씨·각 같은 화면 조각을 담는다. 보내기는 shot(공유용 틀)이 있으면 그것을, 없으면 본문을 이미지로 */ +export function PostFrame({ title, account, avatar, caption, more, shot, children }: FrameProps) { + const { open } = useSheet() + const bodyRef = useRef(null) + const share = () => { + const el = shot?.current ?? bodyRef.current + if (el) open({ type: 'share', share: { title, slides: [el] } }) + } + return ( +
+
+ + + + + + + 날씨각 + {account} + +
+
{children}
+
+ + {more && {more}} +
+ {caption && ( +

+ 날씨각 + {caption} +

+ )} +
+ ) +} diff --git a/frontend/src/b/Sheets.tsx b/frontend/src/b/Sheets.tsx index b208dec..edf2a15 100644 --- a/frontend/src/b/Sheets.tsx +++ b/frontend/src/b/Sheets.tsx @@ -26,7 +26,6 @@ import { cx } from '../lib/utils' import { useAuth } from './authContext' import { ago, ARTICLE_CAT, articleMeta, AVATAR_COLORS, cardBg, CHARACTERS, dateRange, loadOf, MOODS, shortDay } from './lib' import { MixSheet } from './myGak' -import { useMyGak } from './myGakState' import { ownPage, useRegion } from './regionContext' import { useSky } from './skyContext' import { SHARE_SIZES, shareImage, type ShareSize } from './storyImage' @@ -134,7 +133,7 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void {state.type === 'login' && open(then) : onClose} />} {state.type === 'me' && } {state.type === 'region' && } - {state.type === 'mix' && } + {state.type === 'mix' && }
)} {!state && } @@ -326,8 +325,6 @@ function Radar({ name, factors, size = 250 }: { name: string; factors: Factor[]; function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string) => void }) { const { region } = useRegion() - const { open } = useSheet() - const { mixable } = useMyGak() const q = useQuery(getIndexOptions({ path: { index_id: indexId }, query: { region: region.code } })) const d: ResIndexDetail | undefined = q.data const g = d?.index @@ -360,11 +357,6 @@ function GakSheet({ indexId, onTitle }: { indexId: number; onTitle: (t: string) {g.score}
{!g.active &&

지금 시간대엔 해당 없어요. 점수는 오늘 가장 좋은 시간대 기준이에요.

} - {mixable.has(g.index_id) && ( - - )} {now && (

{now.low}~{now.high}점 @@ -624,8 +616,6 @@ const EMOJIS = ['☀️', '🌂', '🍻', '🌇', '😍', '👍'] function CommentRow({ c, postId }: { c: CommentData; postId: number }) { const { region } = useRegion() - const { loggedIn } = useAuth() - const { open } = useSheet() const queryClient = useQueryClient() const [liked, setLiked] = useState(c.liked) const [count, setCount] = useState(c.like_count) @@ -636,7 +626,6 @@ function CommentRow({ c, postId }: { c: CommentData; postId: number }) { const [likeFailed, setLikeFailed] = useState(false) const toggle = () => { - if (!loggedIn) return open({ type: 'login' }) if (like.isPending || unlike.isPending) return const next = !liked setLikeFailed(false) diff --git a/frontend/src/b/TodayPage.tsx b/frontend/src/b/TodayPage.tsx index 07b2a0d..16c84be 100644 --- a/frontend/src/b/TodayPage.tsx +++ b/frontend/src/b/TodayPage.tsx @@ -1,16 +1,21 @@ -import { Fragment, useEffect, useState, type ReactNode } from 'react' +import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react' import { Link } from 'react-router' import { useQuery } from '@tanstack/react-query' import { getFeedOptions, getWeatherTodayOptions } from '../api/client/@tanstack/react-query.gen' -import { RainType, Sky, type BandArticle, type BandEvent, type Hero as HeroData, type ResWeatherToday, type TopIndex, type WeatherSlot } from '../api/client/types.gen' +import { RainType, Sky, type BandArticle, type BandEvent, type Hero as HeroData, type ResWeatherToday, type TalkData, type TopIndex, type WeatherSlot } from '../api/client/types.gen' import { cx } from '../lib/utils' import { cardBg, fall, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEKDAYS } from './lib' import { MyGakRow } from './myGak' -import { PostCard, PostCardSkel } from './Post' +import { fromShare } from './myGakState' +import { PostCard, PostCardSkel, PostFrame } from './Post' +import { FeedComposer, TalkCard } from './talk' +import { useFeedTalks } from './talkState' import { useRegion } from './regionContext' import { useSheet } from './sheetContext' import { useSky } from './skyContext' -import { Ic, Rail, Sec, Skel, SkelRail, StateBox, Thumb } from './ui' +import { GakShareCard, HeroShareCard, type HeroShare } from './shareCards' +import { SendIcon } from './svg' +import { Ic, Rail, Sec, Skel, StateBox, TAP44, Thumb } from './ui' import { deg, slotAt } from './weatherText' type Mode = 'now' | TimeKind @@ -103,6 +108,9 @@ const CLOUD_N: Record = { clear: 0, partly: 2, cloudy: 3, rain: function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) { const { open } = useSheet() + const { region } = useRegion() + const tplRef = useRef(null) + const share = () => tplRef.current && open({ type: 'share', share: { title: `${region.name} 오늘 날씨`, slides: [tplRef.current] } }) const { preview, setServerKind, setPreview } = useSky() const mode: Mode = preview ?? 'now' const clock = useNow() @@ -138,9 +146,26 @@ function Hero({ hero, today, ranked, feedLoad, todayLoad }: HeroProps) { const rain = weather === 'rain' || weather === 'sleet' const snow = weather === 'snow' || weather === 'sleet' + const shareData: HeroShare = { + kind, + sky: weather, + date: `${t.mo}월 ${t.d}일 ${WEEKDAYS[t.wd]}요일`, + place: region.name, + label: `${slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`, + score, + bubble, + summary: top1?.summary, + status: status.map((x) => ({ label: x.label, value: x.value, warn: x.tone === 'warn' })), + slots: KINDS.map((k) => { + const s = slotOf(k === nowKind ? 'now' : k) + return { label: k === nowKind ? '지금' : PREVIEW[k].label, icon: k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)], temp: s?.temp_c != null ? deg(s.temp_c) : '–', on: k === kind } + }), + } + // 시안 D4-2: 가운데 해(점수)와 하늘 날씨, 결론 두 줄, 상태 한 줄, 아래 하루 흐름 칸(누르면 그 시간대 하늘로) return (

+ )} -

- {t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일 -

+
+

+ {t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일 +

+ +
{CLOUDS.slice(0, CLOUD_N[weather]).map((c) => (