123
This commit is contained in:
0
backend/api_service/app/schemas/__init__.py
Normal file
0
backend/api_service/app/schemas/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
backend/api_service/app/schemas/__pycache__/task.cpython-311.pyc
Normal file
BIN
backend/api_service/app/schemas/__pycache__/task.cpython-311.pyc
Normal file
Binary file not shown.
34
backend/api_service/app/schemas/account.py
Normal file
34
backend/api_service/app/schemas/account.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
Pydantic schemas for Weibo Account CRUD operations.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class AccountCreate(BaseModel):
|
||||
"""Request body for creating a new Weibo account."""
|
||||
weibo_user_id: str = Field(..., min_length=1, max_length=20, description="Weibo user ID")
|
||||
cookie: str = Field(..., min_length=1, description="Raw Weibo cookie string")
|
||||
remark: Optional[str] = Field(None, max_length=100, description="Optional note")
|
||||
|
||||
|
||||
class AccountUpdate(BaseModel):
|
||||
"""Request body for updating an existing Weibo account."""
|
||||
cookie: Optional[str] = Field(None, min_length=1, description="New cookie (will be re-encrypted)")
|
||||
remark: Optional[str] = Field(None, max_length=100, description="Updated note")
|
||||
|
||||
|
||||
class AccountResponse(BaseModel):
|
||||
"""Public representation of a Weibo account (no cookie plaintext)."""
|
||||
id: str
|
||||
user_id: str
|
||||
weibo_user_id: str
|
||||
remark: Optional[str]
|
||||
status: str
|
||||
last_checked_at: Optional[datetime]
|
||||
created_at: Optional[datetime]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
30
backend/api_service/app/schemas/signin_log.py
Normal file
30
backend/api_service/app/schemas/signin_log.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Pydantic schemas for Signin Log query operations.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional, List, Any, Dict
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SigninLogResponse(BaseModel):
|
||||
"""Public representation of a signin log entry."""
|
||||
id: int
|
||||
account_id: str
|
||||
topic_title: Optional[str]
|
||||
status: str
|
||||
reward_info: Optional[Any]
|
||||
error_message: Optional[str]
|
||||
signed_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class PaginatedResponse(BaseModel):
|
||||
"""Paginated response wrapper for signin logs."""
|
||||
items: List[SigninLogResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
total_pages: int
|
||||
29
backend/api_service/app/schemas/task.py
Normal file
29
backend/api_service/app/schemas/task.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Pydantic schemas for Task CRUD operations.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TaskCreate(BaseModel):
|
||||
"""Request body for creating a new signin task."""
|
||||
cron_expression: str = Field(..., min_length=1, max_length=50, description="Cron expression for scheduling")
|
||||
|
||||
|
||||
class TaskUpdate(BaseModel):
|
||||
"""Request body for updating an existing task."""
|
||||
is_enabled: Optional[bool] = Field(None, description="Enable or disable the task")
|
||||
|
||||
|
||||
class TaskResponse(BaseModel):
|
||||
"""Public representation of a signin task."""
|
||||
id: str
|
||||
account_id: str
|
||||
cron_expression: str
|
||||
is_enabled: bool
|
||||
created_at: Optional[datetime]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user