STATE-WP-0069 T04/T06: body metering and workplan-first state internals
Share LegacyWorkstreamIdBodyMixin across create schemas; meter POST /tasks/ and /decisions/ workstream_id bodies. State summary uses workplan flow; NextStep dual-writes workplan_* fields alongside legacy workstream_*.
This commit is contained in:
parent
6e5e150803
commit
388b330809
11 changed files with 157 additions and 36 deletions
|
|
@ -18,7 +18,7 @@ from api.schemas.task import (
|
|||
TaskStatusBulkSyncRead,
|
||||
TaskUpdate,
|
||||
)
|
||||
from api.services.legacy_compat import meter_legacy_query_param
|
||||
from api.services.legacy_compat import meter_legacy_body_from_model, meter_legacy_query_param
|
||||
from api.services.lifecycle import status_value, transition_task_status
|
||||
from api.task_status import normalize_task_status
|
||||
|
||||
|
|
@ -105,9 +105,20 @@ async def count_tasks(
|
|||
|
||||
@router.post("/", response_model=TaskRead, status_code=status.HTTP_201_CREATED)
|
||||
async def create_task(
|
||||
request: Request,
|
||||
response: Response,
|
||||
body: TaskCreate,
|
||||
session: AsyncSession = Depends(get_session),
|
||||
) -> Task:
|
||||
await meter_legacy_body_from_model(
|
||||
body,
|
||||
session=session,
|
||||
request=request,
|
||||
response=response,
|
||||
method="POST",
|
||||
route="/tasks/",
|
||||
replacement_ref="POST /tasks/ with workplan_id",
|
||||
)
|
||||
task = Task(**body.model_dump())
|
||||
session.add(task)
|
||||
if status_value(task.status) == "progress":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue