package git import ( "log/slog" "net/http" "git.gabrielgio.me/cerrado/pkg/service" "git.gabrielgio.me/cerrado/templates" ) type ( GitHandler struct { gitService gitService } gitService interface { ListRepositories() ([]*service.Repository, error) } ) func NewGitHandler(gitService gitService) *GitHandler { return &GitHandler{ gitService: gitService, } } func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { repos, err := g.gitService.ListRepositories() if err != nil { slog.Error("Error listing repo", "error", err) return } gitList := &templates.GitListPage{repos} templates.WritePageTemplate(w, gitList) } func (g *GitHandler) Item(w http.ResponseWriter, _ *http.Request) { gitList := &templates.GitItemPage{} templates.WritePageTemplate(w, gitList) }