- Use Google Distroless images for all services (Go & Node.js). - Standardize documentation with [PROJECT-NAME].md. - Add .dockerignore and .gitignore to all projects. - Remove docker-compose.yml in favor of docker run instructions. - Fix Go version and dependency issues in observability, repo-integrations, and security-governance. - Add Podman support (fully qualified image names). - Update Dashboard to use Node.js static server for Distroless compatibility.
29 lines
781 B
Go
29 lines
781 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
func (a *API) ListRepositoriesHandler(w http.ResponseWriter, r *http.Request) {
|
|
tenantIDStr := r.URL.Query().Get("tenant_id")
|
|
tenantID, err := uuid.Parse(tenantIDStr)
|
|
if err != nil {
|
|
http.Error(w, "Invalid tenant_id", http.StatusBadRequest)
|
|
return
|
|
}
|
|
|
|
repos, err := a.queries.ListRepositoriesByTenant(r.Context(), pgtype.UUID{Bytes: tenantID, Valid: true})
|
|
if err != nil {
|
|
http.Error(w, "Failed to list repositories", http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
if err := json.NewEncoder(w).Encode(repos); err != nil {
|
|
http.Error(w, "Failed to encode response", http.StatusInternalServerError)
|
|
}
|
|
}
|