basic task show
This commit is contained in:
parent
17a2c19227
commit
d427fd72d4
|
@ -579,6 +579,24 @@ paths:
|
|||
items:
|
||||
# $ref: "#/components/schemas/ActiveTask"
|
||||
$ref: "#/components/schemas/Task"
|
||||
/tasks/{task_id}:
|
||||
parameters:
|
||||
- name: task_id
|
||||
in: path
|
||||
required: true
|
||||
description: The unique id of an existing process group.
|
||||
schema:
|
||||
type: string
|
||||
get:
|
||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.task_show
|
||||
summary: Gets one task that a user wants to complete
|
||||
responses:
|
||||
"200":
|
||||
description: One task
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Task"
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
|
|
|
@ -460,6 +460,30 @@ def task_list_my_tasks(page: int = 1, per_page: int = 100) -> flask.wrappers.Res
|
|||
return response_json
|
||||
|
||||
|
||||
def task_show(task_id: int) -> flask.wrappers.Response:
|
||||
"""Task_list_my_tasks."""
|
||||
principal = PrincipalModel.query.filter_by(user_id=g.user.id).first()
|
||||
if principal is None:
|
||||
raise (
|
||||
ApiError(
|
||||
code="principal_not_found",
|
||||
message=f"Principal not found from user id: {g.user.id}",
|
||||
status_code=400,
|
||||
)
|
||||
)
|
||||
active_task_assigned_to_me = ActiveTaskModel.query.filter_by(id=task_id, assigned_principal_id=principal.id).first()
|
||||
if active_task_assigned_to_me is None:
|
||||
raise (
|
||||
ApiError(
|
||||
code="task_not_found",
|
||||
message=f"Task not found for principal user: {g.user.id} and id: {task_id}",
|
||||
status_code=400,
|
||||
)
|
||||
)
|
||||
|
||||
return active_task_assigned_to_me
|
||||
|
||||
|
||||
def get_file_from_request() -> Any:
|
||||
"""Get_file_from_request."""
|
||||
request_file = connexion.request.files.get("file")
|
||||
|
|
|
@ -13,9 +13,6 @@ from spiffworkflow_backend.models.principal import PrincipalModel
|
|||
def test_user_can_be_given_permission_to_administer_process_group(app: Flask) -> None:
|
||||
"""Test_user_can_be_given_permission_to_administer_process_group."""
|
||||
user = find_or_create_user()
|
||||
principal = PrincipalModel(user_id=user.id)
|
||||
db.session.add(principal)
|
||||
db.session.commit()
|
||||
|
||||
# process_group = find_or_create_process_group()
|
||||
# permission_target = PermissionTargetModel(process_group_id=process_group.id)
|
||||
|
|
Loading…
Reference in New Issue