diff --git a/.claude/settings.local.json b/.claude/settings.local.json index d5b88f4..02fae74 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -5,7 +5,8 @@ "Skill(writing-plans)", "Skill(subagent-driven-development)", "Bash(git add *)", - "Bash(git commit *)" + "Bash(git commit *)", + "Bash(python -c \"from app.models import Joke, JokeType, JokeCrowd, AdminUser; print\\('All models imported successfully'\\)\")" ] } } diff --git a/api/app/__pycache__/__init__.cpython-311.pyc b/api/app/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e4ca7ab Binary files /dev/null and b/api/app/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/app/__pycache__/config.cpython-311.pyc b/api/app/__pycache__/config.cpython-311.pyc new file mode 100644 index 0000000..242851c Binary files /dev/null and b/api/app/__pycache__/config.cpython-311.pyc differ diff --git a/api/app/__pycache__/database.cpython-311.pyc b/api/app/__pycache__/database.cpython-311.pyc new file mode 100644 index 0000000..5dc2efa Binary files /dev/null and b/api/app/__pycache__/database.cpython-311.pyc differ diff --git a/api/app/models/__pycache__/__init__.cpython-311.pyc b/api/app/models/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..5e37463 Binary files /dev/null and b/api/app/models/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/app/models/__pycache__/category.cpython-311.pyc b/api/app/models/__pycache__/category.cpython-311.pyc new file mode 100644 index 0000000..22aba79 Binary files /dev/null and b/api/app/models/__pycache__/category.cpython-311.pyc differ diff --git a/api/app/models/__pycache__/joke.cpython-311.pyc b/api/app/models/__pycache__/joke.cpython-311.pyc new file mode 100644 index 0000000..cfb5500 Binary files /dev/null and b/api/app/models/__pycache__/joke.cpython-311.pyc differ diff --git a/api/app/models/__pycache__/user.cpython-311.pyc b/api/app/models/__pycache__/user.cpython-311.pyc new file mode 100644 index 0000000..1445b95 Binary files /dev/null and b/api/app/models/__pycache__/user.cpython-311.pyc differ diff --git a/api/app/schemas/__init__.py b/api/app/schemas/__init__.py new file mode 100644 index 0000000..d8df8b0 --- /dev/null +++ b/api/app/schemas/__init__.py @@ -0,0 +1,29 @@ +from .auth import LoginRequest, TokenResponse +from .category import ( + JokeCrowdCreate, + JokeCrowdResponse, + JokeTypeCreate, + JokeTypeResponse, +) +from .joke import ( + JokeCreate, + JokeResponse, + JokeUpdate, + PaginatedJokeResponse, +) + +__all__ = [ + "JokeBase", + "JokeCreate", + "JokeUpdate", + "JokeResponse", + "PaginatedJokeResponse", + "JokeTypeBase", + "JokeTypeCreate", + "JokeTypeResponse", + "JokeCrowdBase", + "JokeCrowdCreate", + "JokeCrowdResponse", + "LoginRequest", + "TokenResponse", +] \ No newline at end of file diff --git a/api/app/schemas/auth.py b/api/app/schemas/auth.py new file mode 100644 index 0000000..68e3aaf --- /dev/null +++ b/api/app/schemas/auth.py @@ -0,0 +1,11 @@ +from pydantic import BaseModel + + +class LoginRequest(BaseModel): + username: str + password: str + + +class TokenResponse(BaseModel): + access_token: str + token_type: str = "bearer" \ No newline at end of file diff --git a/api/app/schemas/category.py b/api/app/schemas/category.py new file mode 100644 index 0000000..d62e7ec --- /dev/null +++ b/api/app/schemas/category.py @@ -0,0 +1,35 @@ +from pydantic import BaseModel + + +class JokeTypeBase(BaseModel): + name: str + icon: str | None = None + sort_order: int = 0 + + +class JokeTypeCreate(JokeTypeBase): + pass + + +class JokeTypeResponse(JokeTypeBase): + id: int + + class Config: + from_attributes = True + + +class JokeCrowdBase(BaseModel): + name: str + icon: str | None = None + sort_order: int = 0 + + +class JokeCrowdCreate(JokeCrowdBase): + pass + + +class JokeCrowdResponse(JokeCrowdBase): + id: int + + class Config: + from_attributes = True \ No newline at end of file diff --git a/api/app/schemas/joke.py b/api/app/schemas/joke.py new file mode 100644 index 0000000..cdf6a97 --- /dev/null +++ b/api/app/schemas/joke.py @@ -0,0 +1,43 @@ +from datetime import datetime + +from pydantic import BaseModel + + +class JokeBase(BaseModel): + title: str + content: str + type_id: int | None = None + crowd_id: int | None = None + + +class JokeCreate(JokeBase): + pass + + +class JokeUpdate(BaseModel): + title: str | None = None + content: str | None = None + type_id: int | None = None + crowd_id: int | None = None + status: str | None = None + + +class JokeResponse(JokeBase): + id: int + status: str + view_count: int + like_count: int + created_at: datetime + updated_at: datetime + type_name: str | None = None + crowd_name: str | None = None + + class Config: + from_attributes = True + + +class PaginatedJokeResponse(BaseModel): + items: list[JokeResponse] + total: int + page: int + page_size: int \ No newline at end of file