You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
from dataclasses import field
|
|
from marshmallow_dataclass import dataclass
|
|
from iti.applications.common.utils.schema import BaseSchema, Pagination
|
|
from typing import ClassVar
|
|
import datetime
|
|
from iti.applications.common.enums import LogType
|
|
|
|
|
|
@dataclass(base_schema=BaseSchema)
|
|
class LogQuery(Pagination):
|
|
"""
|
|
日志查询请求
|
|
"""
|
|
|
|
keyword: str = field(
|
|
metadata={
|
|
"required": False,
|
|
"metadata": {"example": "关键字", "description": "关键字"},
|
|
},
|
|
default=None,
|
|
)
|
|
type: LogType = field(
|
|
metadata={
|
|
"required": False,
|
|
"by_value": True,
|
|
"metadata": {"example": "LOGIN", "description": "日志类型"},
|
|
},
|
|
default=None,
|
|
)
|
|
createdAt: list[datetime.datetime] = field(
|
|
metadata={
|
|
"data_key": "createdAt[]",
|
|
"required": False,
|
|
"metadata": {
|
|
"example": ["2025-01-01 00:00:00", "2025-01-01 23:59:59"],
|
|
"description": "创建时间",
|
|
},
|
|
},
|
|
default=None,
|
|
)
|
|
Schema: ClassVar[BaseSchema] = BaseSchema # For the type check
|
|
|
|
|
|
@dataclass(base_schema=BaseSchema)
|
|
class LogBatchDeleteRequest:
|
|
"""
|
|
批量删除日志请求
|
|
"""
|
|
|
|
ids: list[str] = field(
|
|
metadata={
|
|
"data_key": "ids[]",
|
|
"required": False,
|
|
"metadata": {
|
|
"example": ["1234567890", "1234567891"],
|
|
"description": "日志ID列表",
|
|
},
|
|
},
|
|
default=None,
|
|
)
|
|
type: LogType = field(
|
|
metadata={
|
|
"required": False,
|
|
"by_value": True,
|
|
"metadata": {"example": "LOGIN", "description": "日志类型"},
|
|
},
|
|
default=None,
|
|
)
|
|
Schema: ClassVar[BaseSchema] = BaseSchema # For the type check
|