Documentation ¶
Index ¶
- func CreateStudents(db *mongo.Client, api *goforces.Client, students []StudentCreate, ...) ([]user.UserCredentials, error)
- func CreateStudentsFile(db *mongo.Client, request string, databaseName, collectionName string) ([]user.UserCredentials, error)
- func DeleteStudents(db *mongo.Client, students []Student, databaseName, collectionName string) error
- func GetIndividualUserProgress(contestsIds []int, handle, groupID string, api *goforces.Client) (interface{}, error)
- func GetUserProgress(contestsIds []int, handle string, api *goforces.Client) (interface{}, error)
- func UpdateStudents(db *mongo.Client, api *goforces.Client, student StudentUpdate, ...) error
- type Student
- type StudentCreate
- type StudentCreatePage
- type StudentGrades
- type StudentHandles
- type StudentInfo
- type StudentUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateStudents ¶
func CreateStudents(db *mongo.Client, api *goforces.Client, students []StudentCreate, databaseName, collectionName string) ([]user.UserCredentials, error)
CreateStudents recieve a list of students Checks if that list is not null (can't insert null list) Insert each student individually in database @param db pointer to database @param students list of students @param databaseName name of database @param collectionName name of collection @return error function error TODO : Insert all students at the same time (if possible)
func CreateStudentsFile ¶
func CreateStudentsFile(db *mongo.Client, request string, databaseName, collectionName string) ([]user.UserCredentials, error)
CreateStudentsFile recieve csv file of students Call function that parse that file and return list o students Checks if that list is not null (can't insert null list) Insert each student individually in database @param db pointer to database @param request byte array file @param databaseName name of database @param collectionName name of collection @return error function error TODO : Insert all students at the same time (if possible)
func DeleteStudents ¶
func DeleteStudents(db *mongo.Client, students []Student, databaseName, collectionName string) error
DeleteStudents recieve a list of students (to be deleted) Checks if that list is not null (can't delete null list) Delete each student individually @param db pointer to database (to be deleted) @param students list of students @param databaseName name of database @param collectionName name of collection @return []Student list of all students @return error function error TODO : Delete all students at the same time (if possible)
func GetUserProgress ¶
func UpdateStudents ¶
func UpdateStudents(db *mongo.Client, api *goforces.Client, student StudentUpdate, databaseName, collectionName string) error
UpdateStudents recieve student (updated) Checks if student old password matches with db to update that student password or email @param db pointer to database (updated) @param students list of students @param databaseName name of database @param collectionName name of collection @return StudentUpdate student new data @return error function error TODO : Update all students at the same time (if possible)
Types ¶
type Student ¶
type Student struct { ID primitive.ObjectID `bson:"_id,omitempty"` ClassID primitive.ObjectID `bson:"classid,omitempty"` FirstName string `json:"firstname"` LastName string `json:"lastname"` Matricula string `json:"matricula"` Handles StudentHandles `json:"handles"` PhotoURL string `json:"photourl"` Email string `json:"email"` Grades StudentGrades `json:"grades"` }
func GetStudent ¶
func GetStudentsClass ¶
func GetStudentsClass(db *mongo.Client, classID primitive.ObjectID, databaseName, collectionName string) ([]Student, error)
GetStudentsClass return list of all students from Database thata matchs with a certain class Get all students at the same time and store inside cursor Decode each student inside student class and append into students array @param db pointer to database @param classID ID of the current class @param databaseName name of database @param collectionName name of collection @return []Student list of all students @return error function error
type StudentCreate ¶
type StudentCreate struct { ClassID primitive.ObjectID `bson:"classid,omitempty"` FirstName string `json:"firstname"` LastName string `json:"lastname"` Matricula string `json:"matricula"` Handles StudentHandles `json:"handles"` PhotoURL string `json:"photourl"` Email string `json:"email"` Grades StudentGrades `json:"grades"` }
type StudentCreatePage ¶
type StudentCreatePage struct { Result string `json:"result"` Students []user.UserCredentials `json:"students"` }
type StudentGrades ¶
type StudentHandles ¶
type StudentInfo ¶
type StudentInfo struct { ID primitive.ObjectID `bson:"_id,omitempty"` ClassID primitive.ObjectID `bson:"classid,omitempty"` FirstName string `json:"firstname"` LastName string `json:"lastname"` Matricula string `json:"matricula"` Handles StudentHandles `json:"handles"` PhotoURL string `json:"photourl"` Email string `json:"email"` Grades StudentGrades `json:"grades"` }
func AuthStudent ¶
func AuthStudent(db *mongo.Client, student user.UserCredentials, databaseName, collectionName string) (StudentInfo, error)
AuthStudent recieve a student (to be authenticated) Checks if that date exist in databse Return true if exist @param db pointer to database (to be deleted) @param student student matricula and password @param databaseName name of database @param collectionName name of collection @return []bool user exist veredict @return error function error
func GetStudents ¶
func GetStudents(db *mongo.Client, databaseName, collectionName string) ([]StudentInfo, error)
GetStudents return list of all students from Database Get all students at the same time and store inside cursor Decode each student inside student class and append into students array @param db pointer to database @param databaseName name of database @param collectionName name of collection @return []Student list of all students @return error function error