Skip to content

Admin · Repositories

0 modules · 0 exports · 3 repositories · 5 e2e tests · 2 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.

AdminRepository

app/features/admin/AdminRepository.server.ts
Tables
AllTeamMemberApiTokenBadgeBadgeManagerBanLogBuildGroupMemberLFGPostModNotePendingTrophyPendingTrophyApprovalPlusTierSpecialTrophyOwnerSplatoonPlayerTeamMemberTournamentBadgeOwnerTournamentStreamerTournamentTeamMemberTrophyTrophyOwnerUnvalidatedUserSubmittedImageUserUserFriendCodeUserReport
Calls
BadgeRepositoryBuildRepositoryXRankPlacementRepositoryTrophyRepository
Imports
no other modules
Used by
1 loader3 actions1 script3 other

Functions & values

function

replacePlusTiers

:388

Replaces every PlusTier row, also refreshing the build sort values derived from them.

export function replacePlusTiers(
	plusTiers: Array<{ userId: number; plusTier: number }>,
)
Unit tests (2)
function

makeVideoAdderByUserId

no JSDoc:406
export function makeVideoAdderByUserId(userId: number)
TablesUser
function

makeArtistByUserId

no JSDoc:414
export function makeArtistByUserId(userId: number)
TablesUser
function

makeTournamentOrganizerByUserId

no JSDoc:422
export function makeTournamentOrganizerByUserId(userId: number)
TablesUser
function

makeApiAccesserByUserId

no JSDoc:430
export function makeApiAccesserByUserId(userId: number)
TablesUser
function

linkUserAndPlayer

no JSDoc:438
export async function linkUserAndPlayer({
	userId,
	playerId,
}: {
	userId: number;
	playerId: number;
})
Actions/admin
function

forcePatron

no JSDoc:464
export async function forcePatron(args: {
	id: number;
	patronTier: Tables["User"]["patronTier"];
	patronStartedAt: Date;
	patronExpiresAt: Date;
})
TablesUser
function

banUser

:498

Bans the user, logging it unless it's an automatic ban. Revokes their API tokens.

export function banUser({
	userId,
	banned,
	bannedReason,
	bannedByUserId,
}: {
	userId: number;
	banned: 1 | Date;
	bannedReason: string | null;
	/** null means an automatic ban. */
	bannedByUserId: number | null;
})
Unit tests (7)
function

unbanUser

no JSDoc:537
export function unbanUser({
	userId,
	unbannedByUserId,
}: {
	userId: number;
	unbannedByUserId: number;
})
Unit tests (4)
Actions/admin
function

addModNote

no JSDoc:567
export function addModNote(
	args: Omit<TablesInsertable["ModNote"], "authorId">,
)
TablesModNote
function

findModNoteById

no JSDoc:576
export function findModNoteById(id: number)
TablesModNote
function

deleteModNote

no JSDoc:584
export function deleteModNote(id: number)
TablesModNote

ExternalStreamRepository

app/features/admin/ExternalStreamRepository.server.ts
Tables
ExternalStreamUserSubmittedImage
Calls
no other repositories
Imports
no other modules
Used by
1 loader1 action1 routine1 script1 other

Functions & values

function

insert

:10

Inserts an admin-curated external stream.

export function insert(
	args: Pick<
		TablesInsertable["ExternalStream"],
		"name" | "url" | "avatarImgId" | "startsAt"
	>,
)
function

deleteById

:20

Deletes an external stream by its id.

export function deleteById(id: number)
function

findAll

:25

All external streams, soonest first.

export function findAll()
function

findAllForSidebar

:47

Streams started under 6h ago or upcoming.

export function findAllForSidebar()
function

deleteOld

:73

Deletes streams that started over 24h ago.

export function deleteOld()

ModAuditLogRepository

app/features/admin/ModAuditLogRepository.server.ts
Tables
ModAuditLog
Calls
no other repositories
Imports
Seasons
Used by
1 loader1 repository1 script1 other

Functions & values

function

insert

:11

Logs a text written by the acting user, in the caller's transaction.

export function insert(
	{ type, text }: { type: ModAuditLogType; text: string },
	trx: Transaction<DB>,
)
function

findSeasonByUserId

:23

Texts of the type the user wrote during the season, newest first.

export function findSeasonByUserId({
	userId,
	season,
	type,
}: {
	userId: number;
	season: number;
	type: ModAuditLogType;
})
Unit tests (3)