fantasy-manager/Modules/archive.ts
Lukas Schaefer d3a5fe88f9
switch to kysely (#863)
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2025-05-09 19:12:32 -04:00

16 lines
511 B
TypeScript

import db from "./database";
/**
* Archives a league by updating the archived timestamp in the leagueSettings table and deleting invites for the league.
*
* @param {string} league - The ID of the league to archive.
*/
export const archive_league = async (league: number) => {
await db
.updateTable("leagueSettings")
.set({ archived: Math.floor(Date.now() / 1000) })
.where("leagueID", "=", league)
.execute();
await db.deleteFrom("invite").where("leagueID", "=", league).execute();
};