XRankPlacementRepository
app/features/top-search/XRankPlacementRepository.server.ts- Tables
- SplatoonPlayerTenStarWeaponUserXRankPlacement
- Calls
- no other repositories
- Imports
- no other modules
- Used by
- 3 loaders1 action1 route1 repository1 component2 scripts2 other
Types
export type XRankPlacementInsertArgs = Omit< Tables["XRankPlacement"], "id" | "playerId" > & { /** In-game id of the player the placement belongs to. */ playerSplId: string; /** For sources that already know the pairing; claiming later goes through `AdminRepository.linkUserAndPlayer`. */ playerUserId?: number; };
export type FindPlacement = InferResult< ReturnType<typeof xRankPlacementsQueryBase> >[number];
Componentstop-search/Placements.tsx
Functions & values
Inserts placements, creating SplatoonPlayer rows for new in-game ids. Returns ids in insertion order.
export function insertMany(placements: XRankPlacementInsertArgs[])
Removes every placement of the given month.
export function deleteAllByMonthYear( args: Pick<Tables["XRankPlacement"], "month" | "year">, )
TablesXRankPlacement
Scriptsscripts/placements/index.ts
Whether the user has a linked Splatoon player (i.e. has claimed their X Rank results).
export async function isPlayerLinkedByUserId(userId: number): Promise<boolean>
TablesSplatoonPlayer
Loaders/user-card/edit
Weapons the user has a ten-star badge for, from their linked X Rank placements.
export async function findTenStarWeaponSplIdsByUserId(userId: number)
TablesTenStarWeapon
From the linked player's denormalized SplatoonPlayer.peakXp (see {@link refreshAllPeakXp}); null without one.
export async function findPeakVerifiedXpByUserId( userId: Tables["User"]["id"], ): Promise<number | null>
TablesSplatoonPlayer
export async function findPlacementsOfMonth( args: Pick<Tables["XRankPlacement"], "mode" | "region" | "month" | "year">, )
Loaders/xsearch
export async function findPlacementsByPlayerId( playerId: Tables["XRankPlacement"]["playerId"], )
export async function findPlacementsByUserId( userId: Tables["User"]["id"], options?: { limit?: number; weaponId?: MainWeaponId; weaponIds?: readonly MainWeaponId[]; }, )
Every month with placements, newest first.
export async function findAllMonthYears()
TablesXRankPlacement
Loaders/xsearch
export async function findPeaksByUserId( userId: Tables["User"]["id"], division?: "both" | "tentatek" | "takoroka", )
export async function refreshAllPeakXp()
Unit tests (3)
export async function refreshTenStarWeapons(userId?: number)