feat: implement backend core with repricing logic, case management, and multi-service architecture

This commit is contained in:
2026-05-13 00:28:13 +03:00
parent 38f3199c33
commit d9aae5b85e
15 changed files with 596 additions and 90 deletions

View File

@@ -5,10 +5,26 @@ CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
role VARCHAR(20) DEFAULT 'admin', -- admin, manager, viewer
parent_id INT REFERENCES users(id) ON DELETE CASCADE,
plan VARCHAR(20) DEFAULT 'free',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS repricer_rules (
id SERIAL PRIMARY KEY,
user_id INT REFERENCES users(id) ON DELETE CASCADE,
product_name VARCHAR(255) NOT NULL,
sku VARCHAR(100) NOT NULL,
min_price DECIMAL(10, 2) NOT NULL,
max_price DECIMAL(10, 2) NOT NULL,
strategy VARCHAR(20) DEFAULT 'follow_competitor', -- follow_competitor, match_lowest
is_active BOOLEAN DEFAULT TRUE,
current_price DECIMAL(10, 2),
last_run TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS credentials (
user_id INT REFERENCES users(id) ON DELETE CASCADE,
platform VARCHAR(50),