Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add materialized view. #1077

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

Andrei-Dolgolev
Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev commented May 31, 2024

Tested.

Queries for testing.

### get info
GET http://127.0.0.1:7191/leaderboard/info?leaderboard_id=<leaderboard_id>


### get leaderboard scores
GET http://127.0.0.1:7191/leaderboard/?leaderboard_id=<leaderboard_id>


### quartiles
GET http://127.0.0.1:7191/leaderboard/quartiles?leaderboard_id=<leaderboard_id>&version=5

### position
GET http://127.0.0.1:7191/leaderboard/position?leaderboard_id=<leaderboard_id>&address=0x0000000000000000000000000000000000000000&window_size=2&normalize_addresses=True

### scores

GET http://127.0.0.1:7191/leaderboard/scores?leaderboard_id=<leaderboard_id>&address=0x609F10EF05e5b068382d1a6D68409b437160d064

### get count

GET http://127.0.0.1:7191/leaderboard/count/addresses?leaderboard_id=<leaderboard_id>

### Push scores (that make this steps 1 create new version 2 push scores there 3 maket version puclic 4 delete all another versions) (mv updated)
PUT http://127.0.0.1:7191/leaderboard/<leaderboard_id>/scores?overwrite=true
Authorization: Bearer <token_id>
Content-Type: application/json

[{
  "address": "0x0000000000000000000000000000000000000000",
  "score": 2000000,
  "points_data": {
    "breeding": 100000000,
    "hatchingEggs": 100000000
  }
}]

### get existed versions

GET http://127.0.0.1:7191/leaderboard/<leaderboard_id>/versions
Authorization: Bearer <token_id>
Content-Type: application/json


### create not public version (mv not updated)

POST http://127.0.0.1:7191/leaderboard/<leaderboard_id>/versions
Authorization: Bearer <token_id>
Content-Type: application/json

{
  "publish": false
}


###  publish version (mv updated)

PUT http://127.0.0.1:7191/leaderboard/<leaderboard_id>/versions/9
Authorization: Bearer <token_id>
Content-Type: application/json

{
  "publish": true
}

###

### update scores with version (mv updated but if it not latest public not change anything)

PUT http://127.0.0.1:7191/leaderboard/<leaderboard_id>/versions/9/scores?normalize_addresses=false&overwrite=false
Authorization: Bearer <token_id>
Content-Type: application/json

[{
  "address": "0x000000000000000000000000000000000000000q",
  "score": 2000000,
  "points_data": {
    "breeding": 100000000,
    "hatchingEggs": 100000000
  }
},
{
  "address": "0x000000000000000000000000000000000000000",
  "score": 2000000,
  "points_data": {
    "breeding": 100000000,
    "hatchingEggs": 100000000
  }
}
]


### delete version (mv updated)

DELETE  http://127.0.0.1:7191/leaderboard/<leaderboard_id>/versions/10
Authorization: Bearer <token_id>

@Andrei-Dolgolev Andrei-Dolgolev added db Database module backend Backend module leaderboards and removed backend Backend module labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db Database module leaderboards
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant