overalSummary nil response

This commit is contained in:
Mazyar
2026-05-12 12:25:09 +03:30
parent 7c42b343ce
commit 0a7fdd1328
3 changed files with 77 additions and 64 deletions
+9 -2
View File
@@ -7,6 +7,7 @@ import (
"strconv"
"time"
"tm/pkg/logger"
orm "tm/pkg/mongo"
"tm/pkg/response"
"github.com/asaskevich/govalidator"
@@ -477,11 +478,14 @@ func (h *TenderHandler) GetAISummary(c echo.Context) error {
summary, err := h.service.GetAISummary(c.Request().Context(), id)
if err != nil {
if errors.Is(err, orm.ErrDocumentNotFound) {
return response.NotFound(c, "Tender not found")
}
h.logger.Error("Failed to get AI summary", map[string]interface{}{
"tender_id": id,
"error": err.Error(),
})
return response.NotFound(c, err.Error())
return response.InternalServerError(c, "Failed to retrieve AI summary")
}
return response.Success(c, summary, "AI summary retrieved successfully")
@@ -574,11 +578,14 @@ func (h *TenderHandler) GetPublicAISummary(c echo.Context) error {
summary, err := h.service.GetAISummary(c.Request().Context(), id)
if err != nil {
if errors.Is(err, orm.ErrDocumentNotFound) {
return response.NotFound(c, "Tender not found")
}
h.logger.Error("Failed to get AI summary", map[string]interface{}{
"tender_id": id,
"error": err.Error(),
})
return response.NotFound(c, err.Error())
return response.InternalServerError(c, "Failed to retrieve AI summary")
}
return response.Success(c, summary, "AI summary retrieved successfully")