fix: remove duplicate tenant service method and handle not found

This commit is contained in:
Erik Silva
2025-12-09 03:05:38 -03:00
parent 9e80aa1d70
commit 1ea381224d
2 changed files with 4 additions and 10 deletions

View File

@@ -56,15 +56,14 @@ func (h *TenantHandler) CheckExists(w http.ResponseWriter, r *http.Request) {
tenant, err := h.tenantService.GetBySubdomain(subdomain)
if err != nil {
if err == service.ErrTenantNotFound {
http.NotFound(w, r)
return
}
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
}
if tenant == nil {
http.NotFound(w, r)
return
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
}