2022-08-29 20:58:19 +00:00
|
|
|
// officeHour
|
|
|
|
package models
|
|
|
|
|
|
|
|
type OfficeHour struct {
|
|
|
|
Id int
|
|
|
|
Tutor Tutor
|
|
|
|
Date
|
2022-09-27 14:40:47 +00:00
|
|
|
Room
|
|
|
|
Course
|
|
|
|
RoomName string
|
2022-08-29 20:58:19 +00:00
|
|
|
Info string
|
|
|
|
Active bool
|
|
|
|
Duration int
|
|
|
|
}
|
|
|
|
|
|
|
|
type OfficeHourRepository interface {
|
|
|
|
FindById(id int) (OfficeHour, error)
|
2022-08-31 20:49:14 +00:00
|
|
|
FindByCourse(course Course, activeOnly bool) ([]OfficeHour, error)
|
|
|
|
FindByRoom(room Room, activatedOnly bool) ([]OfficeHour, error)
|
|
|
|
GetAll(activatedOnly bool) ([]OfficeHour, error)
|
2022-08-29 20:58:19 +00:00
|
|
|
Delete(officeHour OfficeHour) error
|
2022-09-05 15:55:08 +00:00
|
|
|
Add(officeHour OfficeHour) (int, error)
|
2022-09-07 16:26:05 +00:00
|
|
|
AllowedAt(date Date, duration int, room Room, activeOnly bool) (bool, error)
|
2022-08-29 20:58:19 +00:00
|
|
|
}
|
2022-09-07 19:48:40 +00:00
|
|
|
|
|
|
|
func (officeHour OfficeHour) EndDate() Date {
|
|
|
|
return GetEndDate(officeHour.Date, officeHour.Duration, false)
|
|
|
|
}
|