Migrate to single DB for both users and tournaments and introduce userService

This commit is contained in:
2026-03-06 08:41:49 +01:00
parent 44e7ea9f73
commit 46467c457a
5 changed files with 115 additions and 7 deletions

View File

@@ -5,14 +5,10 @@ import {Database, RunResult} from "sqlite3";
export class TournamentService {
private csvFilename = 'csv/tournaments.csv';
private dbFilename = 'tournaments.sqlite';
private db: Database;
constructor() {
if (fs.existsSync(this.dbFilename)) {
fs.unlinkSync(this.dbFilename);
}
this.db = new Database(this.dbFilename);
constructor(db: Database) {
this.db = db;
this.db.serialize(() => {
this.db.run(`CREATE TABLE IF NOT EXISTS Tournaments
(