You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The API should be a simple https://expressjs.com/ application. For this task, the following endpoint should be added:
GET /rounds
That returns a paginated list of Round entities with the following properties:
round_id
plays_num
jackpot_amount
winner_account_hash
winner_public_key
ended_at
The jackpot data should be calculated over the plays table using a query like the following one which should be provided as getRounds(offset, limit) function in the Round repository:
select
p.round_id,
w.plays_num,
p.prize_amount as jackpot_amount,
p.player_account_hash as winner_account_hash,
p.timestamp as ended_at
from plays p
join (
selectmax(play_id) as play_id, count(*) as plays_num
from plays
group by round_id
) w on w.play_id = p.play_id
order by p.round_id desc;
The winner_public_key should be deanonimized from the winner_account_hash in the API handler using CSPR.cloud Account API. Let’s implement it as a utility addPublicKeys(data, accountHashProperty, publicKeyProperty) because we’ll reuse it for three endpoints.
The text was updated successfully, but these errors were encountered:
The API should be a simple https://expressjs.com/ application. For this task, the following endpoint should be added:
That returns a paginated list of
Round
entities with the following properties:round_id
plays_num
jackpot_amount
winner_account_hash
winner_public_key
ended_at
The jackpot data should be calculated over the
plays
table using a query like the following one which should be provided asgetRounds(offset, limit)
function in theRound
repository:The
winner_public_key
should be deanonimized from thewinner_account_hash
in the API handler using CSPR.cloud Account API. Let’s implement it as a utilityaddPublicKeys(data, accountHashProperty, publicKeyProperty)
because we’ll reuse it for three endpoints.The text was updated successfully, but these errors were encountered: