Skip to content

Commit

Permalink
update schema - todo: gql hanging on query
Browse files Browse the repository at this point in the history
  • Loading branch information
Forfold committed Aug 23, 2023
1 parent e44e603 commit b21f911
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 124 deletions.
15 changes: 4 additions & 11 deletions calsub/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@ func (s *Store) ServeICalData(w http.ResponseWriter, req *http.Request) {
return
}

shifts, err := s.oc.HistoryBySchedule(ctx, info.ScheduleID.String(), info.Now, info.Now.AddDate(1, 0, 0))
var userIDs []string
userIDs = append(userIDs, info.UserID.String())
shifts, err := s.oc.HistoryBySchedule(ctx, info.ScheduleID.String(), info.Now, info.Now.AddDate(1, 0, 0), userIDs)
if errutil.HTTPError(ctx, w, err) {
return
}

// filter out other users
filtered := shifts[:0]
for _, s := range shifts {
if s.UserID != info.UserID.String() {
continue
}
filtered = append(filtered, s)
}

var subCfg SubscriptionConfig
err = json.Unmarshal(info.Config, &subCfg)
if errutil.HTTPError(ctx, w, err) {
Expand All @@ -51,7 +44,7 @@ func (s *Store) ServeICalData(w http.ResponseWriter, req *http.Request) {
ApplicationName: cfg.ApplicationName(),
ScheduleID: info.ScheduleID,
ScheduleName: info.ScheduleName,
Shifts: filtered,
Shifts: shifts,
ReminderMinutes: subCfg.ReminderMinutes,
Version: version.GitVersion(),
GeneratedAt: info.Now,
Expand Down
Loading

0 comments on commit b21f911

Please sign in to comment.