GetCheckpoints retrieves session checkpoints
(c *gin.Context)
| 304 | |
| 305 | // GetCheckpoints retrieves session checkpoints |
| 306 | func (h *SessionHandler) GetCheckpoints(c *gin.Context) { |
| 307 | ctx := c.Request.Context() |
| 308 | sessionID := c.Param("id") |
| 309 | |
| 310 | records, err := (*h.store).List(ctx, "checkpoints") |
| 311 | if err != nil { |
| 312 | c.JSON(http.StatusInternalServerError, gin.H{ |
| 313 | "success": false, |
| 314 | "error": gin.H{ |
| 315 | "code": "internal_error", |
| 316 | "message": "Failed to list checkpoints: " + err.Error(), |
| 317 | }, |
| 318 | }) |
| 319 | return |
| 320 | } |
| 321 | |
| 322 | checkpoints := make([]*CheckpointRecord, 0) |
| 323 | for _, record := range records { |
| 324 | var checkpoint CheckpointRecord |
| 325 | if err := store.DecodeValue(record, &checkpoint); err != nil { |
| 326 | continue |
| 327 | } |
| 328 | if checkpoint.SessionID == sessionID { |
| 329 | checkpoints = append(checkpoints, &checkpoint) |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | c.JSON(http.StatusOK, gin.H{ |
| 334 | "success": true, |
| 335 | "data": checkpoints, |
| 336 | }) |
| 337 | } |
| 338 | |
| 339 | // Resume resumes a session |
| 340 | func (h *SessionHandler) Resume(c *gin.Context) { |
nothing calls this directly
no test coverage detected