From 391ef063f771168fbe5b63420db640463de2279b Mon Sep 17 00:00:00 2001 From: C4illin Date: Sun, 19 May 2024 00:22:52 +0200 Subject: [PATCH] rename --- .gitignore | 3 ++- src/index.tsx | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ed390cb..d493115 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,5 @@ package-lock.json /uploads /mydb.sqlite /output -/db/mydb.sqlite \ No newline at end of file +/db +/data \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 8b0bda3..d971ece 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,12 +11,17 @@ import { Header } from "./components/header"; import { mainConverter, possibleConversions } from "./converters/main"; import { normalizeFiletype } from "./helpers/normalizeFiletype"; -const db = new Database("./db/mydb.sqlite"); -const uploadsDir = "./uploads/"; -const outputDir = "./output/"; +const db = new Database("./data/mydb.sqlite", { create: true }); +const uploadsDir = "./data/uploads/"; +const outputDir = "./data/output/"; const jobs = {}; +// fileNames: fileNames, +// filesToConvert: fileNames.length, +// convertedFiles : 0, +// outputFiles: [], + // init db db.exec(` CREATE TABLE IF NOT EXISTS users ( @@ -24,14 +29,24 @@ CREATE TABLE IF NOT EXISTS users ( email TEXT NOT NULL, password TEXT NOT NULL ); +CREATE TABLE IF NOT EXISTS file_names ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + job_id TEXT NOT NULL, + file_name TEXT NOT NULL, + output_file_name TEXT NOT NULL +); CREATE TABLE IF NOT EXISTS jobs ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, job_id TEXT NOT NULL, date_created TEXT NOT NULL, - status TEXT DEFAULT 'pending' + status TEXT DEFAULT 'pending', + converted_files INTEGER DEFAULT 0 );`); +// enable WAL mode +db.exec("PRAGMA journal_mode = WAL;"); + const app = new Elysia() .use(cookie()) .use(html())