e824be7e5d
- New api/ service: Express + better-sqlite3, health check at GET /api/health, POST /api/bookings stores sessions with all required fields - Dockerfile with Alpine build deps for native sqlite3 module - docker-compose.yml: api service with volume mounts for data, signed-contracts, contracts - nginx.conf: proxy /api/ to api:3001; Immich regex locations remain higher priority - .gitignore: exclude SQLite db file and signed PDFs from version control Closes #1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
810 B
JavaScript
32 lines
810 B
JavaScript
const Database = require('better-sqlite3');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const dataDir = path.join(__dirname, 'data');
|
|
if (!fs.existsSync(dataDir)) fs.mkdirSync(dataDir, { recursive: true });
|
|
|
|
const db = new Database(path.join(dataDir, 'bookings.db'));
|
|
|
|
db.exec(`
|
|
CREATE TABLE IF NOT EXISTS bookings (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
created_at TEXT DEFAULT (datetime('now')),
|
|
client_name TEXT,
|
|
client_email TEXT,
|
|
client_phone TEXT,
|
|
client_sub TEXT,
|
|
session_date TEXT,
|
|
session_type TEXT,
|
|
session_length TEXT,
|
|
location TEXT,
|
|
contract_signed_at TEXT,
|
|
contract_pdf_path TEXT,
|
|
payment_status TEXT DEFAULT 'pending',
|
|
payment_notified_at TEXT,
|
|
status TEXT DEFAULT 'pending',
|
|
notes TEXT
|
|
)
|
|
`);
|
|
|
|
module.exports = db;
|