ChoreoService

Source: ChoreoService.js:102

Service for managing choreography entities and their associations. Handles CRUD operations and related logic for choreographies.


Constructor

new ChoreoService(): ChoreoService

Instance Methods

getAll( ownerIds: Array.<UUID>, actingUserId: UUID, isAdmin?: boolean, options?: Object, ): Promise.<Array.<Choreo>>

Get all Choreos for the specified owners.

Parameters

  • ownerIds (Array.<UUID>) — Array of owner IDs the acting user has access to.
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }") — Options for the query.
    • options.all (boolean, optional, default: false) — Whether to fetch all choreographies.

Returns

  • Promise.<Array.<Choreo>> — List of choreographies.

findBySeasonTeamId( SeasonTeamId: UUID, ownerIds: Array.<UUID>, actingUserId: UUID, isAdmin?: boolean, ): Promise.<Array.<Choreo>>

Find all Choreos with specified UserId and TeamId

Parameters

  • SeasonTeamId (UUID) — The SeasonTeam's UUID.
  • ownerIds (Array.<UUID>) — Array of owner IDs the acting user has access to.
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<Array.<Choreo>> — List of choreographies.

getCount(): Promise.<number>

Get the number of Choreos in the DB

Returns

  • Promise.<number> — Count of choreographies.

getTrend(): Promise.<number>

Get the number of new Choreos minus the number of deleted Choreos in the last 30 days

Returns

  • Promise.<number> — Trend of choreographies.

findById( id: UUID, ownerIds: Array.<UUID>, actingUserId: UUID, isAdmin?: boolean, options?: Object, ): Promise.<Choreo>

Find Choreo by its ID

Parameters

  • id (UUID) — The choreography's UUID.
  • ownerIds (Array.<UUID>) — Array of owner IDs the acting user has access to.
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }") — Options for the query.
    • options.all (boolean, optional, default: false) — Whether to fetch all choreographies.

Returns

  • Promise.<Choreo> — The choreography.

create( name: string, counts: number, matType?: MatType, SeasonTeamId: UUID, participants: Member, ownerId: UUID | null, actingUserId: UUID, isAdmin?: boolean, ): Promise.<Choreo>

Create a new Choreo

Parameters

  • name (string) — Name of the choreography.
  • counts (number) — Number of counts in the choreography.
  • matType (MatType, optional, default: "'cheer'") — Type of mat used.
  • SeasonTeamId (UUID) — The season team UUID.
  • participants (Member) — List of participants.
  • ownerId (UUID | null) — Owner ID. If null/undefined, falls back to actingUserId
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<Choreo> — The created choreography.

findOrCreate( name: string, counts: number, matType?: MatType, SeasonTeamId: UUID, ownerId: UUID | null, actingUserId: UUID, isAdmin?: boolean, ): Promise.<Array.<(Choreo|boolean)>>

Find or create a choreo.

Parameters

  • name (string) — Name of the choreography.
  • counts (number) — Number of counts in the choreography.
  • matType (MatType, optional, default: "'cheer'") — Type of mat used.
  • SeasonTeamId (UUID) — The season team UUID.
  • ownerId (UUID | null) — Owner ID. If null/undefined, falls back to actingUserId
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<Array.<(Choreo|boolean)>> — The found or created choreography and a boolean indicating if the choreography was created.

addParticipant( choreoId: UUID, MemberId: UUID, actingUserId: UUID, isAdmin?: boolean, color?: string, ): Promise.<void>

Add a Participant to a Choreo

Parameters

  • choreoId (UUID) — The choreography's UUID.
  • MemberId (UUID) — The member's UUID.
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)
  • color (string, optional, default: null) — Color associated with the participant.

Returns

  • Promise.<void>

removeParticipant( ChoreoId: UUID, MemberId: UUID, actingUserId: UUID, isAdmin?: boolean, ): Promise.<void>

Remove a Participant from a Choreo

Parameters

  • ChoreoId (UUID) — The choreography's UUID.
  • MemberId (UUID) — The member's UUID.
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<void>

replaceParticipant( ChoreoId: UUID, memberToAddId: UUID, memberToRemoveId: UUID, actingUserId: UUID, isAdmin?: boolean, ): Promise.<void>

Switch Member's Participation with another Member

Parameters

  • ChoreoId (UUID) — The choreography's UUID.
  • memberToAddId (UUID) — The UUID of the member to add.
  • memberToRemoveId (UUID) — The UUID of the member to remove.
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<void>

changeParticipationColor( ChoreoId: UUID, participantId: UUID, color: string, actingUserId: UUID, isAdmin?: boolean, ): Promise.<void>

Change the color of a Participant in a Choreo

Parameters

  • ChoreoId (UUID) — The choreography's UUID.
  • participantId (UUID) — The participant's UUID.
  • color (string) — New color for the participant.
  • actingUserId (UUID) — The acting user's UUID.
  • isAdmin (boolean, optional, default: false)

Returns

  • Promise.<void>

update( id: UUID, data: Object, actingUserId: UUID, isAdmin?: boolean, options?: Object, transaction?: Transaction, ): Promise.<Choreo>

Update a choreo.

Parameters

  • id (UUID) — The choreo ID.
  • data (Object) — The data to update.
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }") — Options for the query.
    • options.all (Boolean, optional, default: false) — Whether to fetch all choreographies.
  • transaction (Transaction, optional) — Ambient transaction to join, used when a lineup mutation is guarded and must be rolled back atomically.

Returns

  • Promise.<Choreo> — The updated choreography.

remove( id: UUID, actingUserId: UUID, isAdmin?: boolean, options?: Object, ): Promise.<void>

Remove a Choreo

Parameters

  • id (UUID) — The choreography's UUID.
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }") — Options for the query.
    • options.all (boolean, optional, default: false) — Whether to fetch all choreographies.

Returns

  • Promise.<void>