feat: improve tournament workflows and prune outdated docs
This commit is contained in:
1 parent
da7b502936
commit
38a89b5374
53 files changed
+3308
-3276
No files matched your search
@@ -82,6 +82,7 @@ export class MatchController {
|
||||
@Query('scheduledFrom') scheduledFrom?: string,
|
||||
@Query('scheduledTo') scheduledTo?: string,
|
||||
@Query('sort') sort?: 'asc' | 'desc',
|
||||
@Query('includeResults') includeResults?: string,
|
||||
): Promise<MatchListResponse> {
|
||||
const result = await this.matchService.listPage({
|
||||
communityId,
|
||||
@@ -93,10 +94,14 @@ export class MatchController {
|
||||
scheduledTo: this.toOptionalDate(scheduledTo),
|
||||
sort,
|
||||
});
|
||||
const historyResults =
|
||||
includeResults === 'true'
|
||||
? await this.matchService.getHistoryResults(communityId, result.matches)
|
||||
: undefined;
|
||||
return {
|
||||
...result,
|
||||
matches: result.matches.map((match) =>
|
||||
this.matchService.serialize(match, {
|
||||
matches: result.matches.map((match) => {
|
||||
const summary = this.matchService.serialize(match, {
|
||||
...(currentUser
|
||||
? {
|
||||
joined: match.participants.some((participant) =>
|
||||
@@ -104,8 +109,10 @@ export class MatchController {
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
}),
|
||||
),
|
||||
});
|
||||
const historyResult = historyResults?.get(summary._id);
|
||||
return historyResult ? { ...summary, historyResult } : summary;
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user