Files
tilbudgivern/setup_pricing_tables.sql
Alex 535ead3c12 Refactor project structure and unify frontend and backend into a single application
- Renamed project to "tilbudgivern-unified" and updated package.json accordingly.
- Created a new frontend server to proxy API requests and serve static files.
- Added SQL scripts for inserting sample data and setting up pricing tables.
- Configured Nginx for both HTTP and HTTPS with security headers and proxy settings.
- Implemented a unified server to handle API requests and serve the frontend application.
- Added endpoints for labor and material pricing management, including CRUD operations.
- Introduced testing script for frontend API interaction.
2025-09-14 21:15:00 +02:00

54 lines
2.7 KiB
SQL

-- Create labor_prices table for storing labor price data
CREATE TABLE IF NOT EXISTS labor_prices (
id INT AUTO_INCREMENT PRIMARY KEY,
project_type VARCHAR(100) NOT NULL,
description TEXT NOT NULL,
labor_rate DECIMAL(10,2) NOT NULL,
area DECIMAL(10,2) NULL,
total_hours DECIMAL(8,2) NULL,
difficulty_level ENUM('normal', 'medium', 'høj') DEFAULT 'normal',
location VARCHAR(100) NULL,
notes TEXT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_project_type (project_type)
);
-- Create material_prices table for storing material price data
CREATE TABLE IF NOT EXISTS material_prices (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
category VARCHAR(100) NOT NULL,
subcategory VARCHAR(100) NULL,
price DECIMAL(10,2) NOT NULL,
unit VARCHAR(20) DEFAULT 'stk',
supplier_name VARCHAR(255) NULL,
sku VARCHAR(100) NULL,
description TEXT NULL,
notes TEXT NULL,
confidence DECIMAL(3,2) DEFAULT 1.00,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_category (category),
INDEX idx_name (name)
);
-- Insert some sample labor prices
INSERT IGNORE INTO labor_prices (id, project_type, description, labor_rate, area, total_hours, difficulty_level, location) VALUES
(1, 'Gulvlægning', 'Standard gulvlægning arbejde', 450.00, 25.0, 8.0, 'normal', 'København'),
(2, 'Gulvlægning', 'Avanceret gulvlægning med specialudstyr', 520.00, 35.0, 12.0, 'høj', 'Aarhus'),
(3, 'Tagarbejde', 'Standard tagarbejde', 480.00, 40.0, 16.0, 'normal', 'Odense'),
(4, 'Tagarbejde', 'Avanceret tagarbejde med isolering', 550.00, 50.0, 20.0, 'høj', 'København'),
(5, 'Terrasse/udestue', 'Standard terrasse opførelse', 420.00, 20.0, 12.0, 'normal', 'Aalborg'),
(6, 'Renovering', 'Køkkenrenovering', 500.00, 15.0, 24.0, 'medium', 'København');
-- Insert some sample material prices
INSERT IGNORE INTO material_prices (id, name, category, subcategory, price, unit, supplier_name, sku, confidence) VALUES
(1, 'Standard træ materiale', 'Træ', 'premium', 125.50, '', 'Silvan', 'ABC123', 0.95),
(2, 'Økonomisk træ', 'Træ', 'standard', 89.90, '', 'Bauhaus', 'DEF456', 0.88),
(3, 'Premium træ kvalitet', 'Træ', 'premium plus', 199.00, '', 'Harald Nyborg', 'GHI789', 0.92),
(4, 'Standard beslag', 'Beslag', 'skruer', 15.50, 'pakker', 'Silvan', 'BES001', 0.90),
(5, 'Premium beslag sæt', 'Beslag', 'specialbeslag', 45.00, 'stk', 'XL-BYG', 'BES002', 0.95),
(6, 'Gulvplanker egetræ', 'Gulv', 'planker', 280.00, '', 'Kährs', 'GULV001', 0.98),
(7, 'Laminatgulv', 'Gulv', 'laminat', 150.00, '', 'Quick-Step', 'GULV002', 0.92);