Datenbanken, erster Versuch

This commit is contained in:
Gonne 2022-08-29 22:58:19 +02:00
parent b26544756a
commit 766aedf22d
21 changed files with 678 additions and 320 deletions

14
models/course.go Normal file
View file

@ -0,0 +1,14 @@
// course
package models
type Course struct {
Id int
Name string
}
type CourseRepository interface {
FindByName(name string) (Course, error)
GetAll() ([]Course, error)
FindById(id int) (Course, error)
GetActive() ([]Course, error)
}

10
models/date.go Normal file
View file

@ -0,0 +1,10 @@
// date
package models
type Date struct {
Day int
Hour int
Minute int
}
const MinuteGranularity int = 5

23
models/officeHour.go Normal file
View file

@ -0,0 +1,23 @@
// officeHour
package models
type OfficeHour struct {
Id int
Tutor Tutor
Week int
Date
Room Room
Course Course
Info string
Active bool
Duration int
}
type OfficeHourRepository interface {
FindById(id int) (OfficeHour, error)
FindByCourse(course Course) ([]OfficeHour, error)
FindByRoom(room Room) ([]OfficeHour, error)
GetAll() ([]OfficeHour, error)
Delete(officeHour OfficeHour) error
Add(officeHour OfficeHour) error
}

14
models/room.go Normal file
View file

@ -0,0 +1,14 @@
// raum
package models
type Room struct {
Id int
Name string
MaxOccupy int
}
type RoomRepository interface {
FindByName(name string) (Room, error)
GetAll() ([]Room, error)
FindById(id int) (Room, error)
}

15
models/tutor.go Normal file
View file

@ -0,0 +1,15 @@
// tutor
package models
type Tutor struct {
Id int
Name string
Email string
}
type TutorRepository interface {
FindByEmail(Email string) ([]Tutor, error)
FindById(Id int) (Tutor, error)
GetAll() ([]Tutor, error)
Add(tutor Tutor) error
}