async def state_project(request: web.Request) -> web.Response: user_id = request[RQT_USERID_KEY] project_uuid = request.match_info.get("project_id") # check that project exists and queries state validated_project = await projects_api.get_project_for_user( request.app, project_uuid=project_uuid, user_id=user_id, include_templates=True, include_state=True, ) project_state = ProjectState(**validated_project["state"]) return web.json_response({"data": project_state.dict()})
async def state_project(request: web.Request) -> web.Response: from servicelib.aiohttp.rest_utils import extract_and_validate user_id: int = request[RQT_USERID_KEY] path, _, _ = await extract_and_validate(request) project_uuid = path["project_id"] # check that project exists and queries state validated_project = await projects_api.get_project_for_user( request.app, project_uuid=project_uuid, user_id=user_id, include_templates=True, include_state=True, ) project_state = ProjectState(**validated_project["state"]) return web.json_response({"data": project_state.dict()}, dumps=json_dumps)