Documentation ¶
Overview ¶
Package service wraps user interfaces with common logic unrelated to any particular user implementation. All consumers should be using service.DataStore and not the naked repositories!
Index ¶
- type DataStore
- func (s *DataStore) AddClasses(classes []store.Class) error
- func (s *DataStore) AddCourse(course store.Course) (id string, err error)
- func (s *DataStore) AddGroup(name string, studyYearID string) (id string, err error)
- func (s *DataStore) AddStudyYear(name string) (id string, err error)
- func (s *DataStore) AddTeacher(teacher store.Teacher) (teacherID string, err error)
- func (s *DataStore) AddUser(user store.User, password string) (id string, err error)
- func (s *DataStore) CheckUserCredentials(email string, password string) (ok bool, err error)
- func (s *DataStore) DeleteGroup(id string) error
- func (s *DataStore) DeleteStudyYear(studyYearID string) error
- func (s *DataStore) DeleteTeacher(teacherID string) error
- func (s *DataStore) GetCourse(id string) (store.Course, error)
- func (s *DataStore) GetGroup(id string) (store.Group, error)
- func (s *DataStore) GetStudyYear(id string) (sy store.StudyYear, err error)
- func (s *DataStore) GetTeacherFull(teacherID string) (store.Teacher, error)
- func (s *DataStore) GetUserEmail(id string) (email string, err error)
- func (s *DataStore) GetUserPrivs(id string) (privs []store.Privilege, err error)
- func (s *DataStore) ListClasses(from time.Time, till time.Time, groupID string) ([]store.Class, error)
- func (s *DataStore) ListCourses() (res []store.Course, err error)
- func (s *DataStore) ListGroups() ([]store.Group, error)
- func (s *DataStore) ListStudyYears() ([]store.StudyYear, error)
- func (s *DataStore) ListTeachers() ([]store.TeacherDetails, error)
- func (s *DataStore) ListTimeSlots() ([]store.TimeSlot, error)
- func (s *DataStore) RegisterAdmin(email string, password string) (id string, err error)
- func (s *DataStore) SetTeacherPreferences(teacherID string, pref store.TeacherPreferences) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore struct { UserRepository user.Interface TeacherRepository teacher.Interface UniOrgRepository uni.Interface SchedRepository sched.Interface BCryptCost int }
DataStore wraps all stores with common and additional methods todo looks ugly, rewrite
func (*DataStore) AddClasses ¶
AddClasses to the database
func (*DataStore) AddStudyYear ¶
AddStudyYear to the database
func (*DataStore) AddTeacher ¶
AddTeacher to the database
func (*DataStore) CheckUserCredentials ¶
CheckUserCredentials with the given username and password
func (*DataStore) DeleteGroup ¶
DeleteGroup from the database
func (*DataStore) DeleteStudyYear ¶
DeleteStudyYear by its id
func (*DataStore) DeleteTeacher ¶
DeleteTeacher from the database by its id
func (*DataStore) GetStudyYear ¶
GetStudyYear by its id
func (*DataStore) GetTeacherFull ¶
GetTeacherFull returns all data about the requested teacher, including teacher preferences
func (*DataStore) GetUserEmail ¶
GetUserEmail returns the email of the specified user
func (*DataStore) GetUserPrivs ¶
GetUserPrivs returns the list of privileges of the specified user
func (*DataStore) ListClasses ¶
func (s *DataStore) ListClasses(from time.Time, till time.Time, groupID string) ([]store.Class, error)
ListClasses in the given period for the given group
func (*DataStore) ListCourses ¶
ListCourses that are registered in the database
func (*DataStore) ListGroups ¶
ListGroups registered in the database
func (*DataStore) ListStudyYears ¶
ListStudyYears that are registered in the database
func (*DataStore) ListTeachers ¶
func (s *DataStore) ListTeachers() ([]store.TeacherDetails, error)
ListTeachers returns all teachers that are registered in the database
func (*DataStore) ListTimeSlots ¶
ListTimeSlots that are registered in the database
func (*DataStore) RegisterAdmin ¶
RegisterAdmin in the database
func (*DataStore) SetTeacherPreferences ¶
func (s *DataStore) SetTeacherPreferences(teacherID string, pref store.TeacherPreferences) error
SetTeacherPreferences sets preferences for the given teacher