35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
|
|
"""
|
||
|
|
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
|