This commit is contained in:
Stan
2026-04-19 21:14:16 +02:00
parent 0c74a75126
commit 28d167f11f
42 changed files with 5681 additions and 55 deletions
+14
View File
@@ -1,5 +1,11 @@
-- Seed data provides one complete end-to-end example for the frontend:
-- a checklist template, lookup values, image policy, export profile, and a few
-- app-level settings. The goal is not exhaustive coverage but a realistic shape
-- that exercises the dynamic form renderer and admin configuration flow.
USE check_list;
-- Register the template shell first so later version rows can reference it.
INSERT INTO templates (code, name, description)
VALUES (
'incoming-inspection',
@@ -12,6 +18,9 @@ ON DUPLICATE KEY UPDATE
SET @template_id = (SELECT id FROM templates WHERE code = 'incoming-inspection');
-- The JSON payload below is intentionally close to the frontend contract. That
-- makes it easy to inspect how the browser creates fields, validation hints, and
-- attachment requirements without another transformation layer in the backend.
INSERT INTO template_versions (
template_id,
version_number,
@@ -126,6 +135,8 @@ ON DUPLICATE KEY UPDATE
definition_json = VALUES(definition_json),
published_at = VALUES(published_at);
-- Lookups are seeded separately because multiple templates may eventually reuse
-- the same option sets, such as pass/fail or standardized status lists.
INSERT INTO lookup_sets (code, name)
VALUES
('pass-fail', 'Pass/Fail'),
@@ -150,6 +161,7 @@ ON DUPLICATE KEY UPDATE
sort_order = VALUES(sort_order),
is_default = VALUES(is_default);
-- The image rule row is the configuration edited by the administrator UI.
INSERT INTO image_rules (
code,
name,
@@ -185,6 +197,7 @@ ON DUPLICATE KEY UPDATE
max_attachments_per_field = VALUES(max_attachments_per_field),
is_active = VALUES(is_active);
-- Export profile settings are placeholders for the later XLSX/ZIP phase.
INSERT INTO export_profiles (
code,
name,
@@ -211,6 +224,7 @@ ON DUPLICATE KEY UPDATE
include_export_timestamp = VALUES(include_export_timestamp),
is_active = VALUES(is_active);
-- App config values fine-tune the client without changing code.
INSERT INTO app_config (config_key, config_value_json)
VALUES
('autosave', '{"enabled": true, "intervalSeconds": 20}'),