package schedule_storage import ( "encoding/json" "log" "os" "pinned_message/internal/models" ) type ScheduleStorage struct { filepath string } func NewScheduleStorage( filepath string, ) *ScheduleStorage { return &ScheduleStorage{ filepath: filepath, } } func (s *ScheduleStorage) SaveSchedule(days []*models.Day) error { data, err := json.Marshal(days) if err != nil { return err } if err := os.WriteFile(s.filepath, data, 0x777); err != nil { return err } log.Printf("save story to: %s", s.filepath) return nil }