mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-10 12:44:47 -05:00
14 lines
347 B
TypeScript
14 lines
347 B
TypeScript
import { nanoid } from "nanoid";
|
|
import { INVITE_CODE_LENGTH } from "~/constants";
|
|
import { sql } from "~/db/sql";
|
|
|
|
const stm = sql.prepare(/* sql */ `
|
|
update "AllTeam"
|
|
set "inviteCode" = @inviteCode
|
|
where "id" = @teamId
|
|
`);
|
|
|
|
export function resetInviteLink(teamId: number) {
|
|
stm.run({ teamId, inviteCode: nanoid(INVITE_CODE_LENGTH) });
|
|
}
|