Skip to content

User page · Repositories

1 module · 2 exports · 1 repository · 14 e2e tests · 16 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.

UserRepository

app/features/user-page/UserRepository.server.ts
Tables
ArtArtUserMetadataBanLogBuildCalendarEventCalendarEventDateCalendarEventResultPlayerCalendarEventResultTeamModNotePlusTierTeamTeamMemberTeamMemberWithSecondaryTournamentTournamentDivisionTierTournamentResultTournamentTeamUnvalidatedUserSubmittedImageUserUserFriendCodeUserResultHighlightUserSearchUserSubmittedImageUserWeaponPoolUserWidgetVideoMatchVideoMatchPlayer
Calls
ArtRepositoryBadgeRepositoryBuildRepositoryFriendRepositoryLeaderboardRepositoryLFGRepositoryLiveStreamRepositoryMatchProfileRepositorySkillRepositoryTeamRepositoryXRankPlacementRepositoryTournamentOrganizationRepositoryTournamentTeamRepositoryTrophyRepositoryVodRepository
Imports
no other modules
Used by
15 loaders18 actions7 routes2 modules3 routines3 scripts12 other

Types

interface

ResultsFilters

no JSDoc:541
export interface ResultsFilters {
	showHighlightsOnly?: boolean;
	tournamentName?: string;
	teamName?: string;
	mateUserId?: number;
	minTier?: TournamentTierNumber;
	maxTier?: TournamentTierNumber;
	maxPlacement?: number;
	fromYear?: number;
	toYear?: number;
	source?: ResultSource;
	minParticipantCount?: number;
}
Only used inside the module
type

UpdatePatronDataArgs

no JSDoc:1528
export type UpdatePatronDataArgs = Array<
	Pick<Tables["User"], "discordId" | "patronTier" | "patronStartedAt">
>;

Functions & values

function

findIdByIdentifier

no JSDoc:48
export function findIdByIdentifier(identifier: string)
TablesUser
function

findPageUserByIdentifier

:53

Identity of the user a /u/:identifier page is about, incl. what their canonical page URL needs.

export function findPageUserByIdentifier(identifier: string)
TablesUser
function

findCountriesByUserIds

:60

Country codes of the given users keyed by user id, users without a country set absent.

export async function findCountriesByUserIds(userIds: number[])
TablesUser
function

findDiscordIdsByUserIds

:75

Discord ids of the given users keyed by user id. Not for public responses.

export async function findDiscordIdsByUserIds(userIds: number[])
TablesUser
function

findPlusTiersByUserIds

:88

Plus tiers of the given users keyed by user id, users without a tier absent.

export async function findPlusTiersByUserIds(userIds: number[])
TablesPlusTier
function

findBuildFieldsByUserId

no JSDoc:100
export async function findBuildFieldsByUserId(userId: number)
function

findLayoutDataById

no JSDoc:126
export function findLayoutDataById(userId: number, loggedInUserId?: number)
function

findProfileByUserId

no JSDoc:208
export async function findProfileByUserId(userId: number)
function

upsertWidgets

no JSDoc:272
export async function upsertWidgets(
	userId: number,
	widgets: Array<Tables["UserWidget"]["widget"]>,
)
function

findStoredWidgetsByUserId

no JSDoc:292
export async function findStoredWidgetsByUserId(
	userId: number,
): Promise<Array<Tables["UserWidget"]["widget"]>>
function

findByCustomUrl

no JSDoc:342
export function findByCustomUrl(customUrl: string)
TablesUser
function

findByFriendCode

no JSDoc:350
export function findByFriendCode(friendCode: string)
function

findUsernameById

no JSDoc:359
export async function findUsernameById(id: number)
TablesUser
function

findModInfoById

no JSDoc:429
export function findModInfoById(id: number)
function

findAllPatrons

no JSDoc:472
export function findAllPatrons()
TablesUser
function

findAllPatronsForFooter

:491

Patrons for the footer marquee, reshuffled each UTC day and slimmed to the fields the chip renders.

export async function findAllPatronsForFooter()
TablesUser
function

findAllPlusServerMembers

no JSDoc:517
export function findAllPlusServerMembers()
function

existingUserIds

no JSDoc:529
export async function existingUserIds(userIds: Array<number>)
TablesUser
function

hasHighlightedResultsByUserId

no JSDoc:958
export async function hasHighlightedResultsByUserId(userId: number)
function

findResultPlacementsByUserId

no JSDoc:981
export async function findResultPlacementsByUserId(userId: number)
functionno JSDoc:1013
export async function search({
	query,
	limit,
}: {
	query: string;
	limit: number;
})
function

searchExact

no JSDoc:1093
export function searchExact(args: {
	id?: number;
	discordId?: string;
	customUrl?: string;
})
function

findCurrentFriendCodeByUserId

no JSDoc:1125
export async function findCurrentFriendCodeByUserId(userId: number)
function

findFriendCodesByUserId

:1140

All friend codes a user has ever submitted.

export async function findFriendCodesByUserId(userId: number)
function

clearFriendCodesCache

:1157

Drops the cached friend codes, for when the table was written to behind this module's back.

export function clearFriendCodesCache()
function

findAllCurrentFriendCodes

no JSDoc:1161
export async function findAllCurrentFriendCodes()
function

findInGameNameByUserId

no JSDoc:1189
export async function findInGameNameByUserId(userId: number)
TablesUser
function

findPatronStartedAtByUserId

no JSDoc:1199
export async function findPatronStartedAtByUserId(userId: number)
TablesUser
function

findDivByUserId

:1210

Division and season of the last LUTI the user placed in, null when they never have.

export async function findDivByUserId(userId: number)
TablesUser
function

findJoinOrderByUserId

no JSDoc:1222
export async function findJoinOrderByUserId(userId: number)
TablesUser
function

findCommissionsByUserId

no JSDoc:1237
export async function findCommissionsByUserId(userId: number)
TablesUser
function

insertFriendCode

no JSDoc:1249
export function insertFriendCode(args: TablesInsertable["UserFriendCode"])
function

upsert

:1256

Inserts or updates the user by Discord id. The avatar is stored separately via {@link replaceSyncedAvatar}.

export function upsert(
	args: Pick<
		TablesInsertable["User"],
		| "discordId"
		| "discordName"
		| "discordUniqueName"
		| "twitch"
		| "youtubeId"
		| "youtubeName"
		| "bsky"
	>,
)
TablesUser
function

replaceSyncedAvatar

:1296

Points the user's synced avatar at a newly stored image file (null = no avatar) and deletes the previous image row. Returns the previous file name so its files can be deleted from storage.

export function replaceSyncedAvatar({
	userId,
	discordAvatar,
	fileName,
}: {
	userId: number;
	/** Hash of the Discord avatar the file was copied from. */
	discordAvatar: string | null;
	fileName: string | null;
})
function

updateOwnProfile

no JSDoc:1364
export function updateOwnProfile(args: UpdateProfileArgs)
function

updateManyDivs

:1420

Bulk-sets each user's latest LUTI division. Used by the ComputeLutiDivs routine.

export function updateManyDivs(
	updates: Array<{ userId: number; div: string; divSeason: number | null }>,
)
TablesUser
function

updateOwnCustomTheme

no JSDoc:1436
export function updateOwnCustomTheme(css: CustomTheme | null)
TablesUser
function

updateOwnPreferences

no JSDoc:1446
export function updateOwnPreferences(newPreferences: UserPreferences)
TablesUser
function

updateOwnResultHighlights

no JSDoc:1477
export function updateOwnResultHighlights(args: UpdateResultHighlightsArgs)
function

updateOwnBuildSorting

no JSDoc:1520
export function updateOwnBuildSorting(buildSorting: BuildSort[] | null)
TablesUser
function

updatePatronData

no JSDoc:1531
export function updatePatronData(users: UpdatePatronDataArgs)
TablesUser
function

anyUserPrefersNoScreen

no JSDoc:1562
export async function anyUserPrefersNoScreen(
	userIds: number[],
): Promise<boolean>
TablesUser
function

findSocialLinksByUserId

no JSDoc:1577
export async function findSocialLinksByUserId(userId: number)
TablesUser
function

findIdsByStreamAccounts

:1639

Users whose connected Twitch login or YouTube channel id is among the given ones.

export function findIdsByStreamAccounts({
	twitchNames,
	youtubeIds,
}: {
	twitchNames: string[];
	youtubeIds: string[];
})
TablesUser