Skip to content

Broadcast · Repositories

7 modules · 55 exports · 1 repository · 9 e2e tests · 1 route

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.

BroadcastRepository

app/features/broadcast/BroadcastRepository.server.ts
Tables
CalendarEventTournamentTournamentBroadcastTournamentTeamMemberUnvalidatedUserSubmittedImageUserUserBroadcastProgramUserSubmittedImageUserWeaponPool
Calls
ChatRepository
Imports
Producer
Used by
2 loaders1 action3 modules1 script3 other

Functions & values

function

findByChannel

:36

Producer state, settings and chat room of the channel's broadcast, undefined before anything was written to it.

export function findByChannel({ tournamentId, channel }: BroadcastKey)
function

findAllByChatRoomIds

:52

Broadcasts owning the given chat rooms, with their tournament's cast accounts to find the channel by.

export async function findAllByChatRoomIds(chatRoomIds: number[])
function

findAllPlayersByTournamentTeamIds

:84

Members of the teams with their top weapons (favorites first, then the pool's order), owner first then in joining order.

export function findAllPlayersByTournamentTeamIds(tournamentTeamIds: number[])
function

updateState

:116

Sets the producer state's fields that apply as soon as set, leaving the rest of it as it is.

export async function updateState({
	patch,
	...key
}: WriteArgs & {
	patch: Partial<Pick<BroadcastStoredState, "liveResults" | "ink">>;
})
Unit tests (1)
function

updateProducer

:143

Replaces the producer state with what change makes of it, read and written in one transaction so changes made at the same time (e.g. two producers, or an automatic Take) don't overwrite each other. change returning null leaves the state as it is. Returns whether it was changed.

export function updateProducer<Item extends ProducerState>({
	change,
	...key
}: WriteArgs<Item> & {
	change: (
		state: BroadcastStoredState<Item>,
	) => BroadcastStoredState<Item> | null;
})
Unit tests (3)
function

updateSettings

:178

Sets the given settings, leaving the others as they are (the theme and the show info are saved by separate forms).

export async function updateSettings<
	Settings extends BroadcastSettings = BroadcastSettings,
>({ patch, ...key }: WriteArgs & { patch: Partial<Settings> })
Unit tests (1)
function

findProgramByKey

:198

The OBS URL of the program key: whose and which channel's it is and the broadcast it shows, undefined for an unknown key.

export function findProgramByKey(programKey: string)
function

findProgram

:221

The user's OBS URL for the channel: its key and the broadcast it shows with its tournament's name (nulls before it is pointed at one). undefined before the user generated it.

export function findProgram({
	userId,
	channel,
}: {
	userId: number;
	channel: BroadcastKey["channel"];
})
function

findProgramChannelsByTournament

:252

Channels whose OBS URL of the user shows one of the tournament's broadcasts.

export function findProgramChannelsByTournament({
	userId,
	tournamentId,
}: {
	userId: number;
	tournamentId: number;
})
function

pointProgram

:276

Points the user's OBS URL for the channel at the channel's broadcast in the tournament, creating the URL (with a new random key) or the broadcast when missing. Returns the URL's id and key.

export function pointProgram({
	userId,
	...key
}: WriteArgs & {
	userId: number;
})
function

refreshProgramKey

:308

Gives the user's OBS URL for the channel a new random key, replacing the one it had. Returns the URL's id and new key, undefined without a URL.

export function refreshProgramKey({
	userId,
	channel,
}: {
	userId: number;
	channel: BroadcastKey["channel"];
})
function

insertChatRoomIfMissing

:329

Gives the channel's broadcast its chat room, creating the broadcast too when nothing was written to it yet. Returns the room's id and whether it was created now.

export function insertChatRoomIfMissing({
	expiresAt,
	...key
}: WriteArgs & { expiresAt: Date })
Unit tests (2)
Unit tests not about one export (2)