-
Notifications
You must be signed in to change notification settings - Fork 49
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
Leaderboard metadata #968
Leaderboard metadata #968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments
engineapi/engineapi/data.py
Outdated
@@ -370,6 +380,10 @@ class Leaderboard(BaseModel): | |||
title: str | |||
description: Optional[str] = None | |||
resource_id: Optional[UUID] = None | |||
public: Optional[bool] = False | |||
wallet_connect: Optional[bool] = False | |||
blockchain_ids: Optional[List[int]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to store as empty list []
instead of None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for Optional[List[int]] = None
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because default in postgres default=[]
@@ -346,6 +347,11 @@ class Leaderboard(Base): # type: ignore | |||
title = Column(VARCHAR(128), nullable=False) | |||
description = Column(String, nullable=True) | |||
resource_id = Column(UUID(as_uuid=True), nullable=True, index=True) | |||
blockchain_ids = Column(ARRAY(Integer), nullable=False, default=[]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sugest also add sort
for add and update values to this list, so it always will be readable, for example when query returns few result:
id blockchain_ids
<uuid1> 80001, 1
<uuid2> 1, 80001
Leaderboards db model was extended by additional fields
blockchain_ids
- array of ids which blockchain that leaderboard includewallet_connect
- show metamask connect on leaderboard (in case if address field is wallet address)columns_names
- dict of mapping for column names if it not empty then will use LeaderboardUnformattedPosition reponse model.new model:
If used that model client must look in columns_names of leaderboard/info endpoint for get correct names of each fields as well as extract keys.
If use change just 1 field
columns_names : {"address": "token_id}
then column_names will transform to that structure.Testing requests.
GET leaderboards Authorized Endpoints
Create Leaderboard Authorized Endpoints
Get scores
Update leaderboard endpoint
Get scores
Push scores
Get scores
Quartiles
Position
Rank
Ranks
Migration plan
merge that PR.
Run engine api deployment.