Version:0.0.4.dev.260203

feat: 📚 完成课程导入与校验接口(赶在 token 过期前…)

- 实现课程导入接口 
- 实现课程信息校验接口 🔍
- 测试通过 🧪

fix: 🐛 修了一堆 bug,15 分钟 accessToken 默默见证了时间的流逝 😭
This commit is contained in:
LoveLosita
2026-02-03 22:05:11 +08:00
parent a59bcfbc5e
commit f554d9bd06
8 changed files with 212 additions and 4 deletions

31
backend/model/schedule.go Normal file
View File

@@ -0,0 +1,31 @@
package model
type Schedule struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
UserID int `gorm:"column:user_id;index" json:"user_id"`
Type string `gorm:"type:enum('course','task');comment:'course / task'" json:"type"`
RelID int `gorm:"column:rel_id;comment:'关联 course_id 或 task_item_id'" json:"rel_id"`
CanBeEmbedded bool `gorm:"column:can_be_embedded;comment:'是否允许嵌入水课'" json:"can_be_embedded"`
EmbeddedTaskID *uint `gorm:"column:embedded_task_id;comment:'若为水课嵌入记录任务ID'" json:"embedded_task_id"`
Week int `gorm:"column:week" json:"week"`
DayOfWeek int `gorm:"column:day_of_week" json:"day_of_week"`
Sections string `gorm:"type:varchar(255)" json:"sections"`
Status string `gorm:"type:enum('normal','interrupted');default:'normal'" json:"status"`
}
type UserImportCoursesRequest struct {
Courses []UserCheckCourseRequest `json:"courses"`
}
type UserCheckCourseRequest struct {
CourseName string `json:"course_name"`
Location string `json:"location"`
IsAllowTasks bool `json:"is_allow_tasks"`
Arrangements []struct {
StartWeek int `json:"start_week"`
EndWeek int `json:"end_week"`
DayOfWeek int `json:"day_of_week"`
StartSection int `json:"start_section"`
EndSection int `json:"end_section"`
} `json:"arrangements"`
}