overalSummary nil response
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user