feat(runner): implement empty classroom sync functionality
Some checks failed
Build Backend / build (push) Successful in 2m22s
Build Backend / build-docker (push) Failing after 3m3s

Add support for fetching and synchronizing empty classroom data. This includes new protobuf definitions for task payloads and results, database models, repository, service, and HTTP handlers.

- Add `TASK_TYPE_GET_EMPTY_CLASSROOM` to `TaskType` enum
- Implement `EmptyClassroom` model and auto-migration
- Add `EmptyClassroomHandler` with `GET` and `POST /sync` routes
- Implement `EmptyClassroomSyncService` and `EmptyClassroomRepository`
- Update dependency injection with wire sets
This commit is contained in:
2026-05-31 21:29:45 +08:00
parent 2084473fb5
commit 9356cb6876
13 changed files with 3007 additions and 48 deletions

View File

@@ -0,0 +1,26 @@
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" }

View File

@@ -193,6 +193,7 @@ func autoMigrate(db *gorm.DB) error {
&Grade{},
&GpaSummary{},
&Exam{},
&EmptyClassroom{},
// 用户活跃相关
&UserActiveLog{},