LineupService

Source: LineupService.js:21

Service for managing lineup entities and their associations. Handles CRUD operations and lineup-specific logic.


Constructor

new LineupService(): LineupService

Instance Methods

create( startCount: number, endCount: number, ChoreoId: UUID, actingUserId: UUID, ): Promise.<Object>

Create a new lineup.

Parameters

  • startCount (number) — The start count of the lineup.
  • endCount (number) — The end count of the lineup.
  • ChoreoId (UUID) — The choreography ID.
  • actingUserId (UUID) — The acting user ID.

Returns

  • Promise.<Object> — The created lineup.

findOrCreate( x: number, y: number, LineupId: UUID, MemberId: UUID, actingUserId: UUID, timeOfManualUpdate?: Date, ): Promise.<Object>

Find or create a lineup.

Parameters

  • x (number) — The x-coordinate of the lineup.
  • y (number) — The y-coordinate of the lineup.
  • LineupId (UUID) — The lineup ID associated with the lineup.
  • MemberId (UUID) — The member ID associated with the lineup.
  • actingUserId (UUID) — The acting user ID.
  • timeOfManualUpdate (Date, optional, default: "new Date()")

Returns

  • Promise.<Object> — The found or created lineup.

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

Update a lineup's count range.

Rejects any attempt to move the lineup to another choreography. When the count range actually changes, the update runs under the lineup conflict guard so it is rejected if it would overlap another lineup or put a member in two overlapping lineups; a timestamp-only update skips the guard.

Parameters

  • id (UUID) — The lineup ID.
  • data (Object) — Fields to update (e.g. startCount, endCount).
  • actingUserId (UUID) — The acting user ID.
  • isAdmin (boolean, optional, default: false) — Whether the acting user is an admin.

Returns

  • Promise.<Object> — The updated lineup with its positions and members.

Throws

  • NotFoundError — If no lineup exists with the given ID.
  • FaultyInputError — If data contains ChoreoId/choreoId (lineups cannot be moved between choreographies).
  • LineupConflictError — If a range change introduces a lineup overlap or member conflict.

touch(id: UUID, actingUserId: UUID): Promise.<Object>

Bump a lineup's timestamp without touching its range.

Parameters

  • id (UUID) — The lineup ID.
  • actingUserId (UUID) — The acting user ID.

Returns

  • Promise.<Object> — The updated lineup.

findById( id: UUID, ownerIds: Array.<UUID>, actingUserId: UUID, ): Promise.<Object>

Find a lineup by ID.

Parameters

  • id (UUID) — The lineup ID.
  • ownerIds (Array.<UUID>) — Array of owner IDs the acting user has access to.
  • actingUserId (UUID) — The acting user ID.

Returns

  • Promise.<Object> — The found lineup.

findByChoreoId(ChoreoId: UUID): Promise.<Array>

Get all lineups for a choreography.

Parameters

  • ChoreoId (UUID) — The choreography ID.

Returns

  • Promise.<Array> — List of lineups.

remove(id: UUID, actingUserId: UUID): Promise.<void>

Remove a lineup.

Parameters

  • id (UUID) — The lineup ID.
  • actingUserId (UUID) — The acting user ID.

Returns

  • Promise.<void> — Resolves when the lineup is removed.