GoSkola24API/internal/requests/get_students.go
2024-12-06 21:43:57 +01:00

59 lines
1.8 KiB
Go

/*
GoSkola24API
Copyright (C) 2024, Zervó Zadachin
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License version 3 for more details.
This program incorporates external libraries for certain functionalities.
These libraries are covered by their respective licenses, and their usage
agreements are as outlined in their respective documentation or source
code.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package requests
import (
"errors"
"git.zervo.org/zervo/GoSkola24API/internal/types"
pubtypes "git.zervo.org/zervo/GoSkola24API/pkg/goskola24api/types"
)
// TODO: Create and implement proper students type once we have data
func GetStudents(school pubtypes.School, checkAvailability bool) (_result any, _error error) {
if checkAvailability && !school.AvailableData.HasStudents {
return nil, errors.New("availability check failed: school does not provide student data")
}
filters := types.RequestFilters{
Class: false,
Course: false,
Group: false,
Period: false,
Room: false,
Student: true,
Subject: false,
Teacher: false,
}
responseMap, err := GetGenericSelection(school, filters)
if err != nil {
return nil, errors.New("failed to get students: " + err.Error())
}
// Just return students as-is since we do not have any data do go from
return responseMap, nil
}