diff --git a/backend/pkg/api/data_access/app.go b/backend/pkg/api/data_access/app.go index ee80d2f5a..812549b1a 100644 --- a/backend/pkg/api/data_access/app.go +++ b/backend/pkg/api/data_access/app.go @@ -6,7 +6,6 @@ import ( "fmt" "time" - "github.com/gobitfly/beaconchain/pkg/api/enums" t "github.com/gobitfly/beaconchain/pkg/api/types" "github.com/gobitfly/beaconchain/pkg/commons/utils" "github.com/gobitfly/beaconchain/pkg/userservice" @@ -21,7 +20,7 @@ type AppRepository interface { AddMobileNotificationToken(userID uint64, deviceID, notifyToken string) error GetAppSubscriptionCount(userID uint64) (uint64, error) AddMobilePurchase(tx *sql.Tx, userID uint64, paymentDetails t.MobileSubscription, verifyResponse *userservice.VerifyResponse, extSubscriptionId string) error - GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64, environment enums.Environment) (*t.MobileAppBundleStats, error) + GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64) (*t.MobileAppBundleStats, error) IncrementBundleDeliveryCount(ctx context.Context, bundleVerison uint64) error } @@ -110,9 +109,9 @@ func (d *DataAccessService) AddMobilePurchase(tx *sql.Tx, userID uint64, payment return err } -func (d *DataAccessService) GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64, environment enums.Environment) (*t.MobileAppBundleStats, error) { +func (d *DataAccessService) GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64) (*t.MobileAppBundleStats, error) { // @TODO data access - return d.dummy.GetLatestBundleForNativeVersion(ctx, nativeVersion, environment) + return d.dummy.GetLatestBundleForNativeVersion(ctx, nativeVersion) } func (d *DataAccessService) IncrementBundleDeliveryCount(ctx context.Context, bundleVerison uint64) error { diff --git a/backend/pkg/api/data_access/dummy.go b/backend/pkg/api/data_access/dummy.go index eed807fcd..36247ea76 100644 --- a/backend/pkg/api/data_access/dummy.go +++ b/backend/pkg/api/data_access/dummy.go @@ -11,7 +11,6 @@ import ( "github.com/go-faker/faker/v4" "github.com/go-faker/faker/v4/pkg/options" "github.com/gobitfly/beaconchain/pkg/api/enums" - "github.com/gobitfly/beaconchain/pkg/api/types" t "github.com/gobitfly/beaconchain/pkg/api/types" "github.com/gobitfly/beaconchain/pkg/userservice" "github.com/shopspring/decimal" @@ -637,12 +636,12 @@ func (d *DummyService) GetRocketPoolOverview(ctx context.Context) (*t.RocketPool return getDummyStruct[t.RocketPoolData]() } -func (d *DummyService) GetHealthz(ctx context.Context, showAll bool) types.HealthzData { - r, _ := getDummyData[types.HealthzData]() +func (d *DummyService) GetHealthz(ctx context.Context, showAll bool) t.HealthzData { + r, _ := getDummyData[t.HealthzData]() return r } -func (d *DummyService) GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64, environment enums.Environment) (*t.MobileAppBundleStats, error) { +func (d *DummyService) GetLatestBundleForNativeVersion(ctx context.Context, nativeVersion uint64) (*t.MobileAppBundleStats, error) { return getDummyStruct[t.MobileAppBundleStats]() } diff --git a/backend/pkg/api/enums/enums.go b/backend/pkg/api/enums/enums.go index f8a8b48cf..a0bd6997d 100644 --- a/backend/pkg/api/enums/enums.go +++ b/backend/pkg/api/enums/enums.go @@ -268,38 +268,3 @@ func (c ChartAggregation) Duration(secondsPerEpoch uint64) time.Duration { return 0 } } - -// ---------------- -// Environment - -type Environment int - -var _ EnumFactory[Environment] = Environment(0) - -const ( - EnvironmentProduction Environment = iota - EnvironmentStaging -) - -func (e Environment) Int() int { - return int(e) -} - -func (Environment) NewFromString(s string) Environment { - switch s { - case "production", "prod", "": - return EnvironmentProduction - case "staging": - return EnvironmentStaging - default: - return Environment(-1) - } -} - -var Environments = struct { - Production Environment - Staging Environment -}{ - EnvironmentProduction, - EnvironmentStaging, -} diff --git a/backend/pkg/api/handlers/internal.go b/backend/pkg/api/handlers/internal.go index f4cf3f6b2..d111ab7ca 100644 --- a/backend/pkg/api/handlers/internal.go +++ b/backend/pkg/api/handlers/internal.go @@ -470,12 +470,11 @@ func (h *HandlerService) InternalGetMobileLatestBundle(w http.ResponseWriter, r force := v.checkBool(q.Get("force"), "force") bundleVersion := v.checkUint(q.Get("bundle_version"), "bundle_version") nativeVersion := v.checkUint(q.Get("native_version"), "native_version") - environment := checkEnum[enums.Environment](&v, q.Get("environment"), "environment") if v.hasErrors() { handleErr(w, r, v) return } - stats, err := h.dai.GetLatestBundleForNativeVersion(r.Context(), nativeVersion, environment) + stats, err := h.dai.GetLatestBundleForNativeVersion(r.Context(), nativeVersion) if err != nil { handleErr(w, r, err) return