schedule

package
v0.0.0-...-927f0f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDocExistsAlready is thrown if document is already found
	ErrDocExistsAlready = errors.New("Document already exists")
	// ErrScheduleNotFound is thrown if schedule is not found
	ErrScheduleNotFound = errors.New("Schedule not found")
	// ErrAlreadyInGroup is returned if someone is already in a group
	ErrAlreadyInGroup = errors.New("User already in this group")
	// ErrGroupsNotFound is thrown if there are no groups found
	ErrGroupsNotFound = errors.New("There were no groups in this season")
)

Functions

func DeleteCourse

func DeleteCourse(courseID string)

DeleteCourse removes a course from database

func DeleteGroup

func DeleteGroup(groupID string)

DeleteGroup a group from database

func DeleteSchedule

func DeleteSchedule(scheduleID string)

DeleteSchedule removes schedule

func DeleteSeason

func DeleteSeason(ID string)

DeleteSeason removes season from database, it also should remove all schedules associated with it

func DeleteSubject

func DeleteSubject(name string)

DeleteSubject removes a subject from database

func RemoveSchedule

func RemoveSchedule(scheduleID string)

RemoveSchedule deletes the specified schedule from database

Types

type Course

type Course struct {
	Name          string
	Number        int
	NameShort     string
	Description   string
	CourseSubject Subject
	CourseID      string
}

Course represents a single course that the user can pick

func AddCourse

func AddCourse(name string, desc string, number int, subject Subject) (Course, error)

AddCourse adds a new course and saves it to the database

func GetCourse

func GetCourse(id string) (Course, error)

GetCourse gets course data from database

func LoadCourses

func LoadCourses() ([]Course, error)

LoadCourses loads the course data from the database

type Group

type Group struct {
	CourseID string
	Name     string
	Position int8
	Teacher  string
	Students []string
	GroupID  string
	SeasonID string
}

Group reprsents a group of students that has a subject

func AddGroup

func AddGroup(c Course, teacher user.User, position int8, season Season) (Group, error)

AddGroup creates a new group and saves it to database

func GetGroup

func GetGroup(groupID string) (Group, error)

GetGroup gets group based on group id

func GetGroupsForCourse

func GetGroupsForCourse(CourseID string) ([]Group, error)

GetGroupsForCourse gets all groups for specific course

func GetGroupsInSeason

func GetGroupsInSeason(seasonID string) ([]Group, error)

GetGroupsInSeason returns a slice of all the groups that are in defined season

func (*Group) AddStudent

func (g *Group) AddStudent(user user.User)

AddStudent adds a new user to the group and saves change to database

type Schedule

type Schedule struct {
	Groups     []string
	OwnerID    string
	Season     string
	ScheduleID string
}

Schedule represents some users schedule

func AddSchedule

func AddSchedule(ownerID string, seasonID string) (Schedule, error)

AddSchedule creates an schedule for user in season and saves it to database

func GetSchedule

func GetSchedule(scheduleID string) (Schedule, error)

GetSchedule gets schedule by id

func GetScheduleForUser

func GetScheduleForUser(ownerID string, seasonID string) (Schedule, error)

GetScheduleForUser gets the schedule of an user in specific season

func (*Schedule) AddGroup

func (s *Schedule) AddGroup(groupID string) error

AddGroup adds a new course to the schedule specified and saves the change to database

type Season

type Season struct {
	Name  string
	Start int64
	End   int64
	ID    string
}

Season represents one season of school where the schedule stays same

func AddSeason

func AddSeason(name string, start int64, end int64) (Season, error)

AddSeason adds season to database and returns it

func GetSeason

func GetSeason(ID string) (Season, error)

GetSeason gets a season from the database

func GetSeasons

func GetSeasons() ([]Season, error)

type Subject

type Subject struct {
	Name        string
	Description string
}

Subject represents a single subject

func AddSubject

func AddSubject(name string, desc string) (Subject, error)

AddSubject adds a new subject to the database of subjects

func GetSubject

func GetSubject(name string) (Subject, error)

GetSubject gets data for specific subject in the database

func LoadSubjects

func LoadSubjects() ([]Subject, error)

LoadSubjects Gets all subjects from database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL