Skip to content

Commit

Permalink
fix(server): updated build and added limit parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
foundrium committed Feb 19, 2022
1 parent 97dfbc2 commit 9cf8725
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"huskyinstall": "husky install",
"pretty": "npm run pretty --workspaces",
"test": "npm run test --workspaces",
"build": "npm run build --workspace=@hastearcade/models --workspace=@hastearcade/server --workspace=@hastearcade/web --workspace=@hastearcade/haste-game-domain --workspace=@hastearcade/haste-game-client --workspace=@hastearcade/haste-game-server --workspace=@hastearcade/haste-express",
"build": "npm run build --workspace=@hastearcade/models --workspace=@hastearcade/server --workspace=@hastearcade/web --workspace=@hastearcade/haste-express",
"cibuild": "npm run build --workspace=@hastearcade/models --workspace=@hastearcade/server --workspace=@hastearcade/web --workspace=@hastearcade/haste-game-domain --workspace=@hastearcade/haste-game-client --workspace=@hastearcade/haste-game-server --workspace=@hastearcade/haste-express",
"citest": "npm run test --workspace=@hastearcade/models --workspace=@hastearcade/server --workspace=@hastearcade/web"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/playhaste/haste-sdk/issues"
},
"dependencies": {
"@hastearcade/models": "^1.3.0",
"@hastearcade/models": "^1.3.2-next.1",
"axios": "^0.21.1",
"jsonwebtoken": "^8.5.1",
"jwks-rsa": "^2.0.4"
Expand Down
18 changes: 12 additions & 6 deletions packages/server/src/api/resources/game/gameResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ export class GameResource extends BaseResource {
return result.leaders;
}

async payouts(player: Player, startingAfter?: string, endingBefore?: string) {
const path = `/arcades/${this.configuration.arcadeId}/games/${this.configuration.gameId}/payouts/${
player.id
}?limit=1${startingAfter ? `&starting_after=${startingAfter}` : ''}${
endingBefore ? `&endingBefore=${endingBefore}` : ''
}`;
async payouts(player: Player, limit?: number, startingAfter?: string, endingBefore?: string) {
if (limit && limit < 1) {
throw new Error(`The limit must be greater than zero.`);
}

if (limit && limit > 100) {
throw new Error(`The limit must be less than 100.`);
}

const path = `/arcades/${this.configuration.arcadeId}/games/${this.configuration.gameId}/payouts/${player.id}${
limit ? `?limit=${limit}` : `?limit=100`
}${startingAfter ? `&starting_after=${startingAfter}` : ''}${endingBefore ? `&endingBefore=${endingBefore}` : ''}`;
const result = await this.get<Payout>(path);
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"payout"
],
"dependencies": {
"@hastearcade/models": "^1.3.0",
"@hastearcade/models": "^1.3.2-next.1",
"@types/axios": "^0.14.0",
"@types/uuid": "^8.3.3",
"axios": "^0.21.1",
Expand Down

0 comments on commit 9cf8725

Please sign in to comment.