feat(api): implement exam and grade synchronization modules
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.
This commit is contained in:
28
internal/model/exam.go
Normal file
28
internal/model/exam.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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" }
|
||||
Reference in New Issue
Block a user