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:
35
internal/dto/schedule_converter.go
Normal file
35
internal/dto/schedule_converter.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"carrot_bbs/internal/model"
|
||||
)
|
||||
|
||||
func ConvertScheduleCourseToResponse(course *model.ScheduleCourse, weeks []int) *ScheduleCourseResponse {
|
||||
if course == nil {
|
||||
return nil
|
||||
}
|
||||
return &ScheduleCourseResponse{
|
||||
ID: course.ID,
|
||||
Name: course.Name,
|
||||
Teacher: course.Teacher,
|
||||
Location: course.Location,
|
||||
DayOfWeek: course.DayOfWeek,
|
||||
StartSection: course.StartSection,
|
||||
EndSection: course.EndSection,
|
||||
Weeks: weeks,
|
||||
Color: course.Color,
|
||||
}
|
||||
}
|
||||
|
||||
func ParseWeeksJSON(raw string) []int {
|
||||
if raw == "" {
|
||||
return []int{}
|
||||
}
|
||||
var weeks []int
|
||||
if err := json.Unmarshal([]byte(raw), &weeks); err != nil {
|
||||
return []int{}
|
||||
}
|
||||
return weeks
|
||||
}
|
||||
13
internal/dto/schedule_dto.go
Normal file
13
internal/dto/schedule_dto.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package dto
|
||||
|
||||
type ScheduleCourseResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Teacher string `json:"teacher,omitempty"`
|
||||
Location string `json:"location,omitempty"`
|
||||
DayOfWeek int `json:"day_of_week"`
|
||||
StartSection int `json:"start_section"`
|
||||
EndSection int `json:"end_section"`
|
||||
Weeks []int `json:"weeks"`
|
||||
Color string `json:"color,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user