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.
36 lines
723 B
Go
36 lines
723 B
Go
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
|
|
}
|