GetSyncState responds with a sync fragment
(w http.ResponseWriter, r *http.Request)
| 291 | |
| 292 | // GetSyncState responds with a sync fragment |
| 293 | func (s *Sync) GetSyncState(w http.ResponseWriter, r *http.Request) { |
| 294 | user := context.User(r.Context()) |
| 295 | if user == nil { |
| 296 | middleware.DoError(w, "No authenticated user found", nil, http.StatusInternalServerError) |
| 297 | return |
| 298 | } |
| 299 | |
| 300 | response := GetSyncStateResp{ |
| 301 | FullSyncBefore: int(user.FullSyncBefore), |
| 302 | MaxUSN: user.MaxUSN, |
| 303 | // TODO: exposing server time means we probably shouldn't seed random generator with time? |
| 304 | CurrentTime: s.app.Clock.Now().Unix(), |
| 305 | } |
| 306 | |
| 307 | log.WithFields(log.Fields{ |
| 308 | "user_id": user.ID, |
| 309 | "resp": response, |
| 310 | }).Info("getting sync state") |
| 311 | |
| 312 | respondJSON(w, http.StatusOK, response) |
| 313 | } |
nothing calls this directly
no test coverage detected