dev
This commit is contained in:
parent
07feb21880
commit
458cc25ded
@ -62,6 +62,11 @@ func GetAllTarget(targetService model.TargetService) echo.HandlerFunc {
|
|||||||
return request.JSON(http.StatusInternalServerError, err.Error())
|
return request.JSON(http.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(targets) == 0 {
|
||||||
|
slog.Error("target not found")
|
||||||
|
return request.JSON(http.StatusInternalServerError, "target not found")
|
||||||
|
}
|
||||||
|
|
||||||
return request.JSON(http.StatusOK, targets)
|
return request.JSON(http.StatusOK, targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"donat-widget/internal/model"
|
"donat-widget/internal/model"
|
||||||
"donat-widget/internal/model/sql"
|
"donat-widget/internal/model/sql"
|
||||||
"errors"
|
|
||||||
"github.com/georgysavva/scany/v2/pgxscan"
|
"github.com/georgysavva/scany/v2/pgxscan"
|
||||||
"github.com/jackc/pgx/v5"
|
"github.com/jackc/pgx/v5"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
@ -59,9 +58,6 @@ func (targetRepo *RepoTarget) GetAllTarget(
|
|||||||
slog.Error(err.Error())
|
slog.Error(err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(targets) == 0 {
|
|
||||||
return nil, errors.New("donat not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
return targets, nil
|
return targets, nil
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user