import datetime from apiflask import APIBlueprint from ...dependencies import db from ..models import ExaminationSchedule bp = APIBlueprint("list_of_examination_schedule", __name__, url_prefix="/") @bp.get('/students-view/') def list_examination_schedule_for_students() -> dict: # in the future filter after the mode of examination schedule if we will have authorization module now = datetime.datetime.utcnow() examination_schedules = db.session.query(ExaminationSchedule).\ filter(ExaminationSchedule.start_date_for_enrollment_students < now).\ filter(ExaminationSchedule.end_date_for_enrollment_students > now).all() return {'examination_schedules': examination_schedules}