mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-25 13:51:04 +00:00
- Added a "Start Here" section in both English and Chinese README files to guide new users on running the project locally and exploring its features. - Introduced backend conventions for date and serialization handling, clarifying the use of Pydantic v2 and PostgreSQL. - Updated the "Quick Start" section with detailed steps for first-time local setup, including environment requirements and backend setup instructions. - Improved overall structure and clarity of documentation to facilitate better understanding for developers and contributors.
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
import enum
|
|
|
|
from sqlalchemy import String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.base_model import ModelMixin
|
|
|
|
|
|
class JobStatusEnum(enum.Enum):
|
|
"""执行状态枚举"""
|
|
|
|
PENDING = "pending"
|
|
RUNNING = "running"
|
|
SUCCESS = "success"
|
|
FAILED = "failed"
|
|
TIMEOUT = "timeout"
|
|
CANCELLED = "cancelled"
|
|
|
|
|
|
class JobModel(ModelMixin):
|
|
"""
|
|
任务执行日志表
|
|
"""
|
|
|
|
__tablename__: str = "task_job"
|
|
__table_args__: dict[str, str] = {"comment": "任务执行日志表"}
|
|
|
|
job_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True, comment="任务ID")
|
|
job_name: Mapped[str | None] = mapped_column(String(128), nullable=True, comment="任务名称")
|
|
trigger_type: Mapped[str | None] = mapped_column(String(32), nullable=True, comment="触发方式: cron/interval/date/manual")
|
|
status: Mapped[str] = mapped_column(String(16), nullable=False, default=JobStatusEnum.PENDING.value, comment="执行状态")
|
|
next_run_time: Mapped[str | None] = mapped_column(String(64), nullable=True, comment="下次执行时间")
|
|
job_state: Mapped[str | None] = mapped_column(Text, nullable=True, comment="任务状态信息")
|
|
result: Mapped[str | None] = mapped_column(Text, nullable=True, comment="执行结果")
|
|
error: Mapped[str | None] = mapped_column(Text, nullable=True, comment="错误信息")
|