27 lines
741 B
Go
27 lines
741 B
Go
|
|
package model
|
||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"gorm.io/gorm"
|
||
|
|
)
|
||
|
|
|
||
|
|
type EmptyClassroom struct {
|
||
|
|
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||
|
|
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
|
||
|
|
Semester string `json:"semester" gorm:"type:varchar(30);not null"`
|
||
|
|
Classroom string `json:"classroom" gorm:"type:varchar(60);not null"`
|
||
|
|
Weekday string `json:"weekday" gorm:"type:varchar(100)"`
|
||
|
|
Periods string `json:"periods" gorm:"type:text"`
|
||
|
|
Weeks string `json:"weeks" gorm:"type:varchar(30)"`
|
||
|
|
CreatedAt time.Time
|
||
|
|
UpdatedAt time.Time
|
||
|
|
}
|
||
|
|
|
||
|
|
func (e *EmptyClassroom) BeforeCreate(tx *gorm.DB) error {
|
||
|
|
SetUUIDIfEmpty(&e.ID)
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (EmptyClassroom) TableName() string { return "empty_classrooms" }
|