Update term of defences endpoint to include groups

This commit is contained in:
adam-skowronek 2023-01-06 17:25:21 +01:00
parent 7d03b2b471
commit 46aa2c0af4

View File

@ -200,13 +200,13 @@ def delete_term_of_defence(examination_schedule_id: int, term_of_defence_id: int
@bp.get('/<int:examination_schedule_id>/term-of-defences/') @bp.get('/<int:examination_schedule_id>/term-of-defences/')
@bp.output(TermOfDefenceListSchema) @bp.output(AssignedGroupToTermOfDefenceListSchema)
def list_of_term_of_defences(examination_schedule_id: int) -> dict: def list_of_term_of_defences(examination_schedule_id: int) -> dict:
get_examination_schedule_by_id(examination_schedule_id) get_examination_schedule_by_id(examination_schedule_id)
td = TermOfDefence.query. \ td = TermOfDefence.query. \
filter(TermOfDefence.examination_schedule_id == examination_schedule_id). \
join(TermOfDefence.members_of_committee, isouter=True). \ join(TermOfDefence.members_of_committee, isouter=True). \
filter(TermOfDefence.examination_schedule_id == examination_schedule_id). \
all() all()
return {"term_of_defences": td} return {"term_of_defences": td}