feat(sync): plumb context_text through SaveProgress and sync queue

- SaveProgressRequest: add ContextText field
- SaveProgress: carry existing ContextText from DB, overwrite when provided
- ProgressUpdate: add ContextText field for checkpoint sync
- SyncQueueProcessor: serialize/deserialize context_text in sync data
- buildProgressSnapshot: include context_text in snapshot data
This commit is contained in:
2026-06-02 19:44:38 -04:00
parent c82f20c3f2
commit b2b1804aa3
2 changed files with 39 additions and 20 deletions
+7
View File
@@ -48,6 +48,7 @@ type ProgressUpdate struct {
UserID pgtype.UUID
Percentage float64
Epubcfi *string
ContextText *string
Chapter *int
Character *int64
Page *int
@@ -122,6 +123,9 @@ func (p *SyncQueueProcessor) enqueueProgressUpdate(ctx context.Context, update *
if update.Epubcfi != nil {
syncData["epubcfi"] = *update.Epubcfi
}
if update.ContextText != nil {
syncData["context_text"] = *update.ContextText
}
if update.Chapter != nil {
syncData["chapter"] = *update.Chapter
}
@@ -331,6 +335,9 @@ func (p *SyncQueueProcessor) syncProgress(ctx context.Context, userID pgtype.UUI
if v, ok := syncData["epubcfi"].(string); ok {
req.Epubcfi = &v
}
if v, ok := syncData["context_text"].(string); ok {
req.ContextText = &v
}
if v, ok := syncData["chapter"].(float64); ok {
ch := int(v)
req.Chapter = &ch