TournamentOrganizationRepository
app/features/tournament-organization/TournamentOrganizationRepository.server.ts- Tables
- AllTeamBadgeCalendarEventCalendarEventDateCalendarEventResultPlayerCalendarEventResultTeamTournamentTournamentMatchGameResultParticipantTournamentOrganizationTournamentOrganizationBadgeTournamentOrganizationBannedUserTournamentOrganizationMemberTournamentOrganizationSeriesTournamentResultTournamentTeamTournamentTeamCheckInUnvalidatedUserSubmittedImageUserUserSubmittedImage
- Calls
- no other repositories
- Imports
- no other modules
- Used by
- 6 loaders3 actions1 route1 repository2 modules1 script9 other
Functions & values
export function insert(args: CreateArgs)
export async function findBySlug(slug: string)
export function findByUserId( userId: number, { roles = [], }: { /** If set, filters organizations by user's org member role */ roles?: Array<Tables["TournamentOrganizationMember"]["role"]>; } = {}, )
Unit tests (3)
export function searchByName({ query, limit, }: { query: string; limit: number; })
export function findOneById(id: number)
export async function findEventsByMonth({ month, year, organizationId, }: FindEventsByMonthArgs)
Unit tests (2)
Every tournament series of every organization.
export function findAllSeries()
Team counts of each organization's started tournaments within the window, oldest first. Counts what the tournament page shows: placeholder teams excluded, dropped out ones included.
export function findAllOrganizedTournamentTeamCounts({ startedAfter, }: { startedAfter: number; })
export function findAllUnfinalizedEvents(organizationId: number)
export async function findPaginatedEventsBySeries({ organizationId, substringMatches, page, }: { organizationId: number; substringMatches: string[]; page: number; })
Every event of the series, newest first, with only what the leaderboard and series header need: the winners of {@link findPaginatedEventsBySeries} are far too costly across a whole series.
export async function findAllEventsBySeries({ organizationId, substringMatches, }: { organizationId: number; substringMatches: string[]; })
Series belonging to any of the given organizations.
export async function findAllSeriesByOrganizationIds( organizationIds: number[], )
Events of the series the user won, oldest first, hosted tournaments and hand-reported results alike. Only finalized tournaments have results, so ongoing events are never included.
export async function findAllSeriesWinsByUserId({ organizationId, substringMatches, userId, excludeTournamentId, }: { organizationId: number; substringMatches: string[]; userId: number; excludeTournamentId: number; })
Unit tests (6)
Distinct players on checked-in (not checked out) teams who played at least one match of the organization's tournaments starting within [startTime, endTime] (database timestamps, seconds).
export async function countActiveParticipants({ organizationId, startTime, endTime, }: { organizationId: number; startTime: number; endTime: number; })
Unit tests (6)
export function update({ id, name, description, socials, avatarImgId, members, series, badges, }: UpdateArgs)
export function deleteOwnMembership(organizationId: number)
Bans a user from the organization, updating the entry if they already are.
export function upsertBannedUser( args: Omit<TablesInsertable["TournamentOrganizationBannedUser"], "updatedAt">, )
Removes a user from the organization's banned list.
export function unbanUser({ organizationId, userId, }: { organizationId: number; userId: number; })
All users banned by the organization.
export function findAllBannedUsersByOrganizationId(organizationId: number)
Whether the organization has banned the user.
export async function isUserBannedByOrganization({ organizationId, userId, }: { organizationId: number; userId: number; })
How many organizations the user is a member of.
export async function countOrganizationsByUserId(userId: number)
Sets the organization's isEstablished flag.
export function updateIsEstablished( organizationId: number, isEstablished: boolean, )
export async function updateSeriesTierHistory({ organizationId, eventName, newTier, }: { organizationId: number; eventName: string; newTier: TournamentTierNumber; })