debug: add tenant context logging to GetProfile

This commit is contained in:
Erik Silva
2025-12-09 02:21:06 -03:00
parent 773172c63c
commit 9ece6e88fe

View File

@@ -2,6 +2,7 @@ package handlers
import (
"encoding/json"
"log"
"net/http"
"aggios-app/backend/internal/repository"
@@ -59,8 +60,13 @@ func (h *AgencyHandler) GetProfile(w http.ResponseWriter, r *http.Request) {
// Get tenant from context (set by middleware)
tenantID := r.Context().Value("tenantID")
log.Printf("DEBUG GetProfile: tenantID from context = %v (type: %T)", tenantID, tenantID)
if tenantID == nil {
http.Error(w, "Tenant not found", http.StatusUnauthorized)
log.Printf("DEBUG GetProfile: tenantID is nil, checking subdomain from context")
subdomain := r.Context().Value("subdomain")
log.Printf("DEBUG GetProfile: subdomain = %v", subdomain)
http.Error(w, "Tenant not found in context", http.StatusUnauthorized)
return
}