Version:0.0.7.dev.260204

feat:  新增获取完整任务类与修改任务类接口并完成测试

- 新增获取完整任务类接口 📋
  - 实现创建任务类的逆向数据转换函数 🔄
  - 工程量较大,涉及完整数据结构还原 🏗️

- 新增修改任务类接口 ✏️
  - 调整 service 层 AddOrUpdateTaskClass 函数逻辑
  - 复用创建任务类的大部分实现,并通过 method 区分创建/更新操作 ♻️

- 更新 dao 层操作逻辑 🗄️
  - 增加防止越权修改其它用户任务类的机制 🔒

- 两个接口代码量巨大,但均已测试通过 🧪💪
This commit is contained in:
LoveLosita
2026-02-04 22:08:58 +08:00
parent eb521a4c35
commit 1bcbd41bec
7 changed files with 269 additions and 16 deletions

View File

@@ -17,10 +17,11 @@ type TaskClass struct {
StartDate *time.Time `gorm:"column:start_date"`
EndDate *time.Time `gorm:"column:end_date"`
//section 3
TotalSlots *int `gorm:"column:total_slots;comment:分配的总节数"`
AllowFillerCourse *bool `gorm:"column:allow_filler_course;default:true"`
Strategy *string `gorm:"column:strategy;type:enum('steady','rapid')"`
ExcludedSlots *string `gorm:"column:excluded_slots;type:json;comment:不想要的时段切片"`
TotalSlots *int `gorm:"column:total_slots;comment:分配的总节数"`
AllowFillerCourse *bool `gorm:"column:allow_filler_course;default:true"`
Strategy *string `gorm:"column:strategy;type:enum('steady','rapid')"`
ExcludedSlots *string `gorm:"column:excluded_slots;type:json;comment:不想要的时段切片"`
Items []TaskClassItem `gorm:"foreignKey:CategoryID;references:ID"` // 一对多关联:一个 TaskClass 有多个 TaskClassItem
}
// TableName 设定 TaskClass 的表名为 task_classes