v2.1
Ship configurator updates with catalog DB included for server deploy. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
+52
-2
@@ -11,6 +11,7 @@ dotenv.config({ path: path.join(__dirname, '.env') });
|
||||
import { getProducts } from './routes/products.js';
|
||||
import { getBlockTypes } from './routes/blockTypes.js';
|
||||
import { getFinishes } from './routes/finishes.js';
|
||||
import { getMaterialImage } from './routes/materialImage.js';
|
||||
import { getServiceOptions } from './routes/serviceOptions.js';
|
||||
import { getSettings, updateSettings } from './routes/settings.js';
|
||||
import {
|
||||
@@ -38,12 +39,17 @@ import {
|
||||
streamFormexSync,
|
||||
triggerHaefeleSync,
|
||||
streamHaefeleSync,
|
||||
triggerLeubaHiagSync,
|
||||
streamLeubaHiagSync,
|
||||
getLeubaHiagMaterials,
|
||||
getLeubaHiagTargets,
|
||||
getLogs,
|
||||
getStatus,
|
||||
getFormexMaterials,
|
||||
getFormexMaterial,
|
||||
createFormexMaterial,
|
||||
updateFormexMaterial,
|
||||
setFormexMaterialActive,
|
||||
deleteFormexMaterial,
|
||||
getFormexCollections,
|
||||
getFormexCategories,
|
||||
@@ -79,13 +85,26 @@ import {
|
||||
exportCncRoute,
|
||||
exportMprRoute,
|
||||
exportMprPieceRoute,
|
||||
generateHardwareListRoute
|
||||
generateHardwareListRoute,
|
||||
generateCuttingPlanRoute,
|
||||
exportExcelRoute
|
||||
} from './routes/plans.js';
|
||||
import {
|
||||
designTipsRoute,
|
||||
recommendMaterialsRoute,
|
||||
renderRoute
|
||||
} from './routes/ai.js';
|
||||
import {
|
||||
getSavedDesigns,
|
||||
createSavedDesign,
|
||||
updateSavedDesign,
|
||||
deleteSavedDesign
|
||||
} from './routes/savedDesigns.js';
|
||||
import {
|
||||
getLayoutPresets,
|
||||
createLayoutPreset,
|
||||
deleteLayoutPreset
|
||||
} from './routes/layoutPresets.js';
|
||||
import { initScheduler } from './services/scheduler.js';
|
||||
|
||||
const clientDist = path.join(__dirname, '..', 'client', 'dist');
|
||||
@@ -100,6 +119,7 @@ app.use(express.json());
|
||||
app.get('/api/products', getProducts);
|
||||
app.get('/api/block-types', getBlockTypes);
|
||||
app.get('/api/finishes', getFinishes);
|
||||
app.get('/api/material-image', getMaterialImage);
|
||||
app.get('/api/service-options', getServiceOptions);
|
||||
app.get('/api/settings', getSettings);
|
||||
app.put('/api/settings', updateSettings);
|
||||
@@ -108,6 +128,13 @@ app.post('/api/engineering-rules', createEngineeringRule);
|
||||
app.put('/api/engineering-rules/:id', updateEngineeringRule);
|
||||
app.delete('/api/engineering-rules/:id', deleteEngineeringRule);
|
||||
app.post('/api/price', postPrice);
|
||||
app.get('/api/saved-designs', getSavedDesigns);
|
||||
app.post('/api/saved-designs', createSavedDesign);
|
||||
app.put('/api/saved-designs/:id', updateSavedDesign);
|
||||
app.delete('/api/saved-designs/:id', deleteSavedDesign);
|
||||
app.get('/api/layout-presets', getLayoutPresets);
|
||||
app.post('/api/layout-presets', createLayoutPreset);
|
||||
app.delete('/api/layout-presets/:id', deleteLayoutPreset);
|
||||
app.get('/api/orders', getOrders);
|
||||
app.post('/api/orders', postOrder);
|
||||
app.get('/api/orders/:id/supplier-vouchers', getOrderSupplierVouchers);
|
||||
@@ -129,6 +156,9 @@ app.post('/api/sync/formex', triggerFormexSync);
|
||||
app.get('/api/sync/formex/stream', streamFormexSync);
|
||||
app.post('/api/sync/haefele', triggerHaefeleSync);
|
||||
app.get('/api/sync/haefele/stream', streamHaefeleSync);
|
||||
app.get('/api/sync/leubahiag/targets', getLeubaHiagTargets);
|
||||
app.post('/api/sync/leubahiag', triggerLeubaHiagSync);
|
||||
app.get('/api/sync/leubahiag/stream', streamLeubaHiagSync);
|
||||
app.get('/api/sync/logs', getLogs);
|
||||
app.get('/api/sync/status', getStatus);
|
||||
|
||||
@@ -137,11 +167,13 @@ app.get('/api/formex/materials', getFormexMaterials);
|
||||
app.get('/api/formex/materials/:id', getFormexMaterial);
|
||||
app.post('/api/formex/materials', createFormexMaterial);
|
||||
app.put('/api/formex/materials/:id', updateFormexMaterial);
|
||||
app.patch('/api/formex/materials/:id/active', setFormexMaterialActive);
|
||||
app.delete('/api/formex/materials/:id', deleteFormexMaterial);
|
||||
app.get('/api/formex/collections', getFormexCollections);
|
||||
app.get('/api/formex/categories', getFormexCategories);
|
||||
app.get('/api/formex/suppliers', getFormexSuppliers);
|
||||
app.get('/api/haefele/materials', getHaefeleMaterials);
|
||||
app.get('/api/leubahiag/materials', getLeubaHiagMaterials);
|
||||
|
||||
// Room analysis routes (AI-powered)
|
||||
app.post('/api/room/analyze', uploadMiddleware, analyzeRoom);
|
||||
@@ -173,9 +205,11 @@ app.post('/api/ai/render', renderRoute);
|
||||
// Plans and cutting list routes
|
||||
app.post('/api/plans/generate', generatePlansRoute);
|
||||
app.post('/api/plans/cutting-list', generateCuttingListRoute);
|
||||
app.post('/api/plans/cutting-plan', generateCuttingPlanRoute);
|
||||
app.post('/api/plans/hardware-list', generateHardwareListRoute);
|
||||
app.post('/api/plans/export-text', exportCuttingListText);
|
||||
app.post('/api/plans/export-pdf', exportPDFHtml);
|
||||
app.post('/api/plans/export-excel', exportExcelRoute);
|
||||
app.post('/api/plans/export-cnc', exportCncRoute);
|
||||
app.post('/api/plans/export-mpr', exportMprRoute);
|
||||
app.post('/api/plans/export-mpr-piece', exportMprPieceRoute);
|
||||
@@ -242,7 +276,8 @@ async function applyMigration007() {
|
||||
await run(`INSERT OR IGNORE INTO suppliers (code, name, email, type) VALUES
|
||||
('formex', 'Formex', '[email protected]', 'panels'),
|
||||
('blum', 'Blum Switzerland', '[email protected]', 'hardware'),
|
||||
('haefele', 'Hafele', '[email protected]', 'materials')`);
|
||||
('haefele', 'Hafele', '[email protected]', 'materials'),
|
||||
('leubahiag', 'Leuba Hiag', '[email protected]', 'materials')`);
|
||||
|
||||
// Assign existing rows to their suppliers
|
||||
await run(`UPDATE formex_materials SET supplier_id = (SELECT id FROM suppliers WHERE code = 'formex') WHERE supplier_id IS NULL`);
|
||||
@@ -378,6 +413,21 @@ async function applyMigration013() {
|
||||
}
|
||||
|
||||
await applyMigration013();
|
||||
|
||||
// Apply migration 014: widen plinth max to 200 mm (remarque client) without clobbering custom values.
|
||||
async function applyMigration014() {
|
||||
try {
|
||||
await run('INSERT OR IGNORE INTO settings (key, value) VALUES ($1, $2)', ['plinth_height_min_mm', '60']);
|
||||
await run('INSERT OR IGNORE INTO settings (key, value) VALUES ($1, $2)', ['plinth_height_max_mm', '200']);
|
||||
// Bump legacy default 160 -> 200; leave any other (customized) value untouched.
|
||||
await run("UPDATE settings SET value = '200' WHERE key = 'plinth_height_max_mm' AND value = '160'");
|
||||
console.log('[migration-014] Plinth max widened to 200 mm.');
|
||||
} catch (err) {
|
||||
console.error('[migration-014] Error:', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
await applyMigration014();
|
||||
await ensureEngineeringRulesSeed();
|
||||
|
||||
// Initialize the scheduler for automated sync
|
||||
|
||||
Reference in New Issue
Block a user