diff --git a/internal/handlers/sync.go b/internal/handlers/sync.go index 3c0366f..0bb7893 100644 --- a/internal/handlers/sync.go +++ b/internal/handlers/sync.go @@ -232,6 +232,10 @@ func (h *SyncHandler) SyncPricelists(c *gin.Context) { } h.localDB.AppendSyncLog("pricelists", "ok", "", synced, startTime, time.Since(startTime).Milliseconds()) + if _, err := h.syncService.PullPartnumberBooks(); err != nil { + slog.Warn("partnumber books pull failed after pricelist sync", "error", err) + } + c.JSON(http.StatusOK, SyncResultResponse{ Success: true, Message: "Pricelists synced successfully", @@ -352,6 +356,10 @@ func (h *SyncHandler) SyncAll(c *gin.Context) { } h.localDB.AppendSyncLog("pricelists", "ok", "", pricelistsSynced, plNow, time.Since(plNow).Milliseconds()) + if _, err := h.syncService.PullPartnumberBooks(); err != nil { + slog.Warn("partnumber books pull failed during full sync", "error", err) + } + projectsResult, err := h.syncService.ImportProjectsToLocal() if err != nil { slog.Error("project import failed during full sync", "error", err) diff --git a/internal/services/sync/worker.go b/internal/services/sync/worker.go index 7bc9957..1f6b1e4 100644 --- a/internal/services/sync/worker.go +++ b/internal/services/sync/worker.go @@ -100,5 +100,10 @@ func (w *Worker) runSync() { return } + // Pull partnumber books together with pricelists + if _, err := w.service.PullPartnumberBooks(); err != nil { + w.logger.Warn("background sync: failed to pull partnumber books", "error", err) + } + w.logger.Info("background sync cycle completed") } diff --git a/web/templates/partnumber_books.html b/web/templates/partnumber_books.html index 82c4fc2..0ebc2c8 100644 --- a/web/templates/partnumber_books.html +++ b/web/templates/partnumber_books.html @@ -22,20 +22,17 @@
-
+
-