Skip to content

Commit

Permalink
fix wrong return values
Browse files Browse the repository at this point in the history
  • Loading branch information
robertchoi80 committed Feb 15, 2024
1 parent 2fa5851 commit f1b7b0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/repository/app-serve-app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (r *AppServeAppRepository) GetAppServeAppById(appId string) (*domain.AppSer
return nil, res.Error
}
if res.RowsAffected == 0 {
return nil, nil, fmt.Errorf("No app with ID %s", appId)
return nil, fmt.Errorf("No app with ID %s", appId)
}

// Populate tasks into app object
Expand Down Expand Up @@ -176,7 +176,7 @@ func (r *AppServeAppRepository) GetAppServeAppTaskById(taskId string) (*domain.A
return nil, nil, res.Error
}
if res.RowsAffected == 0 {
return nil, nil, fmt.Errorf("Couldn't find app with ID %s associated with task %s", appId, taskId)
return nil, nil, fmt.Errorf("Couldn't find app with ID %s associated with task %s", app.ID, taskId)
}

return &task, &app, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ func SetupRouter(db *gorm.DB, argoClient argowf.ArgoClient, kc keycloak.IKeycloa

appServeAppHandler := delivery.NewAppServeAppHandler(usecase.NewAppServeAppUsecase(repoFactory, argoClient))
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps", customMiddleware.Handle(internalApi.CreateAppServeApp, http.HandlerFunc(appServeAppHandler.CreateAppServeApp))).Methods(http.MethodPost)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps", customMiddleware.Handle(internalApi.GetAppServeApps, http.HandlerFunc(appServeAppHandler.GetAppServeApps))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/projects/{projectId}/app-serve-apps", customMiddleware.Handle(internalApi.GetAppServeApps, http.HandlerFunc(appServeAppHandler.GetAppServeApps))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps/count", customMiddleware.Handle(internalApi.GetNumOfAppsOnStack, http.HandlerFunc(appServeAppHandler.GetNumOfAppsOnStack))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps/{appId}", customMiddleware.Handle(internalApi.GetAppServeApps, http.HandlerFunc(appServeAppHandler.GetAppServeApp))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/projects/{projectId}/app-serve-apps/{appId}", customMiddleware.Handle(internalApi.GetAppServeApps, http.HandlerFunc(appServeAppHandler.GetAppServeApp))).Methods(http.MethodGet)
// TODO: To be implemented
// r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps/{appId}/tasks/{taskId}", customMiddleware.Handle(http.HandlerFunc(appServeAppHandler.GetAppServeAppTask))).Methods(http.MethodGet)
r.Handle(API_PREFIX+API_VERSION+"/organizations/{organizationId}/app-serve-apps/{appId}/latest-task", customMiddleware.Handle(internalApi.GetAppServeAppLatestTask, http.HandlerFunc(appServeAppHandler.GetAppServeAppLatestTask))).Methods(http.MethodGet)
Expand Down

0 comments on commit f1b7b0a

Please sign in to comment.