Files
FastapiAdmin/backend/app/plugin/module_task/workflow/definition/crud.py
T
zhangtao d2a863652e feat(docs): enhance README and backend documentation for new user onboarding and backend conventions
- 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.
2026-03-29 07:25:09 +08:00

39 lines
1.3 KiB
Python

from collections.abc import Sequence
from typing import Any
from app.api.v1.module_system.auth.schema import AuthSchema
from app.core.base_crud import CRUDBase
from .model import WorkflowModel
from .schema import WorkflowCreateSchema, WorkflowUpdateSchema
class WorkflowCRUD(CRUDBase[WorkflowModel, WorkflowCreateSchema, WorkflowUpdateSchema]):
"""工作流数据层"""
def __init__(self, auth: AuthSchema) -> None:
self.auth = auth
super().__init__(model=WorkflowModel, auth=auth)
async def get_obj_by_id_crud(
self, id: int, preload: list[str | Any] | None = None
) -> WorkflowModel | None:
return await self.get(id=id, preload=preload)
async def get_obj_list_crud(
self,
search: dict | None = None,
order_by: list[dict[str, str]] | None = None,
preload: list[str | Any] | None = None,
) -> Sequence[WorkflowModel]:
return await self.list(search=search, order_by=order_by, preload=preload)
async def create_obj_crud(self, data: WorkflowCreateSchema) -> WorkflowModel | None:
return await self.create(data=data)
async def update_obj_crud(self, id: int, data: WorkflowUpdateSchema) -> WorkflowModel | None:
return await self.update(id=id, data=data)
async def delete_obj_crud(self, ids: list[int]) -> None:
await self.delete(ids=ids)