RezinaLMS-CustomerEnd/packages/db/seed/demo-seed.mjs
kirukib c6dc5d46a8 feat: guided tour, course cards with enrolled counts, abstract steps, grouped payments, SEO, founder link
- After sign-in a 7-step spotlight tour shows students around (replay from the menu); ends on Esc or navigation
- Course cards: edge-to-edge photo, student count (Course.enrolledCount), arrow that inverts on hover
  (fixes white-on-white hover in dark mode)
- Landing: stats removed; How it works uses abstract CSS art; payment card grouped by mobile money,
  bank cards and from abroad; step 2 copy covers local and international payment
- SEO: metadata (title template, description, keywords, canonical, Open Graph, Twitter), per-route titles,
  EducationalOrganization JSON-LD with founder Rezina Brhane and her TikTok, robots.txt, sitemap.xml;
  same tags on the waitlist page
- Footers link the founder's TikTok
- Backend issue drafted: design/issues/enrollment-counts.md
- Smoke test: blocks third-party requests (Vimeo iframe stalled unloads), tolerates a missed load event;
  it caught a hook-order crash on the course page, fixed here

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 15:05:39 +03:00

239 lines
35 KiB
JavaScript

// Demo seed (C0-06). Writes one JSON file per document into <outDir>/<collection>/<id>.json, shaped like SPEC §6
// so C0-08 can feed the same data into the Prisma seed. Usage: node packages/db/seed/demo-seed.mjs <outDir>
// Om/Ti text is draft — needs translator review. Students marked isSample are fictional test records.
import fs from 'fs'; import path from 'path';
const out = process.argv[2] || 'dist/seed';
const put = (col, id, body) => { fs.mkdirSync(path.join(out, col), { recursive: true }); fs.writeFileSync(path.join(out, col, id + '.json'), JSON.stringify({ ...body, id }, null, 1)); };
put('settings', 'app', { brandName: 'Sirkul Makeup', supportPhone: '+251 911 234 567', telegramLink: 'https://t.me/sirkulmakeup_demo', supportEmail: 'support@sirkul-makeup.example', sessionLimit: 2, maintenanceBanner: '' });
const cats = [
['cat-fundamentals', 'fundamentals', { en: 'Makeup fundamentals', am: 'የሜካፕ መሠረታዊ ነገሮች', om: "Bu'uura meekaappii", ti: 'መሰረታዊ ሜካፕ' }],
['cat-bridal', 'bridal-events', { en: 'Bridal & events', am: 'ሙሽራና ልዩ ዝግጅቶች', om: 'Fuudhaa fi heerumaa fi sirnoota', ti: 'መርዓን በዓላትን' }],
['cat-skin', 'skin-care', { en: 'Skin care', am: 'የቆዳ እንክብካቤ', om: 'Kunuunsa gogaa', ti: 'ክንክን ቆርበት' }],
];
cats.forEach(([id, slug, n], i) => put('categories', id, { slug, sortOrder: i + 1, isActive: true, translations: Object.fromEntries(Object.entries(n).map(([l, name]) => [l, { name }])) }));
const L = (id, min, t, opts = {}) => ({ id, sortOrder: 0, isPreview: false, isPublished: true, durationSec: min * 60, videoAssetId: null, videoStatus: 'READY', translations: t, ...opts });
const tt = (en, am, om, ti, d) => ({ en: { title: en, description: d?.en }, am: { title: am, description: d?.am }, om: { title: om }, ti: { title: ti } });
const ch = (id, t, s, lessons) => ({ id, sortOrder: 0, translations: Object.fromEntries(Object.entries(t).map(([l, title]) => [l, { title, summary: s[l] }])), lessons: lessons.map((x, i) => ({ ...x, sortOrder: i + 1 })) });
// Sample assessments (multiple choice). Each option list keeps the same order in every locale; om/ti fall back to English.
const Q = (id, answer, en, am) => ({ id, answer, translations: { en: { prompt: en[0], options: en[1], explain: en[2] }, am: { prompt: am[0], options: am[1], explain: am[2] } } });
const QUIZZES = {
'makeup-foundations': [
{ id: 'as-f1', chapterId: 'ch-f1', passPct: 70, translations: { en: { title: 'Skin check', intro: 'Three quick questions on reading skin.' }, am: { title: 'የቆዳ ፈተና', intro: 'ቆዳን ስለማንበብ ሦስት አጭር ጥያቄዎች።' } }, questions: [
Q('q-f1-1', 0, ['Which light is best for reading undertones?', ['Window daylight', 'A warm bulb', 'Phone flash'], 'Daylight shows true color. Warm bulbs make every skin look golden.'],
['የቆዳ ቀለም መሠረትን ለማንበብ ምርጡ ብርሃን የትኛው ነው?', ['የመስኮት የቀን ብርሃን', 'ሞቃት አምፖል', 'የስልክ ፍላሽ'], 'የቀን ብርሃን እውነተኛውን ቀለም ያሳያል።']),
Q('q-f1-2', 1, ['The veins on the wrist look green. The undertone is most likely:', ['Cool', 'Warm', 'Neutral'], 'Green-looking veins usually point to a warm undertone.'],
['በእጅ አንጓ ላይ ያሉት የደም ሥሮች አረንጓዴ ይመስላሉ። የቆዳ ቀለም መሠረቱ ምን ሊሆን ይችላል?', ['ቀዝቃዛ', 'ሞቃት', 'ገለልተኛ'], 'አረንጓዴ የሚመስሉ የደም ሥሮች ብዙውን ጊዜ ሞቃት መሠረትን ያሳያሉ።']),
Q('q-f1-3', 1, ['Which prep is right for oily skin?', ['A heavy cream', 'Cleanse, then a light oil-free moisturizer', 'Skip moisturizer'], 'Oily skin still needs moisture. Choose a light, oil-free one.'],
['ለቅባታማ ቆዳ ዝግጅት የትኛው ትክክል ነው?', ['ወፍራም ክሬም', 'ማጽዳት፣ ከዚያ ቀላል ቅባት የሌለው እርጥበት', 'እርጥበት አለመጠቀም'], 'ቅባታማ ቆዳም እርጥበት ያስፈልገዋል፤ ቀላልና ቅባት የሌለው ይምረጡ።']),
] },
{ id: 'as-f2', chapterId: null, passPct: 70, translations: { en: { title: 'Final assessment', intro: 'Four questions from the whole course. You need 70% to pass.' }, am: { title: 'የማጠቃለያ ፈተና', intro: 'ከኮርሱ አራት ጥያቄዎች። ለማለፍ 70% ያስፈልጋል።' } }, questions: [
Q('q-f2-1', 1, ['Where should you test a foundation shade?', ['Back of the hand', 'Along the jawline, in daylight', 'Forehead, under a lamp'], 'The jawline joins face and neck, and daylight shows the true match.'],
['የፋውንዴሽን ቀለም የት መሞከር አለበት?', ['በእጅ ጀርባ', 'በመንጋጋ መስመር፣ በቀን ብርሃን', 'በግንባር፣ በመብራት ስር'], 'መንጋጋው ፊትንና አንገትን ያገናኛል፤ የቀን ብርሃን ትክክለኛውን ቀለም ያሳያል።']),
Q('q-f2-2', 0, ['A damp sponge is best for:', ['Pressing product in for a natural finish', 'Packing on thick powder', 'Drawing brows'], 'Pressing (not wiping) blends the base into the skin.'],
['እርጥብ ስፖንጅ ለምን ይበልጥ ይጠቅማል?', ['ተፈጥሯዊ እንዲመስል ጫን ጫን አድርጎ ለማዋሃድ', 'ወፍራም ፓውደር ለመቀባት', 'ቅንድብ ለመሳል'], 'ጫን ጫን ማድረግ (መጥረግ ሳይሆን) ፋውንዴሽኑን ከቆዳ ጋር ያዋሕዳል።']),
Q('q-f2-3', 1, ['For all-day wear, setting powder goes mostly:', ['Everywhere, thickly', 'On the T-zone and under the eyes', 'Only on the cheeks'], 'Set where skin gets oily or creases; leave the rest fresh.'],
['ቀኑን ሙሉ እንዲቆይ ፓውደር በብዛት የት ይደረጋል?', ['በፊት ሁሉ፣ በወፍራሙ', 'በግንባር፣ በአፍንጫና ከዓይን ስር', 'በጉንጭ ብቻ'], 'ቆዳ በሚቀባበት ወይም በሚታጠፍበት ቦታ ያድርጉ።']),
Q('q-f2-4', 0, ['A brow should start roughly:', ['In line with the side of the nose', 'At the middle of the eye', 'Above the pupil'], 'Hold a brush along the side of the nose to find the start.'],
['ቅንድብ በግምት የት ይጀምራል?', ['ከአፍንጫው ጎን ትይዩ', 'ከዓይኑ መሃል', 'ከዓይን ብሌን በላይ'], 'መነሻውን ለማግኘት ብሩሽን ከአፍንጫው ጎን ጋር ትይዩ ይያዙ።']),
] },
],
'bridal-makeup': [
{ id: 'as-b1', chapterId: null, passPct: 75, translations: { en: { title: 'Bridal final assessment', intro: 'Four questions on planning and long wear. 75% to pass.' }, am: { title: 'የሙሽራ ማጠቃለያ ፈተና', intro: 'ስለ ዕቅድና ረጅም ጊዜ ስለሚቆይ ሜካፕ አራት ጥያቄዎች። ለማለፍ 75% ያስፈልጋል።' } }, questions: [
Q('q-b1-1', 1, ['When should the bridal trial happen?', ['The morning of the wedding', '2 to 6 weeks before', '6 months before'], 'Close enough to match the final look, early enough to change it.'],
['የሙሽራ ሙከራ መቼ መደረግ አለበት?', ['በሠርጉ ቀን ጠዋት', 'ከሠርጉ ከ2 እስከ 6 ሳምንት በፊት', 'ከ6 ወር በፊት'], 'ለመጨረሻው ሜካፕ ቅርብ፣ ለመቀየር ግን በቂ ጊዜ ያለው።']),
Q('q-b1-2', 1, ['For flash photography, avoid:', ['Matte setting powder', 'High-SPF foundation that leaves a white cast', 'Waterproof mascara'], 'Some sunscreens reflect flash and show up white in photos.'],
['ለካሜራ ፍላሽ ምን መወገድ አለበት?', ['ማት ፓውደር', 'በፎቶ ላይ ነጭ የሚያሳይ ብዙ SPF ያለው ፋውንዴሽን', 'ውሃ የማያስገባ ማስካራ'], 'አንዳንድ የፀሐይ መከላከያዎች ፍላሽን አንጸባርቀው በፎቶ ነጭ ይታያሉ።']),
Q('q-b1-3', 0, ['Tears at the melse: which mascara?', ['Waterproof', 'Regular volumizing', 'No mascara'], 'Waterproof formulas survive tears and a long day.'],
['በመልስ ላይ እንባ ቢመጣ የትኛው ማስካራ ይሻላል?', ['ውሃ የማያስገባ', 'መደበኛ', 'ማስካራ አያስፈልግም'], 'ውሃ የማያስገባ ማስካራ እንባንና ረጅም ቀንን ይቋቋማል።']),
Q('q-b1-4', 0, ['What goes in the touch-up kit you leave with the family?', ['Blotting papers, powder and the lip color', 'A full foundation kit', 'Nothing'], 'Small, simple items anyone can use between ceremonies.'],
['ለቤተሰቡ በሚተዉት የማስተካከያ ኪት ውስጥ ምን ይገባል?', ['ቅባት መምጠጫ ወረቀት፣ ፓውደርና የከንፈር ቀለም', 'ሙሉ የፋውንዴሽን ኪት', 'ምንም'], 'በሥነ ሥርዓቶች መካከል ማንም ሊጠቀምባቸው የሚችሉ ቀላል ዕቃዎች።']),
] },
],
'skin-prep-and-care': [
{ id: 'as-s1', chapterId: null, passPct: 70, translations: { en: { title: 'Skin care check', intro: 'Three questions on safe, clean practice.' }, am: { title: 'የቆዳ እንክብካቤ ፈተና', intro: 'ስለ ደህንነቱ የተጠበቀና ንጹሕ አሠራር ሦስት ጥያቄዎች።' } }, questions: [
Q('q-s1-1', 1, ['A client has a painful rash. What do you do?', ['Cover it with concealer', 'Stop and refer her to a doctor', 'Exfoliate it'], 'Painful or broken skin is a doctor\'s job, not a makeup job.'],
['ደንበኛዋ የሚያም ሽፍታ አለባት። ምን ያደርጋሉ?', ['በኮንሲለር መሸፈን', 'ማቆምና ወደ ሐኪም መላክ', 'መፋቅ'], 'የሚያም ወይም የተሰነጠቀ ቆዳ የሐኪም ሥራ ነው።']),
Q('q-s1-2', 1, ['Sponges between clients:', ['Wipe and reuse', 'Wash and dry, or use a fresh one', 'Spray with perfume'], 'Bacteria survive a wipe. Wash, dry fully or use a new sponge.'],
['በደንበኞች መካከል ስፖንጅ እንዴት ይያዛል?', ['በመጥረግ ብቻ እንደገና መጠቀም', 'ማጠብና ማድረቅ፣ ወይም አዲስ መጠቀም', 'ሽቶ መርጨት'], 'ባክቴሪያ በመጥረግ አይጠፋም።']),
Q('q-s1-3', 1, ['Dark spots get worse with:', ['Daily sunscreen', 'Sun without protection', 'A gentle cleanser'], 'Sun is the main trigger for hyperpigmentation.'],
['የቆዳ መጥቆርን የሚያባብሰው የትኛው ነው?', ['በየቀኑ የፀሐይ መከላከያ', 'ያለ መከላከያ ፀሐይ', 'ለስላሳ ማጽጃ'], 'ፀሐይ የቆዳ መጥቆር ዋና ምክንያት ነው።']),
] },
],
};
const order = (c) => ({ ...c, chapters: c.chapters.map((x, i) => ({ ...x, sortOrder: i + 1 })), assessments: QUIZZES[c.slug] ?? [] });
const base = { coverAssetId: null, isFeatured: false, isTest: false, sequentialLessons: false, prerequisiteCourseId: null, createdAt: '2026-01-05T08:00:00.000Z' };
put('courses', 'crs-foundations', order({ ...base, slug: 'makeup-foundations', categoryId: 'cat-fundamentals', instructorName: 'Meron Tesfaye', instructionLocale: 'am', coverTone: 'rose', status: 'PUBLISHED', isFeatured: true, publishedAt: '2026-01-10T08:00:00.000Z', updatedAt: '2026-09-02T08:00:00.000Z', prices: { ETB: 120000 },
translations: {
en: { title: 'Makeup foundations', subtitle: 'Skin prep, base and color for every Ethiopian skin tone.', audience: 'Beginners and self-taught artists who want a solid, clean base.', description: 'Start from the skin up. You will learn to read undertones, choose and blend foundation for deep and medium skin, and build a soft everyday look that lasts through an Addis afternoon.', outcomes: ['Match foundation to warm, neutral and olive undertones', 'Blend a seamless base that photographs well', 'Finish a full everyday look in 20 minutes'] },
am: { title: 'የሜካፕ መሠረታዊ ትምህርት', subtitle: 'ለሁሉም የኢትዮጵያ የቆዳ ቀለሞች የቆዳ ዝግጅት፣ ፋውንዴሽንና ቀለም።', audience: 'ጠንካራ መሠረት ለሚፈልጉ ጀማሪዎችና በራሳቸው ለተማሩ ባለሙያዎች።', description: 'ከቆዳው ይጀምሩ። የቆዳ ቀለም መሠረትን ማንበብ፣ ፋውንዴሽን መምረጥና ማዋሃድ፣ እንዲሁም ቀኑን ሙሉ የሚቆይ የዕለት ሜካፕ መሥራት ይማራሉ።', outcomes: ['ፋውንዴሽንን ከቆዳ ቀለም ጋር ማዛመድ', 'በፎቶ ላይ ጥሩ የሚታይ ፋውንዴሽን ማዋሃድ', 'ሙሉ የዕለት ሜካፕ በ20 ደቂቃ መጨረስ'] },
om: { title: "Bu'uura meekaappii", description: 'Gogaa irraa jalqabi. Bifa gogaa dubbisuu, foundation filachuu fi walmakuu, akkasumas meekaappii guyyaa guyyaa barattu.' },
ti: { title: 'መሰረታዊ ሜካፕ', description: 'ካብ ቆርበት ጀምር። ሕብሪ ቆርበት ምንባብ፣ ፋውንዴሽን ምምራጽን ምውህሃድን፣ ናይ መዓልቲ ሜካፕ ክትሰርሕ ትማሃር።' },
},
chapters: [
ch('ch-f1', { en: 'Know your skin', am: 'ቆዳዎን ይወቁ', om: 'Gogaa kee beeki', ti: 'ቆርበትካ ፍለጥ' }, { en: 'Every good look starts with reading the skin in front of you.', am: 'ጥሩ ሜካፕ የሚጀምረው ፊትዎ ያለውን ቆዳ በማንበብ ነው።' }, [
L('les-f1', 9, tt('Undertones in daylight', 'የቆዳ ቀለም መሠረት በቀን ብርሃን', 'Bifa gogaa ifa guyyaatiin', 'ሕብሪ ቆርበት ብብርሃን መዓልቲ', { en: 'Use a white sheet and window light to read warm, neutral and olive undertones.', am: 'ነጭ ወረቀትና የመስኮት ብርሃን ተጠቅመው የቆዳ ቀለም መሠረትን ያንብቡ።' }), { isPreview: true }),
L('les-f2', 12, tt('Prep for oily and dry skin', 'ለቅባታማና ደረቅ ቆዳ ዝግጅት', 'Qophii gogaa cooma qabuu fi gogaa', 'ምድላው ንዘይታውን ደረቕን ቆርበት')),
]),
ch('ch-f2', { en: 'Base that lasts', am: 'የሚቆይ ፋውንዴሽን', om: 'Bu\'uura turu', ti: 'ዝጸንሕ መሰረት' }, { en: 'Heat and long days are the real test of a base.', am: 'ሙቀትና ረጅም ቀን የፋውንዴሽን እውነተኛ ፈተና ናቸው።' }, [
L('les-f3', 14, tt('Choosing foundation shades', 'የፋውንዴሽን ቀለም መምረጥ', 'Bifa foundation filachuu', 'ሕብሪ ፋውንዴሽን ምምራጽ')),
L('les-f4', 11, tt('Blending with brush and sponge', 'በብሩሽና በስፖንጅ ማዋሃድ', 'Bursii fi isponjiitiin walmakuu', 'ብብሩሽን ስፖንጅን ምውህሃድ')),
L('les-f5', 8, tt('Setting for an all-day finish', 'ቀኑን ሙሉ እንዲቆይ ማድረግ', 'Guyyaa guutuu akka turu gochuu', 'ንምሉእ መዓልቲ ንክጸንሕ')),
]),
ch('ch-f3', { en: 'The everyday look', am: 'የዕለት ሜካፕ', om: 'Meekaappii guyyaa guyyaa', ti: 'ናይ መዓልቲ ሜካፕ' }, { en: 'Put it together: a 20-minute look for work or church.', am: 'ሁሉንም በአንድ ላይ፦ ለሥራ ወይም ለቤተ ክርስቲያን የ20 ደቂቃ ሜካፕ።' }, [
L('les-f6', 10, tt('Brows that frame the face', 'ፊትን የሚያሳምር ቅንድብ', 'Hiddii fuula miidhagsu', 'ገጽ ዘጸባብቕ ቅንድብ')),
L('les-f7', 15, tt('Full look, start to finish', 'ሙሉ ሜካፕ ከመጀመሪያ እስከ መጨረሻ', 'Meekaappii guutuu jalqaba hanga dhumaatti', 'ምሉእ ሜካፕ ካብ መጀመርታ ክሳብ መወዳእታ')),
]),
] }));
put('courses', 'crs-bridal', order({ ...base, slug: 'bridal-makeup', categoryId: 'cat-bridal', instructorName: 'Hanna Bekele', instructionLocale: 'am', coverTone: 'plum', status: 'PUBLISHED', isFeatured: true, sequentialLessons: true, prerequisiteCourseId: 'crs-foundations', publishedAt: '2026-03-01T08:00:00.000Z', updatedAt: '2026-08-20T08:00:00.000Z', prices: { ETB: 250000 },
translations: {
en: { title: 'Bridal makeup for Ethiopian weddings', subtitle: 'From the melse to the reception: looks that survive a 14-hour day.', audience: 'Artists who finished Makeup foundations and want to take bridal bookings.', description: 'Plan, test and deliver bridal looks for traditional and modern ceremonies. Includes a client consultation script and a kit checklist.', outcomes: ['Run a bridal trial and consultation', 'Create long-wear looks for habesha kemis and white gowns', 'Touch up efficiently between ceremonies'] },
am: { title: 'የሙሽራ ሜካፕ ለኢትዮጵያ ሠርግ', subtitle: 'ከመልስ እስከ ግብዣ፦ 14 ሰዓት የሚቆይ ሜካፕ።', audience: 'የመሠረታዊ ትምህርቱን ጨርሰው የሙሽራ ሥራ መቀበል ለሚፈልጉ ባለሙያዎች።', description: 'ለባህላዊና ዘመናዊ ሠርጎች የሙሽራ ሜካፕ ማቀድ፣ መሞከርና መሥራት። የደንበኛ ምክክር መመሪያና የዕቃ ዝርዝር ይጨምራል።', outcomes: ['የሙሽራ ሙከራና ምክክር ማካሄድ', 'ለሀበሻ ቀሚስና ለነጭ ቬሎ የሚቆይ ሜካፕ መሥራት', 'በሥነ ሥርዓቶች መካከል በፍጥነት ማስተካከል'] },
om: { title: 'Meekaappii misirroo cidha Itoophiyaaf', description: 'Meekaappii misirroo sirna aadaa fi ammayyaaf karoorsuu, yaaluu fi hojjechuu.' },
ti: { title: 'ሜካፕ መርዓት ንመርዓ ኢትዮጵያ', description: 'ንባህላውን ዘመናውን መርዓታት ሜካፕ መርዓት ምውጣን፣ ምፍታንን ምስራሕን።' },
},
chapters: [
ch('ch-b1', { en: 'Consultation and trial', am: 'ምክክርና ሙከራ', om: 'Mari\'achuu fi yaalii', ti: 'ምምኽኻርን ፈተነን' }, { en: 'Most bridal problems are solved before the wedding day.', am: 'አብዛኛው የሙሽራ ችግር የሚፈታው ከሠርጉ ቀን በፊት ነው።' }, [
L('les-b1', 10, tt('The consultation script', 'የምክክር መመሪያ', 'Qajeelfama mari\'achuu', 'መምርሒ ምምኽኻር'), { isPreview: true }),
L('les-b2', 16, tt('Running a bridal trial', 'የሙሽራ ሙከራ ማካሄድ', 'Yaalii misirroo gaggeessuu', 'ፈተነ መርዓት ምክያድ')),
]),
ch('ch-b2', { en: 'Long-wear techniques', am: 'ረጅም ጊዜ የሚቆይ ዘዴ', om: 'Tooftaa yeroo dheeraa turu', ti: 'ንነዊሕ ግዜ ዝጸንሕ ሜላ' }, { en: 'Heat, tears and flash photography: plan for all three.', am: 'ሙቀት፣ እንባና የካሜራ ብልጭታ፦ ለሦስቱም ያቅዱ።' }, [
L('les-b3', 18, tt('Traditional look for habesha kemis', 'ለሀበሻ ቀሚስ ባህላዊ ሜካፕ', 'Meekaappii aadaa kemis habashaaf', 'ባህላዊ ሜካፕ ንሓበሻ ክዳን')),
L('les-b4', 17, tt('Modern look for the white gown', 'ለነጭ ቬሎ ዘመናዊ ሜካፕ', 'Meekaappii ammayyaa uffata adiif', 'ዘመናዊ ሜካፕ ንጻዕዳ ቬሎ')),
L('les-b5', 9, tt('Touch-ups between ceremonies', 'በሥነ ሥርዓቶች መካከል ማስተካከል', 'Sirnoota gidduutti sirreessuu', 'ኣብ መንጎ ስነ ስርዓታት ምዕራይ'), { isPublished: false, videoStatus: 'PROCESSING' }),
]),
] }));
put('courses', 'crs-skin', order({ ...base, slug: 'skin-prep-and-care', categoryId: 'cat-skin', instructorName: 'Dr. Selam Alemu', instructionLocale: 'en', coverTone: 'sage', status: 'PUBLISHED', publishedAt: '2026-05-15T08:00:00.000Z', updatedAt: '2026-07-01T08:00:00.000Z', prices: { ETB: 80000 },
translations: {
en: { title: 'Skin prep and care', subtitle: 'What artists should know about skin before any makeup touches it.', audience: 'Artists and clients who want healthier skin under makeup.', description: 'Hyperpigmentation, sun, sensitivity and hygiene: a dermatologist explains what to do, what to avoid and when to refer a client.', outcomes: ['Spot skin conditions that need a doctor', 'Build a simple prep routine for clients', 'Keep your kit hygienic between clients'] },
am: { title: 'የቆዳ ዝግጅትና እንክብካቤ', subtitle: 'ሜካፕ ከመቀባቱ በፊት ባለሙያዎች ስለ ቆዳ ማወቅ ያለባቸው።', description: 'የቆዳ መጥቆር፣ ፀሐይ፣ ስሜታዊነትና ንጽሕና፦ የቆዳ ሐኪም ምን ማድረግ፣ ምን መራቅ እንዳለብዎና መቼ ደንበኛን ወደ ሐኪም መላክ እንዳለብዎ ያስረዳሉ።', outcomes: ['ሐኪም የሚያስፈልጋቸውን የቆዳ ችግሮች መለየት', 'ለደንበኞች ቀላል የቆዳ ዝግጅት', 'በደንበኞች መካከል ዕቃዎችን ንጹሕ ማድረግ'] },
om: { title: 'Qophii fi kunuunsa gogaa', description: "Ogeessi gogaa waan hojjechuu fi irraa fagaachuu qabdu ibsa." },
ti: { title: 'ምድላውን ክንክንን ቆርበት', description: 'ሓኪም ቆርበት እንታይ ክትገብርን ካብ እንታይ ክትርሕቕን ከም ዘለካ ይገልጽ።' },
},
chapters: [
ch('ch-s1', { en: 'Healthy skin first', am: 'መጀመሪያ ጤናማ ቆዳ', om: 'Duraan gogaa fayyaa', ti: 'ቅድም ጥዑይ ቆርበት' }, { en: 'Makeup sits better on skin that is cared for.', am: 'ሜካፕ በተንከባከቡት ቆዳ ላይ የተሻለ ይቀመጣል።' }, [
L('les-s1', 12, tt('Hyperpigmentation and sun', 'የቆዳ መጥቆርና ፀሐይ', 'Gurraachummaa gogaa fi aduu', 'ምጽላም ቆርበትን ጸሓይን'), { isPreview: true }),
L('les-s2', 10, tt('Kit hygiene between clients', 'በደንበኞች መካከል የዕቃ ንጽሕና', 'Qulqullina meeshaa maamiltoota gidduutti', 'ጽሬት ናውቲ ኣብ መንጎ ዓማዊል')),
]),
] }));
// ---- PLACEHOLDER courses (simulated): remove after backend integration, see design/issues/remove-placeholder-courses.md
put('courses', 'crs-softglam', order({ ...base, slug: 'soft-glam-evening', categoryId: 'cat-fundamentals', instructorName: 'Meron Tesfaye', instructionLocale: 'am', coverTone: 'clay', status: 'PUBLISHED', isFeatured: true, publishedAt: '2026-06-01T08:00:00.000Z', updatedAt: '2026-09-10T08:00:00.000Z', prices: { ETB: 150000 },
translations: {
en: { title: 'Soft glam for evenings', subtitle: 'A camera-ready evening look in under an hour.', audience: 'Artists who know the basics and want a signature evening look.', description: 'Sculpt, smoke and highlight for parties, graduations and photo shoots, with looks built for deep and medium skin.', outcomes: ['Sculpt with warm bronzer instead of grey contour', 'Build a soft smoky eye in three layers', 'Finish skin that glows on camera without flashback'] },
am: { title: 'የምሽት ሶፍት ግላም', subtitle: 'ከአንድ ሰዓት ባነሰ ጊዜ ለካሜራ ዝግጁ የሆነ የምሽት ሜካፕ።', description: 'ለግብዣ፣ ለምረቃና ለፎቶ ቀረጻ ፊትን ማስዋብ፣ የጭስ ዓይንና ብርሃን አሰጣጥ።' },
},
chapters: [
ch('ch-g1', { en: 'Sculpt and glow', am: 'ቅርጽና ብርሃን' }, { en: 'Shape the face with warmth, not shadow.' }, [
L('les-g1', 8, tt('Warm sculpting for deep skin', 'ለጠቆረ ቆዳ ሞቅ ያለ ቅርጽ', 'Bocaa gogaa gurraachaaf', 'ቅርጺ ንጸሊም ቆርበት'), { isPreview: true }),
L('les-g2', 11, tt('Highlight that photographs well', 'በፎቶ የሚያምር ብርሃን', 'Ifa suuraa irratti mul\'atu', 'ኣብ ስእሊ ዝጽቡቕ ብርሃን')),
]),
ch('ch-g2', { en: 'Eyes and lips', am: 'ዓይንና ከንፈር' }, { en: 'One soft smoky eye, three ways.' }, [
L('les-g3', 14, tt('Soft smoky eye in three layers', 'በሦስት ደረጃ የጭስ ዓይን', 'Ija aaraa sadarkaa sadiin', 'ናይ ትኪ ዓይኒ ብሰለስተ ደረጃ')),
L('les-g4', 9, tt('Lips that last the night', 'ሌሊቱን ሙሉ የሚቆይ ከንፈር', 'Hidhii halkan guutuu turu', 'ንምሉእ ለይቲ ዝጸንሕ ከንፈር')),
]),
] }));
put('courses', 'crs-habesha', order({ ...base, slug: 'traditional-habesha-looks', categoryId: 'cat-bridal', instructorName: 'Hanna Bekele', instructionLocale: 'am', coverTone: 'sand', status: 'PUBLISHED', publishedAt: '2026-07-01T08:00:00.000Z', updatedAt: '2026-09-15T08:00:00.000Z', prices: { ETB: 180000 },
translations: {
en: { title: 'Traditional Habesha looks', subtitle: 'Makeup for kemis, holidays and cultural ceremonies.', audience: 'Artists booked for Timket, Meskel, weddings and cultural events.', description: 'Looks that work with netela, gold jewelry and braided hair, from a soft holiday face to a full ceremony look.', outcomes: ['Match makeup to kemis colors and gold', 'Keep the look fresh through an outdoor holiday', 'Work around braids and head jewelry'] },
am: { title: 'ባህላዊ የሀበሻ ሜካፕ', subtitle: 'ለሀበሻ ቀሚስ፣ ለበዓላትና ለባህላዊ ሥነ ሥርዓቶች።', description: 'ከነጠላ፣ ከወርቅ ጌጣጌጥና ከሹሩባ ጋር የሚሄድ ሜካፕ።' },
},
chapters: [
ch('ch-h1', { en: 'Holiday looks', am: 'የበዓል ሜካፕ' }, { en: 'Outdoor light and long days call for a soft, sure base.' }, [
L('les-h1', 10, tt('A soft look for Timket and Meskel', 'ለጥምቀትና ለመስቀል ለስላሳ ሜካፕ', 'Meekaappii Timqataa fi Masqalaaf', 'ሜካፕ ንጥምቀትን መስቀልን'), { isPreview: true }),
L('les-h2', 13, tt('Makeup with gold and netela', 'ከወርቅና ከነጠላ ጋር ሜካፕ', 'Meekaappii warqee fi netelaa wajjin', 'ሜካፕ ምስ ወርቅን ነጠላን')),
]),
ch('ch-h2', { en: 'Ceremony looks', am: 'የሥነ ሥርዓት ሜካፕ' }, { en: 'Full looks that hold up in photos and in person.' }, [
L('les-h3', 16, tt('Full ceremony look, start to finish', 'ሙሉ የሥነ ሥርዓት ሜካፕ', 'Meekaappii sirnaa guutuu', 'ምሉእ ሜካፕ ስነ ስርዓት')),
]),
] }));
put('courses', 'crs-clientele', order({ ...base, slug: 'building-your-clientele', categoryId: 'cat-fundamentals', instructorName: 'Meron Tesfaye', instructionLocale: 'en', coverTone: 'ink', status: 'PUBLISHED', publishedAt: '2026-08-01T08:00:00.000Z', updatedAt: '2026-09-18T08:00:00.000Z', prices: { ETB: 60000 },
translations: {
en: { title: 'Building your clientele', subtitle: 'Pricing, kit and bookings for freelance artists.', audience: 'Artists ready to take paid clients.', description: 'Set your prices, build a kit you can afford, and turn Instagram and Telegram into steady bookings.', outcomes: ['Price a look so it pays', 'Build a starter kit on a budget', 'Get repeat bookings from social media'] },
am: { title: 'ደንበኞችዎን መገንባት', subtitle: 'ለግል ባለሙያዎች ዋጋ፣ ዕቃና ቀጠሮ።', description: 'ዋጋ ማውጣት፣ በአቅም ዕቃ መግዛትና ማኅበራዊ ሚዲያን ወደ ቋሚ ቀጠሮ መቀየር።' },
},
chapters: [
ch('ch-c1', { en: 'Getting booked', am: 'ቀጠሮ ማግኘት' }, { en: 'Your first ten clients come from people who already know you.' }, [
L('les-c1', 7, tt('What to charge in Addis', 'በአዲስ አበባ ምን ያህል ማስከፈል', 'Finfinneetti meeqa kaffalchiisuu', 'ኣብ ኣዲስ ኣበባ ክንደይ ምኽፋል'), { isPreview: true }),
L('les-c2', 9, tt('A starter kit on a budget', 'በአቅም የሚገዛ የመጀመሪያ ኪት', 'Meeshaa jalqabaa baasii xiqqaan', 'መጀመርታ ኪት ብውሑድ ዋጋ')),
L('les-c3', 11, tt('Bookings from Instagram and Telegram', 'ከኢንስታግራምና ከቴሌግራም ቀጠሮ', 'Beellama Instagram fi Telegram irraa', 'ቆጸራ ካብ ኢንስታግራምን ቴሌግራምን')),
]),
] }));
put('courses', 'crs-business', order({ ...base, slug: 'crs-business', categoryId: 'cat-fundamentals', instructorName: 'Meron Tesfaye', instructionLocale: 'am', coverTone: 'sand', status: 'DRAFT', publishedAt: null, updatedAt: '2026-09-20T08:00:00.000Z', prices: {},
translations: { en: { title: 'Building a makeup business', description: 'Pricing, bookings and social media for freelance artists.' }, am: { title: 'የሜካፕ ሥራ መገንባት', description: 'ለግል ባለሙያዎች ዋጋ አወጣጥ፣ ቀጠሮና ማኅበራዊ ሚዲያ።' } },
chapters: [ch('ch-x1', { en: 'Pricing your work' }, {}, [L('les-x1', 12, { en: { title: 'What to charge in Addis' } }, { isPublished: false, videoStatus: 'NONE' })])] }));
put('courses', 'crs-test', order({ ...base, slug: 'payment-test', categoryId: 'cat-fundamentals', instructorName: 'Staff', instructionLocale: 'en', coverTone: 'ink', status: 'PUBLISHED', isTest: true, publishedAt: '2026-02-01T08:00:00.000Z', updatedAt: '2026-02-01T08:00:00.000Z', prices: { ETB: 100 },
translations: { en: { title: 'Payment test (staff only)', description: 'Real-money payment check at the provider minimum. Hidden from students and stats (L7).' } },
chapters: [ch('ch-t1', { en: 'Test' }, {}, [L('les-t1', 1, { en: { title: 'Test lesson' } })])] }));
// ---- fictional sample students so the demo has realistic data
const people = [
['Abebech G.', '+251911000101', '', 'ET', 'Addis Ababa', 'am', '2026-01-14'],
['Tigist M.', '+251911000102', 'tigist@example.com', 'ET', 'Hawassa', 'am', '2026-02-03'],
['Lensa D.', '+251911000103', '', 'ET', 'Adama', 'om', '2026-03-22'],
['Mahlet K.', '', 'mahlet@example.com', 'US', 'Washington DC', 'en', '2026-04-09'],
['Saba H.', '+251911000105', '', 'ET', 'Mekelle', 'ti', '2026-05-18'],
['Rahel T.', '+251911000106', 'rahel@example.com', 'ET', 'Bahir Dar', 'am', '2026-06-30'],
['Bethlehem A.', '+251911000107', '', 'ET', 'Addis Ababa', 'am', '2026-08-11'],
['Hiwot Y.', '', 'hiwot@example.com', 'SE', 'Stockholm', 'en', '2026-09-04'],
];
const price = { 'crs-foundations': 120000, 'crs-bridal': 250000, 'crs-skin': 80000, 'crs-test': 100 };
const t = (d, h = 9) => new Date(`${d}T${String(h).padStart(2, '0')}:00:00.000Z`).toISOString();
const addDays = (d, n) => new Date(Date.parse(d + 'T00:00:00Z') + n * 864e5).toISOString().slice(0, 10);
const plan = [
[['crs-foundations', 'PAID', 'TELEBIRR'], ['crs-bridal', 'PAID', 'TELEBIRR']],
[['crs-foundations', 'PAID', 'CBE_BIRR'], ['crs-skin', 'PAID', 'TELEBIRR']],
[['crs-foundations', 'PAID', 'TELEBIRR']],
[['crs-skin', 'REFUNDED', 'CBE_BIRR'], ['crs-foundations', 'FAILED', 'TELEBIRR']],
[['crs-foundations', 'PAID', 'TELEBIRR'], ['crs-bridal', 'FLAGGED', 'TELEBIRR']],
[['crs-skin', 'PAID', 'CBE_BIRR']],
[['crs-foundations', 'PENDING', 'TELEBIRR']],
[],
];
const lessonsOf = { 'crs-foundations': ['les-f1', 'les-f2', 'les-f3', 'les-f4', 'les-f5', 'les-f6', 'les-f7'], 'crs-bridal': ['les-b1', 'les-b2', 'les-b3', 'les-b4'], 'crs-skin': ['les-s1', 'les-s2'] };
people.forEach(([name, phone, email, country, city, locale, joined], i) => {
const id = `sample-${i + 1}`;
const s = { name, phone, email, country, city, locale, status: i === 5 ? 'DEACTIVATED' : 'ACTIVE', createdAt: t(joined), updatedAt: t(joined), lastActiveAt: t(addDays(joined, 20)), isSample: true, enrollments: {}, orders: {}, progress: {}, issues: {}, watchSec: {} };
plan[i].forEach(([courseId, st, method], k) => {
const day = addDays(joined, 1 + k * 15); const oid = `ord-s${i + 1}-${k + 1}`; const created = t(day, 10);
const o = { id: oid, courseId, currency: 'ETB', amountMinor: price[courseId], provider: 'ARIFPAY', method, status: st === 'FLAGGED' ? 'PENDING' : st, idempotencyKey: 'seed-' + oid, failureReason: st === 'FAILED' ? 'Insufficient balance (simulated)' : null, flaggedReason: st === 'FLAGGED' ? 'Amount mismatch: got ETB 250, expected ETB 2,500' : null, paidAt: st === 'PAID' || st === 'REFUNDED' ? t(day, 11) : null, expiresAt: st === 'PENDING' || st === 'FLAGGED' ? '2027-01-01T00:00:00.000Z' : t(day, 11), createdAt: created, updatedAt: created,
events: [{ type: 'order.created', at: created }, ...(st === 'PAID' || st === 'REFUNDED' ? [{ type: 'provider.paid', at: t(day, 11), amountMinor: price[courseId], currency: 'ETB' }] : []), ...(st === 'REFUNDED' ? [{ type: 'admin.refunded', at: t(addDays(day, 3)) }] : []), ...(st === 'FAILED' ? [{ type: 'provider.failed', at: t(day, 11) }] : []), ...(st === 'FLAGGED' ? [{ type: 'provider.paid', at: t(day, 11), amountMinor: 25000, currency: 'ETB' }] : [])] };
s.orders[oid] = o;
if (st === 'PAID') {
s.enrollments[courseId] = { courseId, source: 'PURCHASE', orderId: oid, createdAt: t(day, 11), revokedAt: null };
const ls = lessonsOf[courseId]; const done = Math.max(1, Math.round(ls.length * [1, .6, .3, .5, .8, .2, .4, 0][i]));
ls.slice(0, done).forEach((lid, j) => { const at = t(addDays(day, 2 + j * 3), 18); s.progress[lid] = { courseId, positionSec: 600, maxPositionSec: 600, completedAt: at, updatedAt: at }; });
const ym = day.slice(0, 7); s.watchSec[ym] = (s.watchSec[ym] ?? 0) + done * 620;
}
if (st === 'REFUNDED') s.enrollments[courseId] = { courseId, source: 'PURCHASE', orderId: oid, createdAt: t(day, 11), revokedAt: t(addDays(day, 3)) };
});
// sample assessment attempts (sample-2 is also the demo visitor's starting point: one failed attempt to retake)
const res = (courseId, score, total, passPct, attempts, day) => ({ courseId, score, total, bestPct: Math.round((score / total) * 100), passed: score / total * 100 >= passPct, attempts, answers: [], submittedAt: t(day, 19) });
s.assessments = [
{ 'as-f1': res('crs-foundations', 3, 3, 70, 1, '2026-01-20'), 'as-f2': res('crs-foundations', 4, 4, 70, 2, '2026-02-10') },
{ 'as-f1': res('crs-foundations', 2, 3, 70, 1, '2026-02-12'), 'as-s1': res('crs-skin', 3, 3, 70, 1, '2026-03-10') },
{}, {},
{ 'as-f1': res('crs-foundations', 3, 3, 70, 2, '2026-05-02') },
{}, {}, {},
][i] ?? {};
if (i === 1) s.issues['iss-s2'] = { id: 'iss-s2', type: 'VIDEO', subject: 'Lesson stops on mobile data', description: 'The blending lesson stops every minute on Ethio Telecom 4G in Hawassa.', status: 'OPEN', createdAt: t('2026-09-25', 14), updatedAt: t('2026-09-25', 14) };
if (i === 4) s.issues['iss-s5'] = { id: 'iss-s5', type: 'PAYMENT', subject: 'Paid but bridal course is locked', description: 'Telebirr shows ETB 250 taken but the course did not open.', status: 'IN_PROGRESS', createdAt: t('2026-06-05', 9), updatedAt: t('2026-06-06', 9) };
if (i === 0) s.issues['iss-s1'] = { id: 'iss-s1', type: 'ACCOUNT', subject: 'Change my phone number', description: 'I have a new Safaricom number.', status: 'RESOLVED', resolutionNote: 'Updated on your profile.', createdAt: t('2026-03-02', 9), updatedAt: t('2026-03-03', 9) };
put('students', id, s);
});
// Enrolled count per course, from the students above. ponytail: computed once at seed time; the backend
// keeps this aggregate live (see design/issues/enrollment-counts.md), students can't read each other's docs.
const enrolled = {};
for (const f of fs.readdirSync(path.join(out, 'students'))) for (const k of Object.keys(JSON.parse(fs.readFileSync(path.join(out, 'students', f), 'utf8')).enrollments ?? {})) enrolled[k] = (enrolled[k] ?? 0) + 1;
for (const f of fs.readdirSync(path.join(out, 'courses'))) { const file = path.join(out, 'courses', f), c = JSON.parse(fs.readFileSync(file, 'utf8')); fs.writeFileSync(file, JSON.stringify({ ...c, enrolledCount: enrolled[c.id] ?? 0 }, null, 1)); }
console.log('seed written to', out);