mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 06:58:10 -05:00
Script to disband team
This commit is contained in:
parent
d8bf953ecf
commit
335fe487d2
24
scripts/disband-team.ts
Normal file
24
scripts/disband-team.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import "dotenv/config";
|
||||
import invariant from "tiny-invariant";
|
||||
import { db } from "~/db/sql";
|
||||
import { dateToDatabaseTimestamp } from "~/utils/dates";
|
||||
import { logger } from "~/utils/logger";
|
||||
|
||||
const id = Number(process.argv[2]?.trim());
|
||||
|
||||
invariant(id, "team id is required (argument 1)");
|
||||
invariant(Number.isInteger(id), "team id must be an integer");
|
||||
|
||||
async function main() {
|
||||
await db
|
||||
.updateTable("AllTeam")
|
||||
.set({
|
||||
deletedAt: dateToDatabaseTimestamp(new Date()),
|
||||
})
|
||||
.where("id", "=", id)
|
||||
.execute();
|
||||
|
||||
logger.info(`Disbanded team with id: ${id}`);
|
||||
}
|
||||
|
||||
void main();
|
||||
Loading…
Reference in New Issue
Block a user