Exemplo n.º 1
0
def get_all() -> Tuple[Dict[str, Any], ...]:
    """
    Get departments
    -Input: ---
    -Output:
        *All the departments of the table
        *None value if we cannot find the OID
    """
    return query("SELECT * FROM Departments")
Exemplo n.º 2
0
def get_all() -> Tuple[Dict[str, Any], ...]:
    """
    Get subjects
    -Input: ---
    -Output:
        *All the subjects of the table
        *None value if we cannot find the OID
    """
    return base_dal.query("SELECT * FROM Subjects")
Exemplo n.º 3
0
def get_all() -> Tuple[Dict[str, Any], ...]:
    """
    Get TeachingLoads
    -Input: ---
    -Output:
        *All the TeachingLoads of the table
        *None value if we cannot find the OID
    """
    return base_dal.query("SELECT * FROM TeachingLoads")
Exemplo n.º 4
0
def get_by_acronym(acronym: str) -> Optional[Dict[str, Any]]:
    """
    Get subject by acronym
    -Input:
        *The acronym of the subject that we want to get
    -Output:
        *Only one subject
        *None value if we cannot find the acronym
    """
    q = "SELECT * FROM Subjects WHERE acronym = %s"
    params = (acronym, )

    res: Tuple[Dict[str, Any], ...] = base_dal.query(q, params)

    return res[0] if res else None
Exemplo n.º 5
0
def get_by_name(name: str) -> Optional[Dict[str, Any]]:
    """
    Get subject by name
    -Input:
        *The name of the subject that we want to get
    -Output:
        *Only one subject
        *None value if we cannot find the name
    """

    q = "SELECT * FROM Subjects WHERE name = %s"
    params = (name, )

    res: Tuple[Dict[str, Any]] = base_dal.query(q, params)

    return res[0] if res else None
Exemplo n.º 6
0
def get_by_oid(oid: int) -> Optional[Dict[str, Any]]:
    """
    Get subject by OID
    -Input:
        *The OID of the subject that we want to get
    -Output:
        *Only one subject
        *None value if we cannot find the OID
    """

    q = "SELECT * FROM Subjects WHERE subjectId = %s"
    params = (oid, )

    res: Tuple[Dict[str, Any], ...] = base_dal.query(q, params)

    return res[0] if res else None
Exemplo n.º 7
0
def get_by_email(email: str) -> Optional[Dict[str, Any]]:
    """
    Get professor by email
    -Input:
        *The name of the professor that we want to get
    -Output:
        *Only one professor
        *None value if we cannot find the email
    """

    q = "SELECT * FROM Professors WHERE email = %s"
    params = (email,)

    res: Tuple[Dict[str, Any]] = base_dal.query(q, params)

    return res[0] if res else None
Exemplo n.º 8
0
def get_by_name(name: str) -> Optional[Tuple[Dict[str, Any], ...]]:
    """
    Get department by name
    -Input:
        *The name of the department that we want to get
    -Output:
        *Only one department
        *None value if we cannot find the name
    """

    q = "SELECT * FROM Department WHERE name = %s"
    params = (name, )

    res: Tuple[Dict[str, Any]] = query(q, params)

    return res[0] if res else None
Exemplo n.º 9
0
def get_by_oid(oid: int) -> Optional[Dict[str, Any]]:
    """
    Get departments by OID
    -Input:
        *The OID of the department that we want to get
    -Output:
        *Only one department
        *None value if we cannot find the OID
    """

    q = "SELECT * FROM Departments WHERE departmentId = %s"
    params = (oid, )

    res: Tuple[Dict[str, Any], ...] = query(q, params)

    return res[0] if res else None
Exemplo n.º 10
0
def get_by_classroom_id(classroom_id: int) -> Optional[Dict[str, Any]]:
    """
    Get groups by classroom_id
    -Input:
        *The classroom_id of the groups that we want to get
    -Output:
        *The groups which classroom_id is the same as received as parameter
        *None value if we cannot find the name
    """

    q = "SELECT * FROM Groups WHERE classroomId = %s"
    params = (classroom_id, )

    res: Tuple[Dict[str, Any]] = base_dal.query(q, params)

    return res if res else None
Exemplo n.º 11
0
def get_by_oid(oid: int) -> Optional[Dict[str, Any]]:
    """
    Get TeachingLoad by OID
    -Input:
        *The OID of the TeachingLoad that we want to get
    -Output:
        *Only one TeachingLoad
        *None value if we cannot find the OID
    """

    q = "SELECT * FROM TeachingLoads WHERE teachingLoadId = %s"
    params = (oid, )

    res: Tuple[Dict[str, Any], ...] = base_dal.query(q, params)

    return res[0] if res else None
Exemplo n.º 12
0
def get_by_department(department_id: int):
    q = "SELECT * FROM Professors WHERE departmentId = %s"
    params = (department_id,)
    return base_dal.query(q, params)
Exemplo n.º 13
0
def get_by_year(year: int) -> Tuple[Dict[str, Any]]:
    q = "SELECT * FROM Groups WHERE year = %s"
    params = (year, )
    return base_dal.query(q, params)
Exemplo n.º 14
0
def get_by_professor_id(professor_id: int) -> Tuple[Dict[str, Any]]:
    q = "SELECT * FROM TeachingLoads WHERE professorId = %s"
    params = (professor_id, )
    return base_dal.query(q, params)