Skip to content

Tournament organization · Repositories

2 modules · 2 exports · 1 repository · 5 e2e tests · 4 routes

Every table a function queries, its own helpers included, read or written. Calls to other repositories are listed apart, their tables are on their own page.

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

function

insert

no JSDoc:33
export function insert(args: CreateArgs)
function

findByUserId

no JSDoc:143
export function findByUserId(
	userId: number,
	{
		roles = [],
	}: {
		/** If set, filters organizations by user's org member role */
		roles?: Array<Tables["TournamentOrganizationMember"]["role"]>;
	} = {},
)
Unit tests (3)
function

searchByName

no JSDoc:183
export function searchByName({
	query,
	limit,
}: {
	query: string;
	limit: number;
})
function

findOneById

no JSDoc:217
export function findOneById(id: number)
Routes/search
function

findAllSeries

:378

Every tournament series of every organization.

export function findAllSeries()
function

findAllOrganizedTournamentTeamCounts

:393

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;
})
function

findAllUnfinalizedEvents

no JSDoc:431
export function findAllUnfinalizedEvents(organizationId: number)
function

findPaginatedEventsBySeries

no JSDoc:441
export async function findPaginatedEventsBySeries({
	organizationId,
	substringMatches,
	page,
}: {
	organizationId: number;
	substringMatches: string[];
	page: number;
})
Unit tests (2)
function

findAllEventsBySeries

:480

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[];
})
function

findAllSeriesByOrganizationIds

:511

Series belonging to any of the given organizations.

export async function findAllSeriesByOrganizationIds(
	organizationIds: number[],
)
function

findAllSeriesWinsByUserId

:532

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)
function

countActiveParticipants

:620

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)
function

deleteOwnMembership

no JSDoc:817
export function deleteOwnMembership(organizationId: number)
Actions/org/:slug
function

upsertBannedUser

:826

Bans a user from the organization, updating the entry if they already are.

export function upsertBannedUser(
	args: Omit<TablesInsertable["TournamentOrganizationBannedUser"], "updatedAt">,
)
Actions/org/:slug
function

unbanUser

:836

Removes a user from the organization's banned list.

export function unbanUser({
	organizationId,
	userId,
}: {
	organizationId: number;
	userId: number;
})
Actions/org/:slug
function

findAllBannedUsersByOrganizationId

:851

All users banned by the organization.

export function findAllBannedUsersByOrganizationId(organizationId: number)
function

isUserBannedByOrganization

:871

Whether the organization has banned the user.

export async function isUserBannedByOrganization({
	organizationId,
	userId,
}: {
	organizationId: number;
	userId: number;
})
function

countOrganizationsByUserId

:893

How many organizations the user is a member of.

export async function countOrganizationsByUserId(userId: number)
function

updateIsEstablished

:904

Sets the organization's isEstablished flag.

export function updateIsEstablished(
	organizationId: number,
	isEstablished: boolean,
)
function

deleteById

no JSDoc:915
export function deleteById(organizationId: number)
Actions/org/:slug
function

updateSeriesTierHistory

no JSDoc:922
export async function updateSeriesTierHistory({
	organizationId,
	eventName,
	newTier,
}: {
	organizationId: number;
	eventName: string;
	newTier: TournamentTierNumber;
})