123
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user