diff --git a/internal/controllers/admins.go b/internal/controllers/admins.go deleted file mode 100644 index 0e63510..0000000 --- a/internal/controllers/admins.go +++ /dev/null @@ -1,40 +0,0 @@ -package controllers - -import ( - "net/http" - - "github.com/sirupsen/logrus" - - "github.com/cyverse/qms/internal/model" - "github.com/labstack/echo/v4" -) - -func (s Server) GetAllActiveSubscriptions(ctx echo.Context) error { - log := log.WithFields(logrus.Fields{"context": "getting all active user plans"}) - - context := ctx.Request().Context() - - var subscriptions []model.Subscription - err := s.GORMDB.WithContext(context). - Preload("User"). - Preload("Plan"). - Preload("Plan.PlanQuotaDefaults"). - Preload("Plan.PlanQuotaDefaults.ResourceType"). - Preload("Quotas"). - Preload("Quotas.ResourceType"). - Preload("Usages"). - Preload("Usages.ResourceType"). - Preload("PlanRate"). - Where( - s.GORMDB.WithContext(context). - Where("CURRENT_TIMESTAMP BETWEEN subscriptions.effective_start_date AND subscriptions.effective_end_date"). - Or("CURRENT_TIMESTAMP > subscriptions.effective_start_date AND subscriptions.effective_end_date IS NULL")). - Find(&subscriptions).Error - if err != nil { - return model.Error(ctx, err.Error(), http.StatusInternalServerError) - } - - log.Debug("got user plans from the database") - - return model.Success(ctx, subscriptions, http.StatusOK) -} diff --git a/server/router.go b/server/router.go index 4ffe50f..ac76248 100644 --- a/server/router.go +++ b/server/router.go @@ -45,9 +45,6 @@ func registerUserEndpoints(users *echo.Group, s *controllers.Server) { // Lists all of the users. users.GET("", s.GetAllUsers) - // Lists all of the active user plans. - users.GET("/all_active_users", s.GetAllActiveSubscriptions) - // Adds a new user to the database. users.PUT("/:username", s.AddUser)