BadgeRepository
app/features/badges/BadgeRepository.server.ts- Tables
- BadgeBadgeManagerBadgeOwnerSplatoonPlayerTournamentBadgeOwnerUserUserSubmittedImage
- Calls
- no other repositories
- Imports
- no other modules
- Used by
- 5 loaders4 actions1 route1 repository4 scripts2 other
Functions & values
Adds a badge. authorId is who made it, null for a legacy badge.
export function insert( args: Pick< TablesInsertable["Badge"], "code" | "displayName" | "hue" | "authorId" >, )
TablesBadge
export async function findAll()
Loaders/badges
export async function findById(badgeId: number)
Loaders/badges/:id
export function findManagedByUserId(userId: number)
TablesBadgeBadgeManager
Loaders/calendar/new
Actions/calendar/new
Takes a constant userId on purpose: correlating to an outer "User"."id" would stop SQLite pushing the predicate into both arms of the BadgeOwner view, materializing the full view.
export async function findByOwnerUserId( userId: number, favoriteBadgeIds: number[], )
TablesBadgeBadgeOwnerUser
export function findByAuthorUserId(userId: number)
TablesBadge
export function replaceManagers({ badgeId, managerIds, }: { badgeId: number; managerIds: number[]; })
TablesBadgeManager
Unit tests (1)
Actions/badges/:id/edit
export function replaceOwners({ badgeId, ownerIds, }: { badgeId: number; ownerIds: number[]; })
TablesTournamentBadgeOwner
Unit tests (1)
Actions/badges/:id/edit
export async function syncXPBadges()