Datenbanken, erster Versuch
This commit is contained in:
parent
b26544756a
commit
766aedf22d
21 changed files with 678 additions and 320 deletions
14
models/course.go
Normal file
14
models/course.go
Normal 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
10
models/date.go
Normal 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
23
models/officeHour.go
Normal 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
14
models/room.go
Normal 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
15
models/tutor.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue