feat: initial MVP - FastAPI backend + Vue3 frontend + docker-compose
- backend: FastAPI + SQLAlchemy 2.0(async) + asyncpg + Alembic - 7 API routes: auth/me/articles/sources/bookmarks/subscriptions/admin - models: User/Source/Article/Bookmark/Subscription/ApiToken - services: RSS fetcher (feedparser) + Tencent TMT translator with quota + cache + local NLLB fallback - workers: APScheduler + asyncio pipeline (fetch -> dedupe -> insert -> translate) - seed scripts: create_user, seed_sources (5 RSS: Reuters/BBC/Al Jazeera/NHK/DW) - frontend: Vue 3 + Vite + Naive UI + Pinia + vue-router - pages: Login, Feed (24h), ArticleDetail, Sources, Bookmarks, AdminSources - deploy: docker-compose (postgres/redis/api/worker/frontend/caddy) - docs: README, DEPLOY, architecture, acceptance
This commit is contained in:
43
backend/app/schemas/misc.py
Normal file
43
backend/app/schemas/misc.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""Bookmark / Subscription schemas."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.models.subscription import SubscriptionMatch
|
||||
|
||||
|
||||
class BookmarkIn(BaseModel):
|
||||
article_id: int
|
||||
note: str | None = None
|
||||
|
||||
|
||||
class BookmarkOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
user_id: int
|
||||
article_id: int
|
||||
note: str | None = None
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class SubscriptionIn(BaseModel):
|
||||
keyword: str = Field(min_length=1, max_length=255)
|
||||
match_in: SubscriptionMatch = SubscriptionMatch.ANY
|
||||
channel: str = "telegram"
|
||||
target: str | None = None
|
||||
|
||||
|
||||
class SubscriptionOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
keyword: str
|
||||
match_in: SubscriptionMatch
|
||||
channel: str
|
||||
target: str | None = None
|
||||
enabled: bool
|
||||
last_hit_at: datetime | None = None
|
||||
created_at: datetime
|
||||
Reference in New Issue
Block a user