A deployable markdown editor that connects with your self hosted files and lets you edit in a beautiful interface
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add debug logging to UpdateLastRepo handler for troubleshooting

Added console logs to track:
- InsertUserRepo attempts and errors
- UpdateLastUsedAt attempts and results

This will help identify why user_repos table isn't being populated.

+11 -2
+11 -2
backend/internal/api/handlers/auth.go
··· 277 277 repoLink := "https://github.com/" + payload.LastRepo 278 278 now := time.Now() 279 279 280 + log.Printf("[DEBUG] Attempting to insert user_repo: userID=%d, repoName=%s, repoLink=%s", userID, payload.LastRepo, repoLink) 281 + 280 282 // Try to insert (will fail if already exists due to unique constraint, which is fine) 281 - _ = h.db.InsertUserRepo(userID, payload.LastRepo, repoLink, now) 283 + if err := h.db.InsertUserRepo(userID, payload.LastRepo, repoLink, now); err != nil { 284 + log.Printf("[DEBUG] InsertUserRepo error (may be duplicate): %v", err) 285 + } else { 286 + log.Printf("[DEBUG] InsertUserRepo succeeded for repo: %s", payload.LastRepo) 287 + } 282 288 283 289 // Update last_used_at regardless 290 + log.Printf("[DEBUG] Attempting to update last_used_at for userID=%d, repoName=%s", userID, payload.LastRepo) 284 291 if err := h.db.UpdateLastUsedAt(userID, payload.LastRepo, now); err != nil { 285 292 // Log but don't fail - the main update already succeeded 286 - log.Printf("Warning: failed to update last_used_at for repo %s: %v", payload.LastRepo, err) 293 + log.Printf("[DEBUG] Warning: failed to update last_used_at for repo %s: %v", payload.LastRepo, err) 294 + } else { 295 + log.Printf("[DEBUG] UpdateLastUsedAt succeeded for repo: %s", payload.LastRepo) 287 296 } 288 297 289 298 w.WriteHeader(http.StatusNoContent)