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 initiate leaderboard config managment. #916

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

Andrei-Dolgolev
Copy link
Contributor

@Andrei-Dolgolev Andrei-Dolgolev commented Aug 31, 2023

Manage leaderboard for now include:

  • Change already existing parameters for query.

  • Activate/deactivate leaderboard update.

New endpoints:

Get current config.

GET http://127.0.0.1:7191/leaderboard/62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1/config
Authorization: <moonstream-token>

return 404 if config not exists
response:

{
  "leaderboard_id": "62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1",
  "leaderboard_auto_update_active": false,
  "query_name": "leaderboard_5....a",
  "params": {
    "shards_common": 0,
    "shards_uncommon": 2,
    .....
    "silver_chest_points": 0
  },
  "normalize_addresses": true
}

Update leaderboard config

PUT http://127.0.0.1:7191/leaderboard/62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1/config
Authorization: Bearer <moonstream-token>

{
  "params":{
    "shards_common":100
  }
}

response:


{
  "leaderboard_id": "62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1",
  "leaderboard_auto_update_active": false,
  "query_name": "leaderboard_5....a",
  "params": {
    "shards_common": 100,
    ....
    "silver_chest_points": 0
  },
  "normalize_addresses": true
}

Activate auto update:

POST http://127.0.0.1:7191/leaderboard/62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1/config/activate
Authorization: Bearer <moonstream-token>

Deactivate auto update:

POST http://127.0.0.1:7191/leaderboard/62c2da7c-5beb-41e2-bbb8-b4d0bcbe07c1/config/deactivate
Authorization: Bearer <moonstream-token>

return new_config


def activate_leaderboard_config(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit odd to check for only "status:active". Presumably someone could think it's correct to set "status:inactive". I suppose if we just tell everyone to use the API to update the config it will be fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the Moonstream API and our team has access to that journal. Moonstream users do not have access to the journal interface. Their only access is through this API.

engineapi/engineapi/settings.py Outdated Show resolved Hide resolved
@Andrei-Dolgolev Andrei-Dolgolev merged commit 6292aec into main Sep 4, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants