57 lines
1.3 KiB
Python
Executable File
57 lines
1.3 KiB
Python
Executable File
from datetime import datetime
|
|
from enum import Enum
|
|
from typing import Optional, List
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from backend.common.schema import SchemaBase
|
|
|
|
|
|
class FeedbackStatus(str, Enum):
|
|
PENDING = "pending"
|
|
PROCESSING = "processing"
|
|
RESOLVED = "resolved"
|
|
|
|
|
|
class FeedbackCategory(str, Enum):
|
|
BUG = "bug"
|
|
FEATURE = "feature"
|
|
COMPLIMENT = "compliment"
|
|
OTHER = "other"
|
|
|
|
|
|
class FeedbackSchemaBase(SchemaBase):
|
|
content: str
|
|
contact_info: Optional[str] = None
|
|
category: Optional[FeedbackCategory] = None
|
|
metadata_info: Optional[dict] = None
|
|
|
|
|
|
class CreateFeedbackParam(FeedbackSchemaBase):
|
|
"""创建反馈参数"""
|
|
pass
|
|
|
|
|
|
class UpdateFeedbackParam(FeedbackSchemaBase):
|
|
"""更新反馈参数"""
|
|
status: Optional[FeedbackStatus] = None
|
|
|
|
|
|
class FeedbackInfoSchema(FeedbackSchemaBase):
|
|
"""反馈信息Schema"""
|
|
id: int
|
|
user_id: int
|
|
status: FeedbackStatus
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class FeedbackUserInfoSchema(FeedbackInfoSchema):
|
|
"""包含用户信息的反馈Schema"""
|
|
user: Optional[dict] = None # 简化的用户信息
|
|
|
|
class Config:
|
|
from_attributes = True |