// Example configuration for Directus seed data // Use this to initialize the settings collection with default values export const defaultSettings = { key: 'general', title: 'Guest', use_ip_location: false, manual_location: 'Hotel Location', idle_timeout_seconds: 300, plex_enabled: true, restaurants_enabled: true, attractions_enabled: true, brand_color: '#1f2937', metadata: { version: '1.0.0', }, }; /** * SQL to insert default settings into Directus * Run this in your database initialization script */ export const seedSettingsSql = ` INSERT INTO directus_collections (collection, icon, sort, note) VALUES ('settings', 'settings', 1000, 'Global kiosk configuration settings') ON CONFLICT (collection) DO NOTHING; INSERT INTO directus_fields (collection, field, type, interface, options, required, readonly, hidden, sort, note) VALUES ('settings', 'id', 'uuid', 'input', '{"hidden":true}', false, true, true, 0, 'Primary Key'), ('settings', 'key', 'string', 'input', '{"options":{"iconRight":"vpn_key"}}', true, false, false, 1, 'Unique setting key'), ('settings', 'title', 'string', 'input', NULL, true, false, false, 2, 'Welcome title'), ('settings', 'use_ip_location', 'boolean', 'boolean', NULL, false, false, false, 3, 'Use IP geolocation'), ('settings', 'manual_location', 'string', 'input', NULL, false, false, false, 4, 'Manual location if IP geolocation disabled'), ('settings', 'idle_timeout_seconds', 'integer', 'input', '{"options":{"iconRight":"schedule"}}', false, false, false, 5, 'Idle timeout in seconds'), ('settings', 'plex_enabled', 'boolean', 'boolean', NULL, false, false, false, 6, 'Enable Plex integration'), ('settings', 'restaurants_enabled', 'boolean', 'boolean', NULL, false, false, false, 7, 'Show restaurants section'), ('settings', 'attractions_enabled', 'boolean', 'boolean', NULL, false, false, false, 8, 'Show attractions section'), ('settings', 'brand_color', 'string', 'input', '{"iconRight":"palette"}', false, false, false, 9, 'Brand color in hex'), ('settings', 'metadata', 'json', 'json', NULL, false, false, false, 10, 'Custom metadata and settings') ON CONFLICT DO NOTHING; INSERT INTO directus_settings (key, title, use_ip_location, manual_location, idle_timeout_seconds, plex_enabled, restaurants_enabled, attractions_enabled, brand_color, metadata) VALUES ( 'general', 'Guest', false, 'Hotel Location', 300, true, true, true, '#1f2937', '{}' ) ON CONFLICT (key) DO UPDATE SET title = EXCLUDED.title, use_ip_location = EXCLUDED.use_ip_location, manual_location = EXCLUDED.manual_location, idle_timeout_seconds = EXCLUDED.idle_timeout_seconds, plex_enabled = EXCLUDED.plex_enabled, restaurants_enabled = EXCLUDED.restaurants_enabled, attractions_enabled = EXCLUDED.attractions_enabled, brand_color = EXCLUDED.brand_color; `; /** * Directus REST API payload to create settings * Use this to programmatically initialize from Node.js */ export function createSettingsPayload(overrides = {}) { return { ...defaultSettings, ...overrides, }; }