Fixed wrong return model returned in EntityController methods

This commit is contained in:
2025-12-25 14:55:58 +01:00
parent cc93a76546
commit 26d0561c3b

View File

@@ -95,7 +95,7 @@ public class EntityController : ControllerBase
if (returnEmbeddings && !returnModels) if (returnEmbeddings && !returnModels)
{ {
_logger.LogError("Invalid request for {searchdomain} - embeddings return requested but without models - not possible!", [searchdomain]); _logger.LogError("Invalid request for {searchdomain} - embeddings return requested but without models - not possible!", [searchdomain]);
return Ok(new EntityQueryResults() {Results = [], Success = false, Message = "Invalid request" }); return Ok(new EntityListResults() {Results = [], Success = false, Message = "Invalid request" });
} }
Searchdomain searchdomain_; Searchdomain searchdomain_;
try try
@@ -104,11 +104,11 @@ public class EntityController : ControllerBase
} catch (SearchdomainNotFoundException) } catch (SearchdomainNotFoundException)
{ {
_logger.LogError("Unable to retrieve the searchdomain {searchdomain} - it likely does not exist yet", [searchdomain]); _logger.LogError("Unable to retrieve the searchdomain {searchdomain} - it likely does not exist yet", [searchdomain]);
return Ok(new EntityQueryResults() {Results = [], Success = false, Message = "Searchdomain not found" }); return Ok(new EntityListResults() {Results = [], Success = false, Message = "Searchdomain not found" });
} catch (Exception ex) } catch (Exception ex)
{ {
_logger.LogError("Unable to retrieve the searchdomain {searchdomain} - {ex.Message} - {ex.StackTrace}", [searchdomain, ex.Message, ex.StackTrace]); _logger.LogError("Unable to retrieve the searchdomain {searchdomain} - {ex.Message} - {ex.StackTrace}", [searchdomain, ex.Message, ex.StackTrace]);
return Ok(new EntityQueryResults() {Results = [], Success = false, Message = "Unable to retrieve the searchdomain - it likely exists, but some other error happened." }); return Ok(new EntityListResults() {Results = [], Success = false, Message = "Unable to retrieve the searchdomain - it likely exists, but some other error happened." });
} }
EntityListResults entityListResults = new() {Results = [], Success = true}; EntityListResults entityListResults = new() {Results = [], Success = true};
foreach (Entity entity in searchdomain_.entityCache) foreach (Entity entity in searchdomain_.entityCache)
@@ -157,11 +157,11 @@ public class EntityController : ControllerBase
} catch (SearchdomainNotFoundException) } catch (SearchdomainNotFoundException)
{ {
_logger.LogError("Unable to retrieve the searchdomain {searchdomain} - it likely does not exist yet", [searchdomain]); _logger.LogError("Unable to retrieve the searchdomain {searchdomain} - it likely does not exist yet", [searchdomain]);
return Ok(new EntityQueryResults() {Results = [], Success = false, Message = "Searchdomain not found" }); return Ok(new EntityDeleteResults() {Success = false, Message = "Searchdomain not found" });
} catch (Exception ex) } catch (Exception ex)
{ {
_logger.LogError("Unable to retrieve the searchdomain {searchdomain} - {ex.Message} - {ex.StackTrace}", [searchdomain, ex.Message, ex.StackTrace]); _logger.LogError("Unable to retrieve the searchdomain {searchdomain} - {ex.Message} - {ex.StackTrace}", [searchdomain, ex.Message, ex.StackTrace]);
return Ok(new EntityQueryResults() {Results = [], Success = false, Message = "Unable to retrieve the searchdomain - it likely exists, but some other error happened." }); return Ok(new EntityDeleteResults() {Success = false, Message = "Unable to retrieve the searchdomain - it likely exists, but some other error happened." });
} }
Entity? entity_ = SearchdomainHelper.CacheGetEntity(searchdomain_.entityCache, entityName); Entity? entity_ = SearchdomainHelper.CacheGetEntity(searchdomain_.entityCache, entityName);