Files
flatrender/services/content/seed_demo_content.sql
soroush.asadi 7f03ad1d03 chore: add demo content seed for V2 content service
Idempotent SQL seed (deterministic UUIDs, ON CONFLICT DO NOTHING) that
inserts 4 categories and 8 published template containers linked to them,
so the public site shows real data through the gateway /v1/* routes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 05:22:47 +03:30

44 lines
4.8 KiB
SQL

-- Demo content seed for the FlatRender V2 content service.
-- Idempotent: deterministic UUIDs + ON CONFLICT DO NOTHING, safe to re-run.
-- Run: docker exec -i fr2-postgres psql -U postgres -d flatrender -f - < seed_demo_content.sql
-- (or pipe this file's contents to psql).
--
-- Seeds a small category tree and 8 published template containers so the
-- public site (/, /templates) shows real data through the gateway /v1/* routes.
SET search_path TO content, public;
-- ── Categories ────────────────────────────────────────────────────────────────
INSERT INTO content.categories (id, name, slug, description, sort, is_active) VALUES
('c1000000-0000-4000-8000-000000000001', 'Intro & Logo', 'intro-logo', 'Logo stings and animated intros', 1, true),
('c1000000-0000-4000-8000-000000000002', 'Social Media', 'social-media', 'Stories, reels and posts', 2, true),
('c1000000-0000-4000-8000-000000000003', 'Business', 'business', 'Corporate, promo and presentations', 3, true),
('c1000000-0000-4000-8000-000000000004', 'Marketing', 'marketing', 'Product ads and promotional videos', 4, true)
ON CONFLICT (slug) DO NOTHING;
-- ── Template containers (published) ─────────────────────────────────────────────
-- primary_mode uses the content.choose_mode enum: FIX | FLEXIBLE | MockUp | MusicVisualizer | VoiceOver
INSERT INTO content.project_containers
(id, slug, name, description, image, is_published, is_premium, primary_mode, sort, sort_date) VALUES
('a2000000-0000-4000-8000-000000000001', 'minimal-logo-reveal', 'Minimal Logo Reveal', 'Clean, elegant logo animation for any brand.', 'https://picsum.photos/seed/frlogo/640/360', true, false, 'FLEXIBLE', 1, now()),
('a2000000-0000-4000-8000-000000000002', 'glitch-intro', 'Glitch Intro', 'Energetic glitch-style opener for tech content.', 'https://picsum.photos/seed/frglitch/640/360', true, true, 'FLEXIBLE', 2, now()),
('a2000000-0000-4000-8000-000000000003', 'instagram-story-pack', 'Instagram Story Pack', 'Vertical story templates ready for social.', 'https://picsum.photos/seed/frstory/640/360', true, false, 'FLEXIBLE', 3, now()),
('a2000000-0000-4000-8000-000000000004', 'reels-promo', 'Reels Promo', 'Punchy vertical promo for reels and shorts.', 'https://picsum.photos/seed/frreels/640/360', true, false, 'FLEXIBLE', 4, now()),
('a2000000-0000-4000-8000-000000000005', 'corporate-slideshow', 'Corporate Slideshow', 'Professional slideshow for company presentations.', 'https://picsum.photos/seed/frcorp/640/360', true, false, 'FLEXIBLE', 5, now()),
('a2000000-0000-4000-8000-000000000006', 'startup-pitch', 'Startup Pitch', 'Modern pitch-deck style animated presentation.', 'https://picsum.photos/seed/frpitch/640/360', true, true, 'FLEXIBLE', 6, now()),
('a2000000-0000-4000-8000-000000000007', 'product-showcase', 'Product Showcase', 'Highlight product features with smooth motion.', 'https://picsum.photos/seed/frprod/640/360', true, false, 'FLEXIBLE', 7, now()),
('a2000000-0000-4000-8000-000000000008', 'sale-countdown', 'Sale Countdown', 'Eye-catching promo with an animated countdown.', 'https://picsum.photos/seed/frsale/640/360', true, false, 'FLEXIBLE', 8, now())
ON CONFLICT (slug) DO NOTHING;
-- ── Container ↔ category links ──────────────────────────────────────────────────
INSERT INTO content.container_categories (container_id, category_id, sort) VALUES
('a2000000-0000-4000-8000-000000000001', 'c1000000-0000-4000-8000-000000000001', 0), -- Logo Reveal → Intro & Logo
('a2000000-0000-4000-8000-000000000002', 'c1000000-0000-4000-8000-000000000001', 0), -- Glitch Intro → Intro & Logo
('a2000000-0000-4000-8000-000000000003', 'c1000000-0000-4000-8000-000000000002', 0), -- Story Pack → Social Media
('a2000000-0000-4000-8000-000000000004', 'c1000000-0000-4000-8000-000000000002', 0), -- Reels Promo → Social Media
('a2000000-0000-4000-8000-000000000005', 'c1000000-0000-4000-8000-000000000003', 0), -- Corporate → Business
('a2000000-0000-4000-8000-000000000006', 'c1000000-0000-4000-8000-000000000003', 0), -- Startup Pitch → Business
('a2000000-0000-4000-8000-000000000007', 'c1000000-0000-4000-8000-000000000004', 0), -- Product Showcase→ Marketing
('a2000000-0000-4000-8000-000000000008', 'c1000000-0000-4000-8000-000000000004', 0) -- Sale Countdown → Marketing
ON CONFLICT (container_id, category_id) DO NOTHING;