From 62c6bb5fa51bc7adf4919eccf43d9cca90dbe31d Mon Sep 17 00:00:00 2001 From: Bastien COIGNOUX Date: Mon, 14 Jul 2025 17:43:39 +0200 Subject: [PATCH] static planning --- svar-gantt-app/README.md | 8 ++++++ svar-gantt-app/data.db | Bin 16384 -> 20480 bytes svar-gantt-app/scripts/init-db.ts | 35 ----------------------- svar-gantt-app/src/lib/server/db.ts | 10 +++++++ svar-gantt-app/src/routes/+layout.svelte | 1 + 5 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 svar-gantt-app/scripts/init-db.ts diff --git a/svar-gantt-app/README.md b/svar-gantt-app/README.md index b5b2950..2a10492 100644 --- a/svar-gantt-app/README.md +++ b/svar-gantt-app/README.md @@ -36,3 +36,11 @@ npm run build You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. + + + +Pour créer la BDD en local : +npm run init-db + +Pour lancer l'application +npm run dev \ No newline at end of file diff --git a/svar-gantt-app/data.db b/svar-gantt-app/data.db index a0884b33dcf6d690f5820c7ac6d0b2b4c3342e6a..7a2ca9a1453db1540ad257b262c57aaaceb07979 100644 GIT binary patch delta 270 zcmZo@U~E{xI6+#Fi-CcG6^LPgeWH%BC>MiXmk=*dh=rGzfv=D60q-AP-i?hjc>)@9 zSlPw(^%gJ3xi&l5HC=OnfDI^-vhor-anfa1-f{d8~K?h z|K}BBWSK0+cSeGdU0ht8u|={ZF)1gtB(XTV7)&s2{>8_|xR}L2U@?n=z-AVQKl}jW CG#Zlt diff --git a/svar-gantt-app/scripts/init-db.ts b/svar-gantt-app/scripts/init-db.ts deleted file mode 100644 index ae6f327..0000000 --- a/svar-gantt-app/scripts/init-db.ts +++ /dev/null @@ -1,35 +0,0 @@ -// scripts/init-db.ts -import Database from 'better-sqlite3'; -import { mkdirSync, existsSync } from 'fs'; - -if (!existsSync('data')) { - mkdirSync('data'); -} - -const db = new Database('data.db'); - -db.exec(` - DROP TABLE IF EXISTS tasks; - DROP TABLE IF EXISTS links; - - CREATE TABLE tasks ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - text TEXT NOT NULL, - start TEXT NOT NULL, - end TEXT NOT NULL, - duration INTEGER, - progress INTEGER, - type TEXT, - parent INTEGER, - lazy BOOLEAN DEFAULT 0 -- ✅ Ajout ici - ); - - CREATE TABLE links ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - source INTEGER, - target INTEGER, - type TEXT - ); -`); - -console.log('✅ Base de données initialisée avec succès.'); diff --git a/svar-gantt-app/src/lib/server/db.ts b/svar-gantt-app/src/lib/server/db.ts index 2ce02a0..ac3f59b 100644 --- a/svar-gantt-app/src/lib/server/db.ts +++ b/svar-gantt-app/src/lib/server/db.ts @@ -4,4 +4,14 @@ import { resolve } from 'path'; // 📁 chemin absolu vers la BDD SQLite const db = new Database(resolve('data.db')); +db.exec(` + CREATE TABLE IF NOT EXISTS resource_planning ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + ressource TEXT NOT NULL, + profil TEXT NOT NULL, + date TEXT NOT NULL, + disponibilite REAL NOT NULL + ); +`); + export default db; diff --git a/svar-gantt-app/src/routes/+layout.svelte b/svar-gantt-app/src/routes/+layout.svelte index 71fef79..3a3d6a5 100644 --- a/svar-gantt-app/src/routes/+layout.svelte +++ b/svar-gantt-app/src/routes/+layout.svelte @@ -25,6 +25,7 @@ 🏠 📅 📂 + 📅 ⚙️