Skip to content

Builds · Repositories

0 modules · 0 exports · 1 repository · 8 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.

BuildRepository

app/features/builds/BuildRepository.server.ts
Tables
BuildBuildAbilitySumBuildWeaponBuildWeaponAbilityPlusTierSplatoonPlayerUserUserSubmittedImageXRankPlacement
Calls
no other repositories
Imports
no other modules
Used by
5 loaders2 actions1 repository2 scripts6 other

Functions & values

function

findAllByUserId

no JSDoc:46
export async function findAllByUserId(
	userId: number,
	options: {
		showPrivate?: boolean;
		sortAbilities?: boolean;
		limit?: number;
	} = {},
)
PermissionsEDIT
function

update

no JSDoc:146
export async function update(args: CreateArgs & { id: number })
function

deleteById

no JSDoc:188
export function deleteById(id: number)
TablesBuild
function

findOwnerIdById

no JSDoc:192
export async function findOwnerIdById(buildId: number)
TablesBuild
function

findAllAbilityPointSums

:203

Ability point sums of every public build updated after the date (YYYY-MM-DD, all when null), a build counted once however many weapons it lists.

export async function findAllAbilityPointSums(updatedSince: string | null)
Unit tests (2)
function

findAbilityPointCountsByWeaponIds

:239

For each of the weapons (alt skins folded), how many public builds updated after the date (YYYY-MM-DD, all when null) run each amount of AP of each ability, plus their build counts.

export async function findAbilityPointCountsByWeaponIds({
	weaponIds,
	updatedSince,
}: {
	weaponIds: MainWeaponId[];
	updatedSince: string | null;
})
Unit tests (2)
function

findNewestBuildPerOwnerByWeaponId

:299

The newest public build of each owner listing the weapon (alt skins folded), if updated after the date (YYYY-MM-DD, any time when null).

export async function findNewestBuildPerOwnerByWeaponId({
	weaponId,
	updatedSince,
}: {
	weaponId: MainWeaponId;
	updatedSince: string | null;
})
Unit tests (4)
function

findPageByWeaponId

:356

A page of the authors of public builds listing the weapon (alt skins folded) that match the filters, with all of their matching builds. Authors rank by their best ranked build and their builds come together, best first. buildCount counts every matching build but only while filtering (null otherwise, as it would cost an extra read).

export async function findPageByWeaponId({
	weaponId,
	filters,
	page,
	sortAbilities: shouldSortAbilities,
}: {
	weaponId: MainWeaponId;
	filters: BuildListFilters;
	page: number;
	sortAbilities: boolean;
})
Unit tests (8)
function

findPageByUserId

:451

A page of the user's builds matching the filters, in their chosen sort order.

export async function findPageByUserId({
	userId,
	showPrivate,
	filters,
	sorting,
	page,
	sortAbilities: shouldSortAbilities,
}: {
	userId: number;
	showPrivate: boolean;
	filters: BuildListFilters & {
		/** Exact weapon id, alt skins and kits not folded. */
		weaponId: MainWeaponId | null;
		visibility: "PUBLIC" | "PRIVATE" | null;
	};
	sorting: {
		buildSorting: BuildSort[] | null;
		weaponPool: MainWeaponId[];
	};
	page: number;
	sortAbilities: boolean;
})
PermissionsEDIT
Unit tests (17)
function

countsByUserId

:534

How many builds the user has, how many of them are private and the count per (exact) weapon id.

export async function countsByUserId(
	userId: number,
	{ showPrivate }: { showPrivate: boolean },
)
Unit tests (2)
function

countAllPublicByWeaponId

:570

Public build count per canonical weapon id (alt skins folded), weapons without builds omitted.

export async function countAllPublicByWeaponId()
Unit tests (2)
function

recalculateAllSortValues

:585

Recomputes BuildWeapon.sortValue (plus tier + per-weapon top500), for one user's builds if given.

export async function recalculateAllSortValues(
	userId?: number,
	trx?: Transaction<DB>,
)
Unit tests not about one export (16)

Not shown, only used by tests: BuildListFilters