Remove vodder script

This commit is contained in:
Kalle
2024-02-01 17:47:55 +02:00
parent 3fdac9fddd
commit 6c6fa24f7f
3 changed files with 27 additions and 12 deletions

View File

@@ -1,11 +0,0 @@
/* eslint-disable no-console */
import "dotenv/config";
import { sql } from "~/db/sql";
sql
.prepare(
`update "TournamentStage" set "name" = 'Main bracket' where "name" = 'Elimination stage'`,
)
.run();
console.log(`Fixed tournaments`);

26
scripts/remove-vodder.ts Normal file
View File

@@ -0,0 +1,26 @@
/* eslint-disable no-console */
import "dotenv/config";
import invariant from "tiny-invariant";
import { sql } from "~/db/sql";
const discordId = process.argv[2]?.trim();
invariant(discordId, "discord id is required (argument 1)");
const id = (
sql
.prepare(`select "id" from "User" where "discordId" = @discordId`)
.get({ discordId }) as any
)?.id;
invariant(id, "user not found");
sql
.prepare(`update "User" set "isVideoAdder" = 0 where "id" = @id`)
.run({ id });
sql
.prepare(`delete from "UnvalidatedVideo" where "submitterUserId" = @id`)
.run({ id });
console.log(`Removed vodder`);