no empty document error for client

This commit is contained in:
Mazyar
2026-05-12 14:35:45 +03:30
parent 0a7fdd1328
commit 29b4aa50bd
2 changed files with 22 additions and 13 deletions
+5 -2
View File
@@ -401,7 +401,7 @@ func (h *TenderHandler) GetDocumentSummaries(c echo.Context) error {
// @Param id path string true "Tender ID"
// @Success 200 {object} response.APIResponse{data=TenderDocumentsResponse}
// @Failure 400 {object} response.APIResponse
// @Failure 404 {object} response.APIResponse
// @Failure 404 {object} response.APIResponse "Tender not found"
// @Failure 500 {object} response.APIResponse
// @Router /api/v1/tenders/{id}/documents [get]
func (h *TenderHandler) GetDocuments(c echo.Context) error {
@@ -412,7 +412,10 @@ func (h *TenderHandler) GetDocuments(c echo.Context) error {
documents, err := h.service.GetDocuments(c.Request().Context(), id)
if err != nil {
return response.NotFound(c, "Tender documents not found")
if errors.Is(err, orm.ErrDocumentNotFound) {
return response.NotFound(c, "Tender not found")
}
return response.InternalServerError(c, "Failed to retrieve tender documents")
}
return response.Success(c, documents, "Tender documents retrieved successfully")