ClubService

Source: ClubService.js:43

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


Constructor

new ClubService(): ClubService

Instance Methods

getAll( ownerIds: Array.<string> | null, actingUserId: UUID, isAdmin?: boolean, options?: Object, ): Array.<Club>

Get all Clubs with specified ownerId

Parameters

  • ownerIds (Array.<string> | null)
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }")
    • options.all (boolean, optional, default: false)

Returns

getCount(): number

Get the number of Clubs in the DB

Returns

  • number

getTrend(): number

Get the number of new Clubs minus then number of deleted Clubs in the last 30 days

Returns

  • number

findById(id: UUID, actingUserId: UUID, isAdmin?: boolean): Club

Find Club by its ID

Parameters

  • id (UUID)
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)

Returns

findByName( name: string, ownerIds: Array.<UUID>, actingUserId: UUID, isAdmin?: boolean, ): Array.<Club>

Find Club by its name

Parameters

  • name (string)
  • ownerIds (Array.<UUID>) — Array of owner IDs the acting user has access to
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)

Returns

create( name: string, ownerId: UUID | null, actingUserId: UUID, isAdmin?: boolean, ): Club

Create a new Club

Parameters

  • name (string)
  • ownerId (UUID | null) — Owner ID. If null/undefined, falls back to actingUserId
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)

Returns

seedDemo(club: Club, ownerId: UUID, actingUserId: UUID): void

Seed a demo team and choreo for a Club

Parameters

Returns

  • void

findOrCreate( name: string, ownerId: UUID | null, actingUserId: UUID, isAdmin?: boolean, ): Club

Find or create a club.

Parameters

  • name (string)
  • ownerId (UUID | null) — Owner ID. If null/undefined, falls back to actingUserId
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)

Returns

update( id: UUID, data: Object, actingUserId: UUID, isAdmin?: boolean, options?: Object, ): Club

Update a Club

Parameters

  • id (UUID)
  • data (Object)
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }")
    • options.all (boolean, optional, default: false)

Returns

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

Remove a Club

Parameters

  • id (UUID)
  • actingUserId (UUID)
  • isAdmin (boolean, optional, default: false)
  • options (Object, optional, default: "{ all: false }")
    • options.all (boolean, optional, default: false)

Returns

  • Promise.<void>