Skip to content

Commit

Permalink
add app list fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Apr 16, 2024
1 parent 7fee6fd commit 926f4cd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion routes/staff/endpoints/get_app_list/route.go
@@ -1,6 +1,7 @@
package get_app_list

import (
"errors"
"net/http"
"popplio/db"
"popplio/routes/staff/assets"
Expand Down Expand Up @@ -88,9 +89,17 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {

app, err := pgx.CollectRows(row, pgx.RowToStructByName[types.AppResponse])

if errors.Is(err, pgx.ErrNoRows) {
return uapi.HttpResponse{
Json: types.AppListResponse{
Apps: []types.AppResponse{},
},
}
}

if err != nil {
state.Logger.Error("Failed to fetch application list [collection]", zap.Error(err))
return uapi.DefaultResponse(http.StatusNotFound)
return uapi.DefaultResponse(http.StatusInternalServerError)
}

for i := range app {
Expand Down

0 comments on commit 926f4cd

Please sign in to comment.