Skip to content

Feed · Repositories

15 modules · 52 exports · 5 repositories · 3 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.

FeedCommentRepository

app/features/feed/FeedCommentRepository.server.ts
Tables
FeedCommentUserUserSubmittedImage
Calls
no other repositories
Imports
no other modules
Used by
1 action1 module1 script

Functions & values

function

findByItemId

:8

The comments of the post as chat messages, oldest first.

export async function findByItemId(
	itemId: string,
): Promise<ChatMessageWithAuthor[]>
function

countByItemIds

:48

How many comments each of the posts has, posts without any left out.

export async function countByItemIds(
	itemIds: string[],
): Promise<Record<string, number>>
function

insert

:67

Adds a comment to the post, authorId filled from the logged in user. A resend with the same publicId is ignored.

export async function insert(
	args: Pick<
		TablesInsertable["FeedComment"],
		"itemId" | "publicId" | "contents"
	>,
)
Actions/feed/:id

FeedEventRepository

app/features/feed/FeedEventRepository.server.ts
Tables
CalendarEventCalendarEventDateFeedEventFeedIndexerCursorGroupGroupMatchGroupMatchMapGroupMemberSkillTournamentResult
Calls
no other repositories
Imports
no other modules
Used by
2 modules1 script

Types

type

FeedIndexerSource

no JSDoc:8
export type FeedIndexerSource = "SQ" | "TOURNAMENT";
Only used inside the module

Functions & values

function

findAllByUserIds

:11

Feed events of the users in the range.

export function findAllByUserIds({
	userIds,
	from,
	to,
}: {
	userIds: number[];
	from: number;
	to: number;
})
TablesFeedEvent
function

findCursorBySource

no JSDoc:36
export async function findCursorBySource(source: FeedIndexerSource)
function

findUserIdsOfMatchesConfirmedSince

:47

Players of the SendouQ matches confirmed at or after since, with when each was confirmed.

export function findUserIdsOfMatchesConfirmedSince(since: number)
function

findUserIdsOfTournamentResultsAfterRowId

:65

Players of the tournament results inserted after the result with the row id, with each result's row id.

export function findUserIdsOfTournamentResultsAfterRowId(rowId: number)
function

findUserIdsOfTournamentsStartedSince

:77

Players of the tournaments that started at or after since.

export function findUserIdsOfTournamentsStartedSince(since: number)
function

findLatestTournamentResultRowId

no JSDoc:92
export async function findLatestTournamentResultRowId()
function

findAllSqPlaysByUserId

:102

Every rated SendouQ set of the user, with whether their group won and the tiers both groups had when it started.

export function findAllSqPlaysByUserId(userId: number)
function

findAllTournamentPlaysByUserId

:172

Every tournament result of the user with when the tournament started.

export function findAllTournamentPlaysByUserId(userId: number)
function

replaceAllByUserId

:195

Replaces every feed event of the user with events.

export function replaceAllByUserId({
	userId,
	events,
}: {
	userId: number;
	events: Array<{ type: FeedEventType; at: number; data: FeedEventData }>;
})
TablesFeedEvent
function

deleteAllOfTypeBefore

no JSDoc:224
export function deleteAllOfTypeBefore({
	type,
	before,
}: {
	type: FeedEventType;
	before: number;
})
TablesFeedEvent
function

upsertCursor

no JSDoc:238
export function upsertCursor({
	source,
	position,
}: {
	source: FeedIndexerSource;
	position: Tables["FeedIndexerCursor"]["position"];
})

FeedFeedbackRepository

app/features/feed/FeedFeedbackRepository.server.ts
Tables
FeedFeedback
Calls
no other repositories
Imports
no other modules
Used by
1 action

Functions & values

function

upsertOwn

:6

Saves the logged in user's feedback on the post, replacing what they said about it before.

export async function upsertOwn(
	args: Pick<
		TablesInsertable["FeedFeedback"],
		"itemType" | "itemAt" | "kind" | "comment"
	>,
)
Actions/feed/:id
function

deleteOwn

no JSDoc:27
export async function deleteOwn({
	itemType,
	itemAt,
}: Pick<TablesInsertable["FeedFeedback"], "itemType" | "itemAt">)
Actions/feed/:id

FeedReactionRepository

app/features/feed/FeedReactionRepository.server.ts
Tables
FeedReaction
Calls
no other repositories
Imports
no other modules
Used by
1 loader1 action1 module1 script

Functions & values

function

findByItemIds

:5

How many reactions each of the posts has and which of them the user reacted to.

export async function findByItemIds({
	itemIds,
	userId,
}: {
	itemIds: string[];
	userId: number;
})
function

setOwn

:45

Reacts to the post as the logged in user, or takes the reaction back.

export async function setOwn({
	itemId,
	isReacted,
}: {
	itemId: string;
	isReacted: boolean;
})
Actions/feed/:id

FeedRepository

app/features/feed/FeedRepository.server.ts
Tables
AllTeamAllTeamMemberArtArtUserMetadataAssociationMemberAvailabilityWeekBadgeBuildBuildWeaponCalendarEventCalendarEventDateCalendarEventResultPlayerCalendarEventResultTeamFriendshipGroupMatchGroupMemberIngestedMatchLFGPostLobbyLobbyResultLobbySetMapResultPendingTrophyPlayerResultPlusSuggestionPlusTierReportedWeaponSavedCalendarEventScrimMapScrimPostScrimPostRequestScrimPostRequestUserScrimPostUserSkillSplatoonPlayerTeamEventTeamEventMemberTeamMemberWithSecondaryTournamentTournamentBadgeOwnerTournamentMatchTournamentMatchGameResultTournamentMatchGameResultParticipantTournamentMatchVodTournamentOrganizationTournamentOrganizationSeriesTournamentResultTournamentStaffTournamentStageTournamentTeamTournamentTeamMemberTrophyTrophyOwnerUnvalidatedUserSubmittedImageUserUserSubmittedImageUserWeaponPoolVideoVideoMatchVideoMatchPlayerXRankPlacement
Calls
no other repositories
Imports
no other modules
Used by
1 loader3 modules2 scripts

Types

type

FeedLFGPostType

:26

The LFG post types the feed matches against each other

export type FeedLFGPostType = "PLAYER_FOR_TEAM" | "TEAM_FOR_PLAYER";
type

OrganizationTournament

no JSDoc:537
export type OrganizationTournament = NonNullable<
	Awaited<ReturnType<typeof findLatestOrganizationTournamentStartingBetween>>
>;
type

FeedScrimPost

no JSDoc:1384
export type FeedScrimPost = Unwrapped<
	ReturnType<typeof scrimPostFeedQuery>["execute"]
>;
type

SiteTotal

no JSDoc:1994
export type SiteTotal = keyof typeof SITE_TOTAL_TIMES;

Functions & values

function

findUsersByIds

no JSDoc:28
export function findUsersByIds(userIds: number[])
function

findTournamentsByIds

no JSDoc:38
export function findTournamentsByIds(tournamentIds: number[])
function

findTournamentTeamsByIds

no JSDoc:61
export function findTournamentTeamsByIds(tournamentTeamIds: number[])
function

findTeamsByIds

no JSDoc:100
export function findTeamsByIds(teamIds: number[])
function

findCommentAuthorsByIds

:133

Users as chat message authors, for the comments of a post.

export function findCommentAuthorsByIds(
	userIds: number[],
): Promise<ChatMessageAuthor[]>
function

findLatestGroupMatchCreatedAt

:146

Latest moment anything was played in SendouQ, the "now" of the feed test page so old database snapshots look alive.

export async function findLatestGroupMatchCreatedAt()
function

findLatestSkillCreatedAt

:158

When the user's SendouQ rating of the season last changed, i.e. their latest set

export async function findLatestSkillCreatedAt({
	userId,
	season,
}: {
	userId: number;
	season: number;
})
TablesSkill
function

findMatchTimesByUserId

:177

Start times of the user's SendouQ matches and tournament games since after

export async function findMatchTimesByUserId({
	userId,
	after,
}: {
	userId: number;
	after: number;
})
function

findMapResultsByUserId

no JSDoc:214
export function findMapResultsByUserId({
	userId,
	season,
}: {
	userId: number;
	season: number;
})
TablesMapResult
function

findTopCloseRivalryOfUsers

:235

The users' most played opponent this season among the ones where neither side has a clear lead in sets

export function findTopCloseRivalryOfUsers({
	userIds,
	season,
}: {
	userIds: number[];
	season: number;
})
function

findTopTeammatesByUserId

:278

The SendouQ teammates of the user by sets played together, most first.

export function findTopTeammatesByUserId(userId: number)
function

findWeaponPicksByUser

:304

How many maps each player played on each weapon in SendouQ matches created in [from, to)

export function findWeaponPicksByUser({
	from,
	to,
}: {
	from: number;
	to: number;
})
function

findAllLobbiesEndedAfter

:326

Lobbies that ended after after with who played in them and their top three, latest first.

export function findAllLobbiesEndedAfter(after: number)
function

findTournamentMatchesByTeamId

:373

Bracket matches of a tournament team, in bracket order.

export function findTournamentMatchesByTeamId({
	tournamentId,
	tournamentTeamId,
}: {
	tournamentId: number;
	tournamentTeamId: number;
})
function

findFinishedMatchesByTournamentIds

no JSDoc:412
export function findFinishedMatchesByTournamentIds(tournamentIds: number[])
function

findSeedsByTournamentTeamIds

no JSDoc:433
export function findSeedsByTournamentTeamIds(tournamentTeamIds: number[])
function

findAllUpcomingRegistrations

:444

Everyone registered to a tournament starting after after, soonest first.

export function findAllUpcomingRegistrations(after: number)
function

findAllLookingTournamentTeams

:477

Teams of two or more on the LFG of a tournament starting after after, with when their roster last changed.

export function findAllLookingTournamentTeams(after: number)
function

findLatestOrganizationTournamentStartingBetween

:542

The organization tournament announced last that starts in the range.

export function findLatestOrganizationTournamentStartingBetween({
	from,
	to,
}: {
	from: number;
	to: number;
})
function

findAllOrganizationTournamentsAddedAfter

:557

Organization tournaments added to the calendar after after, latest first.

export function findAllOrganizationTournamentsAddedAfter(after: number)
function

findOrganizationIdsPlayedByUserId

:603

Organizations whose tournaments that started after after the user has a result in.

export async function findOrganizationIdsPlayedByUserId({
	userId,
	after,
}: {
	userId: number;
	after: number;
})
function

findSeriesWithLeaderboard

no JSDoc:628
export function findSeriesWithLeaderboard()
function

findSeriesEventsWithResults

:642

An organization's visible events with results matching any of the series name substrings, started between from and to.

export function findSeriesEventsWithResults({
	organizationId,
	substringMatches,
	from,
	to,
}: {
	organizationId: number;
	substringMatches: string[];
	from: number;
	to: number;
})
function

findResultUserIds

:692

Everyone with a result in any of the tournaments or in any of the hand-reported calendar events

export async function findResultUserIds({
	tournamentIds,
	calendarEventIds,
}: {
	tournamentIds: number[];
	calendarEventIds: number[];
})
function

findOrganizationById

no JSDoc:727
export function findOrganizationById(organizationId: number)
function

findLatestTournamentMatchVods

:750

The latest tournament match VoDs, latest first.

export function findLatestTournamentMatchVods()
function

findAllTournamentBadgeOwnersStartedAfter

:779

Owners of the badges of tournaments that started after after, latest tournament first.

export function findAllTournamentBadgeOwnersStartedAfter(after: number)
function

findLatestTrophyOwners

:810

The owners of the trophies of the latest tournaments, latest first.

export function findLatestTrophyOwners()
function

findAllNewTrophiesAcceptedAfter

:829

Trophies added (not edits of existing ones) after after with who made them, latest first.

export function findAllNewTrophiesAcceptedAfter(after: number)
function

findAllUpcomingTournamentSaves

:857

Who saved which upcoming tournaments and when, of userIds or of everyone when left out.

export function findAllUpcomingTournamentSaves({
	after,
	userIds,
}: {
	after: number;
	userIds?: number[];
})
function

findAllUpcomingStaff

:890

Staff of the tournaments starting after after, soonest first.

export function findAllUpcomingStaff(after: number)
function

findBiggestFinalizedTournaments

:913

Finalized public tournaments that started in the range (optionally on a day of the year, MM-DD in UTC), best tier and most teams first.

export function findBiggestFinalizedTournaments({
	from,
	to,
	monthDay,
	limit,
}: {
	from: number;
	to: number;
	monthDay?: string;
	limit: number;
})
function

findPodiumTeamIdsByTournamentId

:954

The best placed team of each of the top three placements of a tournament.

export function findPodiumTeamIdsByTournamentId(tournamentId: number)
function

findTournamentsWithRegistrationClosedBetween

:969

Public tournaments whose registration closed in the range, before they started.

export function findTournamentsWithRegistrationClosedBetween({
	from,
	to,
}: {
	from: number;
	to: number;
})
function

findRegisteredTeamsByTournamentId

:993

Registered teams of a tournament with their members, placeholder and dropped out teams left out.

export async function findRegisteredTeamsByTournamentId(tournamentId: number)
function

findSeriesByOrganizationId

no JSDoc:1005
export function findSeriesByOrganizationId(organizationId: number)
function

countSeriesWinsOfUser

:1017

How many of an organization's events matching any of the name substrings the user has won, up to before.

export async function countSeriesWinsOfUser({
	userId,
	organizationId,
	substringMatches,
	before,
}: {
	userId: number;
	organizationId: number;
	substringMatches: string[];
	before: number;
})
function

findAllTeamJoinsAfter

:1104

Joins to teams that still have the member, after after, latest first.

export function findAllTeamJoinsAfter(after: number)
function

findAllCreatedTeamsAfter

:1122

Teams created after after that still exist, latest first.

export function findAllCreatedTeamsAfter(after: number)
function

findLatestTeamAvailabilityWeek

:1139

The latest week where at least minMembers of one team filled their availability.

export function findLatestTeamAvailabilityWeek({
	before,
	minMembers,
	teamIds,
}: {
	before: number;
	minMembers: number;
	/** Only these teams, any team when not given */
	teamIds?: number[];
})
function

findLatestAddedUpcomingTeamEvent

:1184

The latest added team event that hasn't started by now, with who it's for, not authored by excludeAuthorId.

export function findLatestAddedUpcomingTeamEvent({
	now,
	excludeAuthorId,
	teamIds,
}: {
	now: number;
	excludeAuthorId: number;
	/** Only these teams, any team when not given */
	teamIds?: number[];
})
function

findOpenScrimPostsForViewer

:1235

Team scrim posts still open for requests at now that the viewer can see or has requested: not canceled, nothing accepted, not started yet ("looking now" posts until lookingNowFrom). Posts the viewer is in or of excludedTeamIds are left out, as are ones created before createdAfter unless the viewer requested them after it.

export function findOpenScrimPostsForViewer({
	viewerId,
	excludedTeamIds,
	now,
	lookingNowFrom,
	createdAfter,
}: {
	viewerId: number;
	excludedTeamIds: number[];
	now: number;
	lookingNowFrom: number;
	createdAfter: number;
})
function

findLatestUpcomingScrimPost

:1315

The latest team scrim post starting between from and to of anyone, for the feed test page.

export function findLatestUpcomingScrimPost({
	from,
	to,
}: {
	from: number;
	to: number;
})
function

findAcceptedScrimsOfTeams

:1331

Accepted, non-canceled scrims of the teams booked to start between from and to, with the team ids of both sides.

export function findAcceptedScrimsOfTeams({
	teamIds,
	from,
	to,
}: {
	teamIds: number[];
	from: number;
	to: number;
})
function

findMemberLutiDivsByTeamIds

:1370

The LUTI divs of the current members of the teams who have one.

export function findMemberLutiDivsByTeamIds(teamIds: number[])
function

findLatestReportedScrim

:1432

The latest scrim with at least minMaps reported maps, with its maps and both teams.

export function findLatestReportedScrim({
	before,
	minMaps,
	teamIds,
}: {
	before: number;
	minMaps: number;
	/** Only scrims these teams played in, any scrim when not given */
	teamIds?: number[];
})
function

findLFGPostsUpdatedBetween

:1511

Posts of the type bumped in [from, to) that the viewer can see on the LFG page: not their own and not limited to a Plus tier above theirs. Newest first, with the ids of the post's team members.

export function findLFGPostsUpdatedBetween({
	type,
	viewerId,
	from,
	to,
}: {
	type: FeedLFGPostType;
	viewerId: number;
	from: number;
	to: number;
})
function

findLFGPostsByAuthorId

:1549

The user's LFG posts bumped at or after after, with the ids of each post's team members.

export function findLFGPostsByAuthorId({
	authorId,
	after,
}: {
	authorId: number;
	after: number;
})
function

findWeaponPoolByUserId

no JSDoc:1583
export function findWeaponPoolByUserId(userId: number)
function

findAllTeamMemberships

:1594

Every current team membership with when the team was created.

export function findAllTeamMemberships()
function

countTournamentsByTeamId

no JSDoc:1608
export async function countTournamentsByTeamId(teamId: number)
function

findAllArtistsActiveBetween

:1623

Everyone who posted art in the range with how much, most first.

export function findAllArtistsActiveBetween({
	from,
	to,
}: {
	from: number;
	to: number;
})
function

findArtPiecesOfAuthorBetween

:1647

The artist's latest pieces posted in the range.

export function findArtPiecesOfAuthorBetween({
	authorId,
	from,
	to,
}: {
	authorId: number;
	from: number;
	to: number;
})
function

findAllTaggedArtAfter

:1676

Art with users tagged in it posted after after, one row per tagged user, latest first.

export function findAllTaggedArtAfter(after: number)
function

findAllOpenedCommissionsAfter

:1698

Artists who opened commissions after after and have art to show, latest first.

export function findAllOpenedCommissionsAfter(after: number)
function

findAllPublicBuildIdsUpdatedAfter

:1742

Public builds updated after after, latest first.

export function findAllPublicBuildIdsUpdatedAfter(after: number)
TablesBuild
function

findBuildById

no JSDoc:1752
export function findBuildById(buildId: number)
function

findLatestBuildIdsOfHighXpOwners

:1757

For every weapon, the public build of it updated last by someone whose peak X Power is above minPeakXp.

export function findLatestBuildIdsOfHighXpOwners(minPeakXp: number)
function

findLatestVideo

no JSDoc:1782
export async function findLatestVideo(before: number)
function

findAllUserPlacementsOfLatestMonth

:1824

The X Rank placements of sendou.ink users from the latest month there are any, best first.

export async function findAllUserPlacementsOfLatestMonth()
function

findAllScannedMatchIdsWithReplayCode

:1856

Scanned matches with a replay code created before before, latest first.

export function findAllScannedMatchIdsWithReplayCode(before: number)
function

findScannedMatchById

no JSDoc:1869
export function findScannedMatchById(id: number)
function

findAllFriendshipsCreatedAfter

:1880

Friendships formed after after, latest first.

export function findAllFriendshipsCreatedAfter(after: number)
function

findPlusTierByUserId

:1894

The Plus Server tier the user is a member of, null when they aren't.

export async function findPlusTierByUserId(userId: number)
TablesPlusTier
function

findAllFirstPlusSuggestionsOfMonth

:1905

First suggestion of each player suggested in the voting month, leaving out players already in the tier or above, latest first.

export function findAllFirstPlusSuggestionsOfMonth({
	month,
	year,
}: {
	month: number;
	year: number;
})
function

findFirstTournamentResultByUserId

no JSDoc:1939
export function findFirstTournamentResultByUserId(userId: number)
function

findLatestAddedUpcomingCalendarEvent

no JSDoc:1960
export function findLatestAddedUpcomingCalendarEvent(after: number)
function

countSiteTotal

:1997

Users, SendouQ sets, tournaments or art pieces there were at before.

export async function countSiteTotal({
	total,
	before,
}: {
	total: SiteTotal;
	before: number;
})
function

findNthOfSiteTotal

:2014

When the nth user, SendouQ set, tournament or art piece was created, 0 if unknown.

export async function findNthOfSiteTotal({
	total,
	nth,
}: {
	total: SiteTotal;
	nth: number;
})