exam-manager.app.dal.result_dal#

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

Functions#

add_result_db(→ app.db.postgres.Result)

Add new result to database.

get_result_db(→ app.db.postgres.Result | None)

Get result by id.

get_all_results_db(→ list[app.db.postgres.Result])

Get a list of all results assigned to a certain task.

update_result_db(→ app.db.postgres.Result | None)

Update existing result in database.

delete_result_db(→ bool)

Delete result by id.

Module Contents#

async exam-manager.app.dal.result_dal.add_result_db(payload: scanhub_libraries.models.BaseResult) app.db.postgres.Result#

Add new result to database.

Parameters#

payload

Result pydantic base model

Returns#

Database orm model of created result

async exam-manager.app.dal.result_dal.get_result_db(result_id: uuid.UUID) app.db.postgres.Result | None#

Get result by id.

Parameters#

result_id

Id of the requested result

Returns#

Database orm model with data of requested result

async exam-manager.app.dal.result_dal.get_all_results_db(task_id: uuid.UUID) list[app.db.postgres.Result]#

Get a list of all results assigned to a certain task.

Parameters#

task_id

Id of the parent task entry, results are assigned to

Returns#

List of result data base orm models

async exam-manager.app.dal.result_dal.update_result_db(result_id: uuid.UUID, payload: scanhub_libraries.models.BaseResult) app.db.postgres.Result | None#

Update existing result in database.

Parameters#

result_id

Id of the result to be updateed

payload

Result pydantic base model with data to be updated

Returns#

Resuld database orm model of updated result

async exam-manager.app.dal.result_dal.delete_result_db(result_id: uuid.UUID) bool#

Delete result by id.

Parameters#

result_id

Id of the result to be deleted

Returns#

Success of deletion