-- AZ-456 seed fixtures for the suite-e2e docker-compose stack. -- -- The parent suite repo owns the canonical schema (../_docs/00_database_schema.md); -- this file ONLY inserts seed rows the SPA tests need to read. Schema migrations -- ship with each suite service's `:test` image and run before this script. -- -- Layout mirrors `tests/fixtures/seed_*.ts` so fast and e2e profiles agree on -- IDs / names / numeric enum values. BEGIN; -- Users (per seed_users.ts) ------------------------------------------------- INSERT INTO users (id, name, email, password_hash, role, is_active) VALUES ('user-alice', 'Alice Operator', 'op_alice@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Operator', true), ('user-bob', 'Bob Operator', 'op_bob@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Operator', true), ('user-carol', 'Carol Admin', 'admin_carol@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'Admin', true), ('user-dave', 'Dave Integrator', 'integrator_dave@test.local', '$argon2id$v=19$m=65536,t=3,p=4$test$test', 'SystemIntegrator', true) ON CONFLICT (id) DO NOTHING; -- Aircraft (per seed_aircraft.ts) ------------------------------------------- INSERT INTO aircraft (id, model, type, is_default) VALUES ('aircraft-1', 'Bayraktar TB2', 'Plane', true), ('aircraft-2', 'DJI Mavic 3', 'Copter', false), ('aircraft-3', 'Leleka-100', 'Plane', false) ON CONFLICT (id) DO NOTHING; -- Flights (per seed_flights.ts) --------------------------------------------- INSERT INTO flights (id, name, created_date, aircraft_id) VALUES ('flight-1', 'Recon Alpha', '2026-05-01T10:00:00Z', 'aircraft-1'), ('flight-2', 'Recon Bravo', '2026-05-02T11:30:00Z', 'aircraft-1'), ('flight-3', 'Survey Charlie', '2026-05-03T14:15:00Z', 'aircraft-2'), ('flight-4', 'Patrol Delta', '2026-05-04T09:45:00Z', 'aircraft-3'), ('flight-5', 'Strike Echo', '2026-05-05T16:00:00Z', 'aircraft-1') ON CONFLICT (id) DO NOTHING; -- Detection classes (contract ordering [0..N-1, 20..20+N-1, 40..40+N-1], N=9) INSERT INTO detection_classes (id, name, short_name, color, max_size_m, photo_mode) VALUES (0, 'class-0', 'c0', '#e6194b', 5, 0), (1, 'class-1', 'c1', '#3cb44b', 5, 0), (2, 'class-2', 'c2', '#ffe119', 5, 0), (3, 'class-3', 'c3', '#4363d8', 5, 0), (4, 'class-4', 'c4', '#f58231', 5, 0), (5, 'class-5', 'c5', '#911eb4', 5, 0), (6, 'class-6', 'c6', '#46f0f0', 5, 0), (7, 'class-7', 'c7', '#f032e6', 5, 0), (8, 'class-8', 'c8', '#bcf60c', 5, 0), (20, 'class-20', 'c20', '#e6194b', 5, 0), (21, 'class-21', 'c21', '#3cb44b', 5, 0), (22, 'class-22', 'c22', '#ffe119', 5, 0), (23, 'class-23', 'c23', '#4363d8', 5, 0), (24, 'class-24', 'c24', '#f58231', 5, 0), (25, 'class-25', 'c25', '#911eb4', 5, 0), (26, 'class-26', 'c26', '#46f0f0', 5, 0), (27, 'class-27', 'c27', '#f032e6', 5, 0), (28, 'class-28', 'c28', '#bcf60c', 5, 0), (40, 'class-40', 'c40', '#e6194b', 5, 0), (41, 'class-41', 'c41', '#3cb44b', 5, 0), (42, 'class-42', 'c42', '#ffe119', 5, 0), (43, 'class-43', 'c43', '#4363d8', 5, 0), (44, 'class-44', 'c44', '#f58231', 5, 0), (45, 'class-45', 'c45', '#911eb4', 5, 0), (46, 'class-46', 'c46', '#46f0f0', 5, 0), (47, 'class-47', 'c47', '#f032e6', 5, 0), (48, 'class-48', 'c48', '#bcf60c', 5, 0) ON CONFLICT (id) DO NOTHING; -- Media (per seed_media.ts) ------------------------------------------------- -- mediaStatus values follow the UI's CURRENT 0..3 scheme; AC-04 (Step 4 fix) -- will migrate the seed to the full 0..6 range. Test-data.md tracks this. INSERT INTO media (id, name, path, media_type, media_status, duration, annotation_count, waypoint_id, user_id) VALUES ('media-1', 'sortie-1.jpg', '/media/sortie-1.jpg', 1, 1, NULL, 0, NULL, 'user-alice'), ('media-2', 'sortie-2.jpg', '/media/sortie-2.jpg', 1, 2, NULL, 0, 'wp-1', 'user-alice'), ('media-3', 'sortie-3.jpg', '/media/sortie-3.jpg', 1, 3, NULL, 4, 'wp-1', 'user-alice'), ('media-4', 'patrol-1.mp4', '/media/patrol-1.mp4', 2, 1, '00:01:30', 0, NULL, 'user-bob'), ('media-5', 'patrol-2.mp4', '/media/patrol-2.mp4', 2, 3, '00:02:15', 8, NULL, 'user-bob'), ('media-6', 'manual.jpg', '/media/manual.jpg', 1, 4, NULL, 1, NULL, 'user-alice') ON CONFLICT (id) DO NOTHING; -- Annotations (per seed_annotations.ts) ------------------------------------- INSERT INTO annotations (id, media_id, time, created_date, user_id, source, status, is_split, split_tile) VALUES ('ann-1', 'media-3', NULL, '2026-05-03T14:30:00Z', 'user-alice', 0, 10, false, NULL), ('ann-2', 'media-3', NULL, '2026-05-03T14:32:00Z', 'user-alice', 0, 20, true, '3 0.5 0.5 0.2 0.2'), ('ann-3', 'media-5', '00:01:00', '2026-05-04T10:15:00Z', 'user-bob', 1, 30, false, NULL), ('ann-4', 'media-5', '00:01:30', '2026-05-04T10:20:00Z', 'user-bob', 1, 20, true, 'garbage') ON CONFLICT (id) DO NOTHING; -- User settings (per seed_user_settings.ts) --------------------------------- INSERT INTO user_settings (id, user_id, selected_flight_id, annotations_left_panel_width, annotations_right_panel_width, dataset_left_panel_width, dataset_right_panel_width) VALUES ('user-settings-alice', 'user-alice', 'flight-1', 280, 320, 240, 280), ('user-settings-bob', 'user-bob', 'flight-3', NULL, NULL, NULL, NULL) ON CONFLICT (id) DO NOTHING; COMMIT;