Skip to content

Discord · Repositories

2 modules · 8 exports · 1 repository · 0 e2e tests · 2 routes

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.

DiscordTokenRepository

app/features/discord/DiscordTokenRepository.server.ts
Tables
UserDiscordToken
Calls
no other repositories
Imports
no other modules
Used by
1 module1 routine1 script1 other

Functions & values

function

findByUserId

:5

The user's stored Discord linked role tokens, undefined if they have not linked.

export function findByUserId(userId: number)
function

findAllUserIds

:14

Ids of every user who has linked sendou.ink as a Discord linked role.

export async function findAllUserIds()
function

upsert

:24

Stores the user's tokens, replacing the ones they had before.

export function upsert(args: TablesInsertable["UserDiscordToken"])
Unit tests (1)
function

deleteIfUnchanged

:42

Deletes the user's tokens if the access token is still the given one. A token refreshed concurrently in the meantime is kept.

export function deleteIfUnchanged(args: {
	userId: number;
	accessToken: string;
})
Unit tests (3)