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
{{ message }}
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
Outline:
New query parameter page: e.g. api-dev.collaction.org/crowdactions?status=ended&page=eyJwayI6ImFjdCIsInNrIjoic3VzdGFpbmFiaWxpdHkjZm9vZCN2ZWdhbk1vbnRoMjAtMTIifQ==
New response:
{
data: [...], // The list of crowdactions returned by the backend
next_page: "eyJwayI6ImFjdCIsInNrIjoic3VzdGFpbmFiaWxpdHkjZm9vZCN2ZWdhbk1vbnRoMjAtMTIifQ==" // Next page key as Base64 or null
}
Obtaining value for next_page to return from models/crowdactions.go#listCrowdactions:
Variable startFrom is of type utils.PrimaryKey (aka map[string]*dynamodb.AttributeValue)
If this variable is null or empty, return null
Marshal this variable as a JSON string (avoid optional whitespace characters. E.g. {"pk":"act","sk":"sustainability#food#veganMonth20-12"})
Convert JSON string to base64
Obtain parameter startFrom for models/crowdactions.go#listCrowdactions:
(See above, but just in reverse)
Shorter page IDs:
Instead of converting the primary key to a JSON file, concatenate pk and sk and obtain the base64 string which should reduce the length of the generated page ID. Here is an example using the same primary key:
JSON → eyJwayI6ImFjdCIsInNrIjoic3VzdGFpbmFiaWxpdHkjZm9vZCN2ZWdhbk1vbnRoMjAtMTIifQ== pk.sk → YWN0LnN1c3RhaW5hYmlsaXR5I2Zvb2QjdmVnYW5Nb250aDIwLTEy
The text was updated successfully, but these errors were encountered:
From Jira CAN-99:
Currently, there is no pagination needed as the list of actions is small but hopefully, there will be a lot of them so pagination will be mandatory in the end
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.Pagination.html
Outline:
New query parameter page: e.g.
api-dev.collaction.org/crowdactions?status=ended&page=eyJwayI6ImFjdCIsInNrIjoic3VzdGFpbmFiaWxpdHkjZm9vZCN2ZWdhbk1vbnRoMjAtMTIifQ==
New response:
Obtaining value for
next_page
to return from models/crowdactions.go#listCrowdactions:startFrom
is of typeutils.PrimaryKey
(akamap[string]*dynamodb.AttributeValue
){"pk":"act","sk":"sustainability#food#veganMonth20-12"}
)Obtain parameter
startFrom
formodels/crowdactions.go#listCrowdactions
:(See above, but just in reverse)
Shorter page IDs:
Instead of converting the primary key to a JSON file, concatenate pk and sk and obtain the base64 string which should reduce the length of the generated page ID. Here is an example using the same primary key:
JSON →
eyJwayI6ImFjdCIsInNrIjoic3VzdGFpbmFiaWxpdHkjZm9vZCN2ZWdhbk1vbnRoMjAtMTIifQ==
pk.sk
→YWN0LnN1c3RhaW5hYmlsaXR5I2Zvb2QjdmVnYW5Nb250aDIwLTEy
The text was updated successfully, but these errors were encountered: