TrophyRepository
app/features/trophies/TrophyRepository.server.ts- Tables
- CalendarEventCalendarEventDatePendingTrophyPendingTrophyApprovalReportedWeaponSpecialTrophyOwnerSplatoonPlayerTournamentTournamentDivisionTierTournamentMatchTournamentOrganizationTournamentResultTournamentStageTournamentTeamTrophyTrophyOwnerUnvalidatedUserSubmittedImageUserUserSubmittedImageXRankPlacement
- Calls
- TournamentOrganizationRepository
- Imports
- XpTrophy
- Used by
- 6 loaders3 actions4 routes2 repositories1 module2 scripts2 other
Functions & values
Tournament trophies, special ones are listed by their own functions.
export async function all()
Loaders/trophies
export async function findByOrganizationIds(organizationIds: number[])
TablesTrophy
Loaders/calendar/new
export async function findByOwnerUserId(userId: number)
export async function findByOwnerUserIdIncludingHidden(userId: number)
Loaders/u/:identifier/edit
export async function findById(trophyId: number)
PermissionsEDIT
Loaders/trophies/:id
Actions/trophies/new
export async function findTournamentsByTrophyId(trophyId: number)
export async function findWinsByOwner({ trophyId, userId, }: { trophyId: number; userId: number; })
Whether the trophy is a regular (not special) trophy of the organization, i.e. one its tournaments can award.
export async function isAwardableByOrganization({ trophyId, organizationId, }: { trophyId: number; organizationId: number; })
TablesTrophy
Actions/calendar/new
Whether the name is taken by a trophy or a submission still awaiting review.
export async function existsByName(args: { name: string; excludeTrophyId?: number; })
TablesPendingTrophyTrophy
Unit tests (4)
Actions/trophies/new
export async function findCodeById(trophyId: number)
TablesTrophy
export function findXpWeaponCountsById({ trophyId, weaponIds, milestone, }: { trophyId: number; weaponIds: readonly MainWeaponId[]; milestone: number; })
Loaders/trophies/:id
export async function findAllForEditing()
Loaders/trophies/new
export function findAllBackfillableTournaments({ organizationId, substringMatches, }: { organizationId: number; substringMatches: string[]; })
export async function insertTournamentOwners( awards: TournamentOwnersArgs[], trx: Transaction<DB>, )
Repositoriestournament/TournamentRepository.server.ts
export function backfill({ trophyId, awards, }: { trophyId: number; awards: Array<Omit<TournamentOwnersArgs, "trophyId">>; })
Unit tests (3)
Actions/trophies/new
Recomputes X Power trophy ownership from the Top 500 placements of linked players (see {@link XpTrophy.awards}). Still-eligible owners keep their createdAt.
export function syncSpecialTrophies()
Unit tests (4)
export async function createPending(args: { name: string; model: string; description: string; organizationId: number; submitterUserId: number; targetTrophyId?: number; managerId?: number; creatorId?: number; })
TablesPendingTrophy
Actions/trophies/new
export async function findPendingById(id: number)
Actions/trophies/new
export async function allPending()
Loaders/trophies/new
export async function pendingBySubmitter(submitterUserId: number)
Loaders/trophies/new
export async function unreviewedCountBySubmitter(submitterUserId: number)
TablesPendingTrophy
Loaders/trophies/new
Actions/trophies/new
export async function declinePending(args: { id: number; reason: string; declinedByUserId: number; })
Actions/trophies/new
export async function addApproval(args: { pendingTrophyId: number; userId: number; })
Actions/trophies/new
Unit tests not about one export (14)
- trophy approvals › creates the trophy exactly once when approvals exceed the required count
- trophy approvals › the named creator becomes the trophy's creator
- trophy approvals › ignores repeated approvals from the same user
- trophy approvals › re-approval after acceptance does not create another trophy
- trophy approvals › declines a pending trophy that is not accepted
- trophy approvals › does not decline an already accepted pending trophy
- trophy approvals › stays accepted even if approvals drop below the required count
- trophy approvals › approvals after a decline do not create a trophy
- trophy list tiers › an upcoming tournament without tier info does not hide the earned tier
- trophy list tiers › uses the most recent tier when multiple tournaments have one
- trophy list tiers › has no tier when no linked tournament has tier info
- trophy list tiers › returns the start time of the next upcoming tournament
- trophy list tiers › sorts trophies with an upcoming tournament first within the same tier
- user deletion › keeps their trophies and drops their approvals