feat: Add Leaflet map integration and project coordinates handling
- Updated package.json to include dependencies for Leaflet and Playwright testing. - Added new images for Leaflet markers and layers. - Created scripts for generating test data with project coordinates. - Enhanced ProjectViewPage to display project coordinates and integrated ProjectMap component. - Modified ProjectForm to include coordinates input field. - Implemented CustomWMTSMap and EnhancedLeafletMap components for improved map functionality. - Created ProjectMap component to dynamically render project location on the map. - Added mapLayers configuration for various base layers including Polish Geoportal. - Implemented WMTS capabilities handling for dynamic layer loading. - Updated database initialization to include coordinates column in projects table. - Modified project creation and update functions to handle coordinates. - Added utility functions for formatting project status and deadlines.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import db from "./db";
|
||||
import db from "./db.js";
|
||||
|
||||
export default function initializeDatabase() {
|
||||
db.exec(`
|
||||
@@ -118,4 +118,24 @@ export default function initializeDatabase() {
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
// Migration: Add coordinates column to projects table
|
||||
try {
|
||||
db.exec(`
|
||||
ALTER TABLE projects ADD COLUMN coordinates TEXT;
|
||||
`);
|
||||
} catch (e) {
|
||||
// Column already exists, ignore error
|
||||
}
|
||||
|
||||
// Migration: Copy data from geo_info to coordinates and drop geo_info
|
||||
try {
|
||||
db.exec(`
|
||||
UPDATE projects SET coordinates = geo_info WHERE geo_info IS NOT NULL;
|
||||
`);
|
||||
db.exec(`
|
||||
ALTER TABLE projects DROP COLUMN geo_info;
|
||||
`);
|
||||
} catch (e) {
|
||||
// Column migration already done or geo_info doesn't exist, ignore error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user