fixed PR issue

This commit is contained in:
2026-05-11 23:56:45 +02:00
parent edf3c9824e
commit 35afa8d8f1
15 changed files with 88 additions and 217 deletions
+2 -13
View File
@@ -6,7 +6,6 @@ import (
"strconv"
"time"
"github.com/go-chi/chi/v5"
"xorm.io/xorm"
gitdomain "github.com/forgeo/forgebucket/internal/domain/git"
@@ -69,23 +68,13 @@ type TimelineEvent struct {
//
// GET /api/v1/repos/:owner/:repo/timeline?limit=60
func (h *TimelineHandler) GetTimeline(w http.ResponseWriter, r *http.Request) {
owner := chi.URLParam(r, "owner")
repoName := chi.URLParam(r, "repo")
limit := 60
if l, err := strconv.Atoi(r.URL.Query().Get("limit")); err == nil && l > 0 && l <= 200 {
limit = l
}
// ── Resolve repo ──────────────────────────────────────────────────────────
var u models.User
if found, _ := h.db.Where("username = ?", owner).Get(&u); !found {
jsonError(w, "repository not found", http.StatusNotFound)
return
}
var repo models.Repository
if found, _ := h.db.Where("owner_id = ? AND name = ?", u.ID, repoName).Get(&repo); !found {
jsonError(w, "repository not found", http.StatusNotFound)
repo, ok := resolveRepo(h.db, w, r)
if !ok {
return
}