Add Bambu Lab predefined colors and finishes

- Parse Bambu Lab PDF to extract all official colors and finishes
- Add 77 predefined Bambu Lab colors with accurate hex codes
- Update finish dropdown to show only Bambu Lab finishes
- Make color selection dynamic based on brand and finish
- Show Bambu Lab colors only when BambuLab brand is selected
- Auto-fill hex codes for Bambu Lab colors
- Allow custom colors for other brands
- Add database migrations for finish types and colors
- Import all Bambu Lab colors to database
This commit is contained in:
DaX
2025-06-23 19:33:15 +02:00
parent b97032bf0c
commit 1eec8c8b4a
5 changed files with 377 additions and 11 deletions

View File

@@ -19,6 +19,25 @@ async function migrate() {
console.log('Database migration completed successfully');
// Run additional migrations
const migrationsPath = path.join(__dirname, '..', 'database', 'migrations');
if (fs.existsSync(migrationsPath)) {
const migrationFiles = fs.readdirSync(migrationsPath)
.filter(file => file.endsWith('.sql'))
.sort();
for (const file of migrationFiles) {
console.log(`Running migration: ${file}`);
const migrationSQL = fs.readFileSync(path.join(migrationsPath, file), 'utf8');
try {
await pool.query(migrationSQL);
console.log(`✓ Migration ${file} completed`);
} catch (err) {
console.log(`⚠ Migration ${file} skipped:`, err.message);
}
}
}
// Import legacy data if available
try {
const dataPath = path.join(__dirname, '..', 'data.json');