Compare commits
2 Commits
dcdbdd15ac
...
4a294b1e17
Author | SHA1 | Date | |
---|---|---|---|
4a294b1e17 | |||
720774fcf4 |
@ -157,7 +157,7 @@ export class StatsController {
|
|||||||
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
||||||
@OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
@OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
||||||
async getTopOrgsByDonations() {
|
async getTopOrgsByDonations() {
|
||||||
let orgs = await getConnection().getRepository(RunnerOrganization).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
|
let orgs = await getConnection().getRepository(RunnerOrganization).find({ relations: ['runners', 'runners.distanceDonations', 'runners.distanceDonations.runner', 'runners.distanceDonations.runner.scans', 'runners.distanceDonations.runner.scans.track', 'teams', 'teams.runners', 'teams.runners.distanceDonations', 'teams.runners.distanceDonations.runner', 'teams.runners.distanceDonations.runner.scans', 'teams.runners.distanceDonations.runner.scans.track'] });
|
||||||
if (!orgs || orgs.length == 0) {
|
if (!orgs || orgs.length == 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,8 @@ describe('GET /api/stats/organizations/* should return 200', () => {
|
|||||||
});
|
});
|
||||||
it('get by donations w/ auth should return 200', async () => {
|
it('get by donations w/ auth should return 200', async () => {
|
||||||
const res = await axios.get(base + '/api/stats/organizations/donations', axios_config_stats);
|
const res = await axios.get(base + '/api/stats/organizations/donations', axios_config_stats);
|
||||||
|
console.log("################# Orgs by donations #################");
|
||||||
|
console.log(res.data);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user