exam-manager.app.dal.workflow_dal#

Data acess layer (DAL) between fastapi endpoint and sql database.

Functions#

add_workflow_data(→ app.db.postgres.Workflow)

Add new workflow.

get_workflow_data(→ app.db.postgres.Workflow | None)

Get workflow by id.

get_all_workflow_data(→ list[app.db.postgres.Workflow])

Get a list of all workflows assigned to a certain exam.

get_all_workflows_template_data(...)

Get a list of all workflows assigned to a certain exam.

delete_workflow_data(→ bool)

Delete a workflow by ID. Cascade delete the associated tasks.

update_workflow_data(→ app.db.postgres.Workflow | None)

Update existing workflow in database.

Module Contents#

async exam-manager.app.dal.workflow_dal.add_workflow_data(payload: scanhub_libraries.models.BaseWorkflow, creator: str) app.db.postgres.Workflow#

Add new workflow.

Parameters#

payload

Workflow pydantic base model with data for workflow creation

creator

The username/id of the user who creats this exam

Returns#

Database orm model of created workflow

async exam-manager.app.dal.workflow_dal.get_workflow_data(workflow_id: uuid.UUID) app.db.postgres.Workflow | None#

Get workflow by id.

Parameters#

workflow_id

Id of the requested workflow

Returns#

Database orm model with data of requested workflow

async exam-manager.app.dal.workflow_dal.get_all_workflow_data(exam_id: uuid.UUID) list[app.db.postgres.Workflow]#

Get a list of all workflows assigned to a certain exam.

Parameters#

exam_id

Id of the parent exam entry, workflows are assigned to

Returns#

List of workflow data base orm models

async exam-manager.app.dal.workflow_dal.get_all_workflows_template_data() list[app.db.postgres.Workflow]#

Get a list of all workflows assigned to a certain exam.

Parameters#

exam_id

Id of the parent exam entry, workflows are assigned to

Returns#

List of workflow data base orm models

async exam-manager.app.dal.workflow_dal.delete_workflow_data(workflow_id: uuid.UUID) bool#

Delete a workflow by ID. Cascade delete the associated tasks.

Parameters#

workflow_id

ID of workflow to be deleted

Returns#

Success of delete event

async exam-manager.app.dal.workflow_dal.update_workflow_data(workflow_id: uuid.UUID, payload: scanhub_libraries.models.BaseWorkflow) app.db.postgres.Workflow | None#

Update existing workflow in database.

Parameters#

workflow_id

Id of the workflow to be updateed

payload

Workflow pydantic base model with data to be updated

Returns#

Workflow database orm model of updated workflow