Add new functionality for managing and synchronizing academic grades and exam schedules. This includes new models, repositories, services, and HTTP handlers, along with updated gRPC definitions and dependency injection configuration. Additionally, improve the reliability of unread message count tracking by implementing an atomic Lua script for Redis operations in the conversation cache.
29 lines
833 B
Go
29 lines
833 B
Go
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" }
|