package model import ( "time" "gorm.io/gorm" ) type Exam 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"` CourseName string `json:"course_name" gorm:"type:varchar(120);not null"` ExamType string `json:"exam_type" gorm:"type:varchar(30)"` Date string `json:"date" gorm:"type:varchar(20)"` Time string `json:"time" gorm:"type:varchar(30)"` Week string `json:"week" gorm:"type:varchar(20)"` Weekday string `json:"weekday" gorm:"type:varchar(10)"` CreatedAt time.Time UpdatedAt time.Time } func (e *Exam) BeforeCreate(tx *gorm.DB) error { SetUUIDIfEmpty(&e.ID) return nil } func (Exam) TableName() string { return "exams" }