Class Update

Hierarchy

  • BaseUpdater
    • Update

Constructors

  • Creates an instance of a Storage getter.

    Parameters

    • storage: Storage

      The implementation of Storage.

    Returns Update

Properties

storage: Storage

Methods

  • Adds or deletes match games of a match based on a target child count.

    Parameters

    • match: Match

      The match of which child games need to be adjusted.

    • targetChildCount: number

      The target child count.

    Returns Promise<void>

  • Updates the opponents and status of a match and its child games.

    Parameters

    • match: Match

      A match.

    Returns Promise<void>

  • Updates the ordering of participants in a round's matches.

    Parameters

    • roundNumber: number

      The number of the round.

    • matches: Match[]

      The matches of the round.

    • positions: number[]

      The new positions.

    Returns Promise<void>

  • Applies a SetNextOpponent function to matches following the current match.

    • nextMatches[0] is assumed to be next match for the winner of the current match.
    • nextMatches[1] is assumed to be next match for the loser of the current match.

    Parameters

    • setNextOpponent: SetNextOpponent

      The SetNextOpponent function.

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • roundNumber: number

      Number of the current round.

    • roundCount: number

      Count of rounds.

    • nextMatches: (null | Match)[]

      The matches following the current match.

    • Optional winnerSide: Side

      Side of the winner in the current match.

    Returns Promise<void>

  • Sets the status of a list of matches to archived.

    Parameters

    • matches: Match[]

      The matches to update.

    Returns Promise<void>

  • Confirms the current seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<void>

  • Confirms the seeding of a stage.

    This will convert TBDs to BYEs and propagate them.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<void>

  • Finds a match in a given group. The match must have the given number in a round of which the number in group is given.

    Example: In group of id 1, give me the 4th match in the 3rd round.

    Parameters

    • groupId: Id

      ID of the group.

    • roundNumber: number

      Number of the round in its parent group.

    • matchNumber: number

      Number of the match in its parent round.

    Returns Promise<Match>

  • Finds a match game based on its id or based on the combination of its parent_id and number.

    Parameters

    • game: {
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          parent_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Values to change in a match game.

      • Optional id?: Id

        ID of the match game.

      • Optional number?: number

        The number of the match game in its parent match.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional parent_id?: Id

        ID of the parent match.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    Returns Promise<MatchGame>

  • Gets the loser bracket.

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<null | Group>

  • Gets the match(es) where the opponents of the current match will go just after.

    Parameters

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      The number of the current round.

    • roundCount: number

      Count of rounds.

    Returns Promise<(null | Match)[]>

  • Gets all the rounds that contain ordered participants.

    Parameters

    • stage: Stage

      The stage to get rounds from.

    Returns Promise<Round[]>

  • Gets the matches leading to the given match.

    Parameters

    • match: Match

      The current match.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    Returns Promise<Match[]>

  • Gets the positional information (number in group and total number of rounds in group) of a round based on its id.

    Parameters

    • roundId: Id

      ID of the round.

    Returns Promise<RoundPositionalInfo>

  • Returns the matches which contain the seeding of a stage based on its type.

    Parameters

    • stageId: Id

      ID of the stage.

    • stageType: StageType

      The type of the stage.

    Returns Promise<null | Match[]>

  • Gets the upper bracket (the only bracket if single elimination or the winner bracket in double elimination).

    Parameters

    • stageId: Id

      ID of the stage.

    Returns Promise<Group>

  • Updates partial information of a match. Its id must be given.

    This will update related matches accordingly.

    Type Parameters

    • M extends Match = Match

    Parameters

    Returns Promise<void>

  • Updates child count of all matches of a given level.

    Parameters

    • level: ChildCountLevel

      The level at which to act.

    • id: Id

      ID of the chosen level.

    • childCount: number

      The target child count.

    Returns Promise<void>

  • Updates partial information of a match game. Its id must be given.

    This will update the parent match accordingly.

    Type Parameters

    • G extends MatchGame = MatchGame

    Parameters

    • game: DeepPartial<G>

      Values to change in a match game.

    Returns Promise<void>

  • Updates the seed ordering of every ordered round in a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    • seedOrdering: SeedOrdering[]

      A list of ordering methods.

    Returns Promise<void>

  • Propagates winner against BYEs in related matches.

    Parameters

    • match: Match

      The current match.

    Returns Promise<void>

  • Resets the status of a list of matches to what it should currently be.

    Parameters

    • matches: Match[]

      The matches to update.

    Returns Promise<void>

  • Updates the seed ordering of a round.

    Parameters

    • roundId: Id

      ID of the round.

    • method: SeedOrdering

      Seed ordering method.

    Returns Promise<void>

  • Updates the seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    • seeding: Seeding

      The new seeding.

    • keepSameSize: boolean = false

      Whether to keep the same size as before for the stage. Default: false.

    Returns Promise<void>

  • Updates the seeding of a stage (with a list of IDs).

    Parameters

    • stageId: Id

      ID of the stage.

    • seedingIds: IdSeeding

      The new seeding, containing only IDs.

    • keepSameSize: boolean = false

      Whether to keep the same size as before for the stage. Default: false.

    Returns Promise<void>

  • Updates child count of all matches of a group.

    Parameters

    • groupId: Id

      ID of the group.

    • childCount: number

      The target child count.

    Returns Promise<void>

  • Updates a match based on a partial match.

    Parameters

    • stored: Match

      A reference to what will be updated in the storage.

    • match: {
          child_count?: number;
          group_id?: Id;
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          round_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Input of the update.

      • Optional child_count?: number

        The count of match games this match has. Can be 0 if it's a simple match, or a positive number for "Best Of" matches.

      • Optional group_id?: Id

        ID of the parent group.

      • Optional id?: Id

        ID of the match.

      • Optional number?: number

        The number of the match in its round.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional round_id?: Id

        ID of the parent round.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    • Optional force: boolean

      Whether to force update locked matches.

    Returns Promise<void>

  • Updates a match game based on a partial match game.

    Parameters

    • stored: MatchGame

      A reference to what will be updated in the storage.

    • game: {
          id?: Id;
          number?: number;
          opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; });
          parent_id?: Id;
          stage_id?: Id;
          status?: Status;
      }

      Input of the update.

      • Optional id?: Id

        ID of the match game.

      • Optional number?: number

        The number of the match game in its parent match.

      • Optional opponent1?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        First opponent of the match.

      • Optional opponent2?: null | ({ id?: Id | null | undefined; position?: number | undefined; forfeit?: boolean | undefined; score?: number | undefined; result?: Result | undefined; })

        Second opponent of the match.

      • Optional parent_id?: Id

        ID of the parent match.

      • Optional stage_id?: Id

        ID of the parent stage.

      • Optional status?: Status

        Status of the match.

    Returns Promise<void>

  • Updates the match(es) following the current match based on this match results.

    Parameters

    • match: Match

      Input of the update.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    • roundCount: number

      Count of rounds.

    Returns Promise<void>

  • Updates a parent match based on its child games.

    Parameters

    • parentId: Id

      ID of the parent match.

    • inRoundRobin: boolean

      Indicates whether the parent match is in a round-robin stage.

    Returns Promise<void>

  • Updates the match(es) leading to the current match based on this match results.

    Parameters

    • match: Match

      Input of the update.

    • matchLocation: GroupType

      Location of the current match.

    • stage: Stage

      The parent stage.

    • roundNumber: number

      Number of the round.

    Returns Promise<void>

  • Updates the matches related (previous and next) to a match.

    Parameters

    • match: Match

      A match.

    • updatePrevious: boolean

      Whether to update the previous matches.

    • updateNext: boolean

      Whether to update the next matches.

    Returns Promise<void>

  • Updates child count of all matches of a round.

    Parameters

    • roundId: Id

      ID of the round.

    • childCount: number

      The target child count.

    Returns Promise<void>

  • Update the seed ordering of a round.

    Parameters

    • round: Round

      The round of which to update the ordering.

    • method: SeedOrdering

      The new ordering method.

    Returns Promise<void>

  • Updates or resets the seeding of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    • seeding: {
          seeding?: null | Seeding;
          seedingIds?: null | IdSeeding;
      }

      A new seeding or null to reset the existing seeding.

      • Optional seeding?: null | Seeding

        Can contain names, IDs or BYEs.

      • Optional seedingIds?: null | IdSeeding

        Can only contain IDs or BYEs.

    • keepSameSize: boolean

      Whether to keep the same size as before for the stage.

    Returns Promise<void>

  • Updates child count of all matches of a stage.

    Parameters

    • stageId: Id

      ID of the stage.

    • childCount: number

      The target child count.

    Returns Promise<void>

  • Throws an error if a match is locked and the new seeding will change this match's participants.

    Parameters

    • matches: Match[]

      The matches stored in the database.

    • slots: ParticipantSlot[]

      The slots to check from the new seeding.

    Returns void

  • Returns the good seeding ordering based on the stage's type.

    Parameters

    • stageType: StageType

      The type of the stage.

    • create: StageCreator

      A reference to a Create instance.

    Returns SeedOrdering

Generated using TypeDoc