Initial commit: Phase 1 – Projektstruktur, DB-Schema, Core-API
- FastAPI-Backend mit vollständiger ABS v2.x API-Kompatibilität - SQLAlchemy-Models: User, Library, LibraryItem, BookFile, Chapter, Podcast, PodcastEpisode, MediaProgress, Bookmark, PlaybackSession - Auth: JWT-Login (/login, /logout, /api/authorize) - Library + Items Endpoints inkl. camelCase ABS-Response-Format - HLS-Streaming via FFmpeg (POST /api/items/:id/play, Session-Sync) - Me/Progress Endpoints + Lesezeichen - User-Management + Server-Settings (Admin) - Library-Scanner (MP3/WAV Discovery, Hintergrund-Task) - File Watcher (watchdog, 30s Debounce) - Matching-Skelett (MusicBrainz, OpenLibrary, Google Books – Phase 5) - Docker-Setup: backend (Python 3.12+FFmpeg), frontend (React/Vite), nginx Reverse-Proxy auf Port 3000 - setup.sh: Installiert Docker auf Debian/Ubuntu, richtet .env ein Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
72
backend/app/schemas/user.py
Normal file
72
backend/app/schemas/user.py
Normal file
@@ -0,0 +1,72 @@
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from pydantic.alias_generators import to_camel
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
|
||||
class ServerSettingsOut(BaseModel):
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
id: str = "server-settings"
|
||||
token_secret: str = ""
|
||||
items_per_page: int = 10
|
||||
metadata_provider: str = "google"
|
||||
store_covers_with_item: bool = False
|
||||
ratio_cover_book_name: bool = False
|
||||
cover_aspect_ratio: int = 1
|
||||
disable_opds: bool = False
|
||||
log_level: int = 2
|
||||
scanner_parse_same_author_name: bool = False
|
||||
auth_active_users: list = []
|
||||
auth_local_users: list = []
|
||||
|
||||
|
||||
class UserSettings(BaseModel):
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
muted_badge_notifications: bool = False
|
||||
show_remaining_time: bool = False
|
||||
display_remaining_time: bool = False
|
||||
library_filters: dict = {}
|
||||
playback_rate: float = 1.0
|
||||
bookmarks_list_collapsed: bool = False
|
||||
sleep_timer_duration: int = 900
|
||||
sleep_timer_podcast_chapters: bool = False
|
||||
language: str = "de"
|
||||
|
||||
|
||||
class UserOut(BaseModel):
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
id: str
|
||||
username: str
|
||||
email: str | None = None
|
||||
type: str = "user"
|
||||
is_active: bool = True
|
||||
is_locked: bool = False
|
||||
last_seen: datetime | None = None
|
||||
created_at: datetime
|
||||
token: str | None = None
|
||||
media_progress: list = []
|
||||
bookmarks: list = []
|
||||
is_admin: bool = False
|
||||
libraries_accessible: list[str] = []
|
||||
item_tags_accessible: list[str] = []
|
||||
permissions: dict = {}
|
||||
series_hide_from_continue_listening: list = []
|
||||
settings: UserSettings = UserSettings()
|
||||
|
||||
|
||||
class UserCreate(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
email: str | None = None
|
||||
is_admin: bool = False
|
||||
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
email: str | None = None
|
||||
password: str | None = None
|
||||
is_admin: bool | None = None
|
||||
is_active: bool | None = None
|
||||
settings: dict | None = None
|
||||
Reference in New Issue
Block a user