/
schedule.go
39 lines (34 loc) · 1.13 KB
/
schedule.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package types
import "github.com/jinzhu/gorm"
// Schedule The schedule object containing all the schedule slots.
type Schedule struct {
Slots []*ScheduleSlot `json:"slots"`
}
/*
ScheduleSlot Contains information about a schedule slot, like times, room
and subject.
*/
type ScheduleSlot struct {
//ID int `gorm:"AUTO_INCREMENT;primary_key;not_null;unique_index"`
Room string `json:"room" gorm:"text;not_null"`
// Day is the days after the start of the week (0 = Sunday)
Day int `json:"day" gorm:"-"`
// Start is seconds after the start of day.
Start int64 `json:"start" gorm:"numeric;not_null"`
// End is seconds after the start of day.
End int64 `json:"end" gorm:"numeric;not_null"`
Title string `json:"title" gorm:"text;not_null"`
Host string `json:"host" gorm:"text;not_null"`
Semester string `json:"semester" gorm:"-"`
DayNum int `json:"-" gorm:"-"`
MonthNum int `json:"-" gorm:"-"`
IsExam bool `json:"isExam" gorm:"boolean;not_null"`
}
type DBScheduleSlot struct {
gorm.Model `json:"db_info"`
ScheduleSlot
}
type ScheduleNow struct {
Now *ScheduleSlot `json:"now"`
Next []*ScheduleSlot `json:"next"`
}