Skip to content

Commit

Permalink
Merge pull request #29 from rarimo/fix/bugs
Browse files Browse the repository at this point in the history
Fix auth in create balance. Fix points and level accruing after claim.
  • Loading branch information
Zaptoss authored Jun 18, 2024
2 parents 61017df + 0717dc8 commit a811cbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions internal/service/handlers/claim_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ func DoClaimEventUpdates(
if err = referralsQ.New().Insert(refToAdd...); err != nil {
return fmt.Errorf("failed to insert referrals: %w", err)
}

return nil
}

err = balancesQ.FilterByNullifier(balance.Nullifier).Update(map[string]any{
Expand Down
6 changes: 6 additions & 0 deletions internal/service/handlers/create_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"

"github.com/rarimo/decentralized-auth-svc/pkg/auth"
"github.com/rarimo/rarime-points-svc/internal/data"
"github.com/rarimo/rarime-points-svc/internal/data/evtypes"
"github.com/rarimo/rarime-points-svc/internal/service/requests"
Expand All @@ -21,6 +22,11 @@ func CreateBalance(w http.ResponseWriter, r *http.Request) {

nullifier := req.Data.ID

if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) {
ape.RenderErr(w, problems.Unauthorized())
return
}

balance, err := BalancesQ(r).FilterByNullifier(nullifier).Get()
if err != nil {
Log(r).WithError(err).Error("Failed to get balance by nullifier")
Expand Down

0 comments on commit a811cbc

Please sign in to comment.