feat: 双Token认证(Access 2h/Refresh 7d) + 通知系统(转交/驳回自动推送)
This commit is contained in:
26
backend/app/schemas/notification.py
Normal file
26
backend/app/schemas/notification.py
Normal file
@ -0,0 +1,26 @@
|
||||
"""通知 Pydantic Schema"""
|
||||
from __future__ import annotations
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class NotificationResponse(BaseModel):
|
||||
"""通知列表响应"""
|
||||
id: uuid.UUID
|
||||
user_id: str
|
||||
title: str
|
||||
content: str
|
||||
type: str
|
||||
task_id: uuid.UUID | None = None
|
||||
is_read: bool
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class NotificationListResponse(BaseModel):
|
||||
"""通知分页列表"""
|
||||
notifications: list[NotificationResponse]
|
||||
total: int
|
||||
unread_count: int
|
||||
@ -110,6 +110,7 @@ class TaskSummaryResponse(BaseModel):
|
||||
status: str
|
||||
notify_parent_on_complete: bool
|
||||
is_rework: bool = False
|
||||
task_type: str | None = None
|
||||
remark: str | None = None
|
||||
reject_reason: str | None = None
|
||||
received_at: datetime | None = None
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
"""用户 Schemas — 对接 MOM sys_user 表"""
|
||||
"""用户 Schemas — 对接 MOM sys_user 表 + 双 Token"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@ -20,5 +20,15 @@ class UserResponse(BaseModel):
|
||||
|
||||
class LoginResponse(BaseModel):
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
user: UserResponse
|
||||
|
||||
|
||||
class RefreshRequest(BaseModel):
|
||||
refresh_token: str = Field(..., description="Refresh Token")
|
||||
|
||||
|
||||
class RefreshResponse(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
|
||||
Reference in New Issue
Block a user