Skip to content

Commit

Permalink
refactor: ♻️ cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CourtHive committed Apr 18, 2024
1 parent 3fc34fa commit d39e19e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
16 changes: 8 additions & 8 deletions documentation/docs/apis/draw-engine-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,16 @@ Returns categorized matchUps from a single structure.
```js
const { upcomingMatchUps, pendingMatchUps, completedMatchUps, abandonedMatchUps, byeMatchUps } =
drawEngine.getStructureMatchUps({
structureId,
context, // optional context to be added into matchUps
inContext, // boolean - add context { drawId, structureId, participant, individualParticipants ... }
nextMatchUps, // optioanl - boolean - to include winnerTo and loserTo
matchUpFilters, // attribute filters
contextFilters, // filters based on context attributes
tournamentParticipants, // optional - provide an array of tournamentParticipants to add into matchUps
requireParticipants, // optional - require that participants be loaded into drawEngine or passed into method
tournamentAppliedPolicies, // any policies, such as privacy, to be applied to matchUps
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
tournamentParticipants, // optional - provide an array of tournamentParticipants to add into matchUps
requireParticipants, // optional - require that participants be loaded into drawEngine or passed into method
contextFilters, // filters based on context attributes
matchUpFilters, // attribute filters
structureId,
nextMatchUps, // optioanl - boolean - to include winnerTo and loserTo
inContext, // boolean - add context { drawId, structureId, participant, individualParticipants ... }
context, // optional context to be added into matchUps
});
```

Expand Down
22 changes: 11 additions & 11 deletions documentation/docs/governors/query-governor.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Returns all matchUps for an event.

```js
const { matchUps } = allEventMatchUps({
scheduleVisibilityFilters, // { visibilityThreshold: dateString, eventIds, drawIds }
participantsProfile, // optional - ability to specify additions to context (see parameters of getParticipants())
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
contextFilters, // filters based on context attributes
nextMatchUps: true, // include winner/loser target matchUp details
Expand Down Expand Up @@ -61,7 +61,7 @@ Return an array of all matchUps contained within a tournament. These matchUps ar

```js
const { matchUps, groupInfo } = engine.allTournamentMatchUps({
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
scheduleVisibilityFilters, // { visibilityThreshold: dateString, eventIds, drawIds }
participantsProfile, // optional - ability to specify additions to context (see parameters of getParticipants())
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
contextFilters, // filters based on context attributes
Expand Down Expand Up @@ -118,13 +118,13 @@ Returns matchUps for an event grouped by status.

```js
const { abandonedMatchUps, byeMatchUps, completedMatchUps, pendingMatchUps, upcomingMatchUps } = engine.eventMatchUps({
eventId,
nextMatchUps, // optional boolean; include winner/loser target matchUp details
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
contextFilters,
scheduleVisibilityFilters, // { visibilityThreshold: dateString, eventIds, drawIds }
tournamentAppliedPolicies,
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
inContext: true, // optional - adds context details to all matchUps
contextFilters, // optiona; filter by attributes that are only present after matchUpContext has been added (hydration)
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
nextMatchUps, // optional boolean; include winner/loser target matchUp details
inContext, // optional - adds context details to all matchUps
eventId,
});
```

Expand Down Expand Up @@ -660,7 +660,7 @@ const {
allocatedCourts: [{ venueId, courtid }], // applies only to TEAM matchUps
},
} = engine.getMatchUpScheduleDetails({
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
scheduleVisibilityFilters, // { visibilityThreshold: dateString, eventIds, drawIds }
matchUp,
});
```
Expand Down Expand Up @@ -1515,9 +1515,9 @@ Returns tournament matchUps grouped by matchUpStatus. These matchUps are returne
```js
const { abandonedMatchUps, completedMatchUps, upcomingMatchUps, pendingMatchUps, byeMatchUps, groupInfo } =
engine.tournamentMatchUps({
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
scheduleVisibilityFilters, // { visibilityThreshold: dateString, eventIds, drawIds }
policyDefinitions, // optional - seeding or avoidance policies to be used when placing participants
scheduleVisibilityFilters, // { visibilityThreshold: Date, eventIds, drawIds }
matchUpFilters, // optional; [ scheduledDates: [], courtIds: [], stages: [], roundNumbers: [], matchUpStatuses: [], matchUpFormats: []]
});
```

Expand Down
2 changes: 1 addition & 1 deletion src/query/matchUp/getMatchUpScheduleDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { matchUpAssignedVenueId } from '@Query/matchUp/venueAssignment';
import { matchUpTimeModifiers } from '@Query/matchUp/timeModifiers';
import { matchUpDuration } from '@Query/matchUp/matchUpDuration';
import { matchUpCourtOrder } from '@Query/matchUp/courtOrder';
import { getHomeParticipantId } from './getHomeParticipantId';
import { matchUpStartTime } from '@Query/matchUp/startTime';
import { definedAttributes } from '@Tools/definedAttributes';
import { getVenueData } from '@Query/venues/getVenueData';
Expand All @@ -22,7 +23,6 @@ import { Event, Tournament, EventTypeUnion } from '@Types/tournamentTypes';
import { MISSING_MATCHUP } from '@Constants/errorConditionConstants';
import { HydratedMatchUp } from '@Types/hydrated';
import { TEAM } from '@Constants/eventConstants';
import { getHomeParticipantId } from './getHomeParticipantId';

type GetMatchUpScheduleDetailsArgs = {
scheduleVisibilityFilters?: ScheduleVisibilityFilters;
Expand Down
13 changes: 7 additions & 6 deletions src/query/matchUps/getEventMatchUps.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { getEventPublishStatus } from '../event/getEventPublishStatus';
import { hydrateParticipants } from '@Query/participants/hydrateParticipants';
import { getEventPublishStatus } from '@Query/event/getEventPublishStatus';
import { getContextContent } from '@Query/hierarchical/getContextContent';
import { getDrawMatchUps } from '@Query/matchUps/drawMatchUps';
import { definedAttributes } from '@Tools/definedAttributes';
import { hydrateParticipants } from '../participants/hydrateParticipants';
import { MISSING_EVENT } from '@Constants/errorConditionConstants';
import { getContextContent } from '../hierarchical/getContextContent';
import { getDrawMatchUps } from './drawMatchUps';

import { SUCCESS } from '@Constants/resultConstants';
// constants and types
import { GetMatchUpsArgs, GroupsMatchUpsResult } from '@Types/factoryTypes';
import { MISSING_EVENT } from '@Constants/errorConditionConstants';
import { SUCCESS } from '@Constants/resultConstants';

export function eventMatchUps(params: GetMatchUpsArgs): GroupsMatchUpsResult {
let { participants: tournamentParticipants, contextContent, participantMap } = params;
Expand Down

0 comments on commit d39e19e

Please sign in to comment.