Skip to content

Commit

Permalink
(BEDS-480) bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LuccaBitfly committed Sep 19, 2024
1 parent 287d2cc commit 0e4d314
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/pkg/api/handlers/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func (h *HandlerService) InternalGetValidatorDashboardMobileWidget(w http.Respon
handleErr(w, r, err)
return
}
if !userInfo.PremiumPerks.MobileAppWidget {
if userInfo.UserGroup != types.UserGroupAdmin && !userInfo.PremiumPerks.MobileAppWidget {
returnForbidden(w, r, errors.New("user does not have access to mobile app widget"))
return
}
Expand Down
2 changes: 1 addition & 1 deletion backend/pkg/api/handlers/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ func (h *HandlerService) PublicDeleteValidatorDashboardPublicId(w http.ResponseW
// @Param request body handlers.PublicPutValidatorDashboardArchiving.request true "request"
// @Success 200 {object} types.ApiDataResponse[types.VDBPostArchivingReturnData]
// @Failure 400 {object} types.ApiErrorResponse
// @Conflict 409 {object} types.ApiErrorResponse "Conflict. The request could not be performed by the server because the authenticated user has already reached their subscription limit."
// @Failure 409 {object} types.ApiErrorResponse "Conflict. The request could not be performed by the server because the authenticated user has already reached their subscription limit."
// @Router /validator-dashboards/{dashboard_id}/archiving [put]
func (h *HandlerService) PublicPutValidatorDashboardArchiving(w http.ResponseWriter, r *http.Request) {
var v validationError
Expand Down
2 changes: 1 addition & 1 deletion backend/pkg/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func addValidatorDashboardRoutes(hs *handlers.HandlerService, publicRouter, inte
{http.MethodGet, "/{dashboard_id}/total-rocket-pool", hs.PublicGetValidatorDashboardTotalRocketPool, hs.InternalGetValidatorDashboardTotalRocketPool},
{http.MethodGet, "/{dashboard_id}/rocket-pool/{node_address}", hs.PublicGetValidatorDashboardNodeRocketPool, hs.InternalGetValidatorDashboardNodeRocketPool},
{http.MethodGet, "/{dashboard_id}/rocket-pool/{node_address}/minipools", hs.PublicGetValidatorDashboardRocketPoolMinipools, hs.InternalGetValidatorDashboardRocketPoolMinipools},
{http.MethodGet, "/{dashboard_id}/mobile-widget", nil, hs.InternalGetValidatorDashboardRocketPoolMinipools},
{http.MethodGet, "/{dashboard_id}/mobile-widget", nil, hs.InternalGetValidatorDashboardMobileWidget},
}
addEndpointsToRouters(endpoints, publicDashboardRouter, internalDashboardRouter)
}
Expand Down
16 changes: 8 additions & 8 deletions backend/pkg/api/types/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ type MobileBundleData struct {
type GetMobileLatestBundleResponse ApiDataResponse[MobileBundleData]

type MobileWidgetData struct {
StateCounts ValidatorStateCounts `json:"state_counts"`
Last24hIncome decimal.Decimal `json:"last_24h_income"`
Last7dIncome decimal.Decimal `json:"last_7d_income"`
Last30dApr float64 `json:"last_30d_apr"`
Last30dEfficiency decimal.Decimal `json:"last_30d_efficiency"`
NetworkEfficiency float64 `json:"network_efficiency"`
RplPrice decimal.Decimal `json:"rpl_price"`
RplApr float64 `json:"rpl_apr"`
ValidatorStateCounts ValidatorStateCounts `json:"validator_state_counts"`
Last24hIncome decimal.Decimal `json:"last_24h_income" faker:"eth"`
Last7dIncome decimal.Decimal `json:"last_7d_income" faker:"eth"`
Last30dApr float64 `json:"last_30d_apr"`
Last30dEfficiency decimal.Decimal `json:"last_30d_efficiency" faker:"eth"`
NetworkEfficiency float64 `json:"network_efficiency"`
RplPrice decimal.Decimal `json:"rpl_price" faker:"eth"`
RplApr float64 `json:"rpl_apr"`
}

type InternalGetValidatorDashboardMobileWidgetResponse ApiDataResponse[MobileWidgetData]
2 changes: 1 addition & 1 deletion frontend/types/api/mobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface MobileBundleData {
}
export type GetMobileLatestBundleResponse = ApiDataResponse<MobileBundleData>;
export interface MobileWidgetData {
state_counts: ValidatorStateCounts;
validator_state_counts: ValidatorStateCounts;
last_24h_income: string /* decimal.Decimal */;
last_7d_income: string /* decimal.Decimal */;
last_30d_apr: number /* float64 */;
Expand Down

0 comments on commit 0e4d314

Please sign in to comment.