v4.1.21: Реструктуризация проекта для Synology ARM

- Реструктуризация: src/ разбит на middleware/, utils/, repositories/ (удалены), routes/ (удалены)
- Добавлен src/original-html.ts — полный HTML с reportModal
- Добавлен src/index.tsx.backup — React-компонент с reportModal
- Миграции переименованы (0001_initial_schema.sql)
- Добавлена миграция 0018 (удалена позже)
- Docker: multi-stage build, wrangler.toml
- Frontend: public/static/app.js + style.css
- seed.sql добавлен
- Документация: CHANGELOG, CHANGES_v4.1.0-4.1.9, PROJECT_STRUCTURE
This commit is contained in:
Deploy Bot
2026-01-14 18:37:00 +02:00
parent 4898f5ec7f
commit 64403d6fd6
113 changed files with 19231 additions and 3084 deletions

View File

@@ -1,110 +0,0 @@
PRAGMA foreign_keys = ON;
-- Users table --------------------------------------------------------------
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
full_name TEXT NOT NULL DEFAULT '',
role TEXT NOT NULL DEFAULT 'user' CHECK (role IN ('admin', 'user')),
active INTEGER NOT NULL DEFAULT 1,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TRIGGER IF NOT EXISTS trg_users_updated
AFTER UPDATE ON users
FOR EACH ROW
BEGIN
UPDATE users SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
END;
-- Production records -------------------------------------------------------
CREATE TABLE IF NOT EXISTS production_records (
id INTEGER PRIMARY KEY AUTOINCREMENT,
month INTEGER NOT NULL CHECK (month BETWEEN 1 AND 12),
year INTEGER NOT NULL,
client_name TEXT NOT NULL,
type TEXT,
offer_number TEXT,
work_number TEXT,
quantity INTEGER NOT NULL DEFAULT 0,
color TEXT,
notes TEXT,
notes_date TEXT,
installer TEXT,
price REAL NOT NULL DEFAULT 0,
arve_checked INTEGER NOT NULL DEFAULT 0,
arve_makstud TEXT,
price_paid INTEGER NOT NULL DEFAULT 0,
deleted INTEGER NOT NULL DEFAULT 0,
created_by INTEGER,
updated_by INTEGER,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE SET NULL,
FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE SET NULL
);
CREATE INDEX IF NOT EXISTS idx_production_records_year_month
ON production_records (year, month, deleted);
CREATE TRIGGER IF NOT EXISTS trg_production_records_updated
AFTER UPDATE ON production_records
FOR EACH ROW
BEGIN
UPDATE production_records SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
END;
-- Status checkboxes --------------------------------------------------------
CREATE TABLE IF NOT EXISTS status_checkboxes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
record_id INTEGER NOT NULL UNIQUE,
material_date TEXT,
material_confirmed INTEGER NOT NULL DEFAULT 0,
material2_date TEXT,
material2_confirmed INTEGER NOT NULL DEFAULT 0,
package_date TEXT,
worksheets_date TEXT,
worksheets_confirmed INTEGER NOT NULL DEFAULT 0,
worksheets_error INTEGER NOT NULL DEFAULT 0,
worksheets_cycle_step INTEGER NOT NULL DEFAULT 0,
cutting_date TEXT,
cutting_error INTEGER NOT NULL DEFAULT 0,
glazing_date TEXT,
glazing_error INTEGER NOT NULL DEFAULT 0,
ready_date TEXT,
ready_error INTEGER NOT NULL DEFAULT 0,
issued_date TEXT,
issued_error INTEGER NOT NULL DEFAULT 0,
problems TEXT,
problems_date TEXT,
problem_flag INTEGER NOT NULL DEFAULT 0,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (record_id) REFERENCES production_records(id) ON DELETE CASCADE
);
CREATE TRIGGER IF NOT EXISTS trg_status_checkboxes_updated
AFTER UPDATE ON status_checkboxes
FOR EACH ROW
BEGIN
UPDATE status_checkboxes SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
END;
-- Audit log ----------------------------------------------------------------
CREATE TABLE IF NOT EXISTS audit_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
record_id INTEGER,
user_id INTEGER,
action TEXT NOT NULL,
field TEXT,
old_value TEXT,
new_value TEXT,
metadata TEXT,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (record_id) REFERENCES production_records(id) ON DELETE SET NULL,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL
);
CREATE INDEX IF NOT EXISTS idx_audit_log_record_id
ON audit_log (record_id, created_at DESC);

View File

@@ -0,0 +1,80 @@
-- Users table
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
full_name TEXT NOT NULL,
role TEXT NOT NULL DEFAULT 'user',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME DEFAULT NULL,
deleted_by INTEGER DEFAULT NULL
);
-- Production records table
CREATE TABLE IF NOT EXISTS production_records (
id INTEGER PRIMARY KEY AUTOINCREMENT,
month INTEGER NOT NULL,
year INTEGER NOT NULL,
client_name TEXT NOT NULL,
type TEXT,
offer_number TEXT NOT NULL,
work_number TEXT NOT NULL,
quantity INTEGER NOT NULL,
color TEXT,
notes TEXT,
problems TEXT,
installer TEXT,
price DECIMAL(10, 2),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
deleted_at DATETIME DEFAULT NULL,
deleted_by INTEGER DEFAULT NULL
);
-- Status checkboxes table
CREATE TABLE IF NOT EXISTS status_checkboxes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
record_id INTEGER NOT NULL,
material_date DATE,
material2_date DATE,
package_date DATE,
worksheets_date DATE,
cutting_date DATE,
glazing_date DATE,
ready_date DATE,
issued_date DATE,
worksheets_error INTEGER DEFAULT 0,
cutting_error INTEGER DEFAULT 0,
glazing_error INTEGER DEFAULT 0,
ready_error INTEGER DEFAULT 0,
issued_error INTEGER DEFAULT 0,
material_confirmed INTEGER DEFAULT 0,
material2_confirmed INTEGER DEFAULT 0,
worksheets_confirmed INTEGER DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (record_id) REFERENCES production_records(id) ON DELETE CASCADE
);
-- Audit log table
CREATE TABLE IF NOT EXISTS audit_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER,
record_id INTEGER,
field_name TEXT NOT NULL,
old_value TEXT,
new_value TEXT,
action_type TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (record_id) REFERENCES production_records(id)
);
-- Create indexes
CREATE INDEX IF NOT EXISTS idx_production_records_month_year ON production_records(month, year);
CREATE INDEX IF NOT EXISTS idx_production_records_client ON production_records(client_name);
CREATE INDEX IF NOT EXISTS idx_production_records_deleted ON production_records(deleted_at);
CREATE INDEX IF NOT EXISTS idx_status_checkboxes_record ON status_checkboxes(record_id);
CREATE INDEX IF NOT EXISTS idx_audit_log_record ON audit_log(record_id);
CREATE INDEX IF NOT EXISTS idx_audit_log_user ON audit_log(user_id);

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.

View File

@@ -1 +0,0 @@
-- Consolidated into 0001_initial.sql during restoration.