feat(schedule): add course table screens and navigation
Add complete schedule functionality including: - Schedule screen with weekly course table view - Course detail screen with transparent modal presentation - New ScheduleStack navigator integrated into main tab bar - Schedule service for API interactions - Type definitions for course entities Also includes bug fixes for group invite/request handlers to include required groupId parameter.
This commit is contained in:
@@ -143,6 +143,9 @@ func autoMigrate(db *gorm.DB) error {
|
||||
|
||||
// 自定义表情
|
||||
&UserSticker{},
|
||||
|
||||
// 课表
|
||||
&ScheduleCourse{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
35
internal/model/schedule_course.go
Normal file
35
internal/model/schedule_course.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ScheduleCourse 用户课表课程
|
||||
type ScheduleCourse struct {
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
UserID string `json:"user_id" gorm:"type:varchar(36);index;not null"`
|
||||
Name string `json:"name" gorm:"type:varchar(120);not null"`
|
||||
Teacher string `json:"teacher" gorm:"type:varchar(80)"`
|
||||
Location string `json:"location" gorm:"type:varchar(120)"`
|
||||
DayOfWeek int `json:"day_of_week" gorm:"index;not null"` // 0=周一, 6=周日
|
||||
StartSection int `json:"start_section" gorm:"not null"`
|
||||
EndSection int `json:"end_section" gorm:"not null"`
|
||||
Weeks string `json:"weeks" gorm:"type:text;not null"` // JSON 数组字符串
|
||||
Color string `json:"color" gorm:"type:varchar(20)"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (s *ScheduleCourse) BeforeCreate(tx *gorm.DB) error {
|
||||
if s.ID == "" {
|
||||
s.ID = uuid.New().String()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ScheduleCourse) TableName() string {
|
||||
return "schedule_courses"
|
||||
}
|
||||
Reference in New Issue
Block a user