Yimaru-BackEnd/db/data/001_initial_seed_data.sql

474 lines
12 KiB
SQL

CREATE EXTENSION IF NOT EXISTS pgcrypto;
-- ======================================================
-- Customer/Learner Users (login via /api/v1/auth/customer-login)
-- Credentials: email + password@123
-- ======================================================
INSERT INTO users (
id,
first_name,
last_name,
gender,
birth_day,
email,
phone_number,
role,
password,
age_group,
education_level,
country,
region,
knowledge_level,
nick_name,
occupation,
learning_goal,
language_goal,
language_challange,
favourite_topic,
initial_assessment_completed,
email_verified,
phone_verified,
status,
last_login,
profile_completed,
profile_picture_url,
preferred_language,
created_at,
updated_at
)
VALUES
(
10,
'Demo',
'Student',
'Male',
'2000-01-01',
'student@yimaru.com',
NULL,
'STUDENT',
crypt('password@123', gen_salt('bf'))::bytea,
'25_34',
'Bachelor',
'Ethiopia',
'Addis Ababa',
'BEGINNER',
'Demo',
'Student',
'Learn programming',
'English',
'Grammar',
'Technology',
FALSE,
TRUE,
FALSE,
'ACTIVE',
NULL,
FALSE,
NULL,
'en',
CURRENT_TIMESTAMP,
NULL
),
(
11,
'Abebe',
'Kebede',
'Male',
'1995-01-01',
'abebe@yimaru.com',
'0911001100',
'STUDENT',
crypt('password@123', gen_salt('bf'))::bytea,
'35_44',
'Master',
'Ethiopia',
'Addis Ababa',
'INTERMEDIATE',
'Abebe',
'Teacher',
'Improve English',
'English',
'Writing',
'Education',
TRUE,
TRUE,
TRUE,
'ACTIVE',
NULL,
TRUE,
NULL,
'en',
CURRENT_TIMESTAMP,
NULL
),
(
12,
'Sara',
'Tadesse',
'Female',
'1998-01-01',
'sara@yimaru.com',
'0911223344',
'STUDENT',
crypt('password@123', gen_salt('bf'))::bytea,
'55_PLUS',
'Diploma',
'Ethiopia',
'Addis Ababa',
'BEGINNER',
'Sara',
'Nurse',
'Learn conversational English',
'English',
'Conversation',
'Healthcare',
TRUE,
TRUE,
TRUE,
'ACTIVE',
NULL,
TRUE,
NULL,
'en',
CURRENT_TIMESTAMP,
NULL
)
ON CONFLICT (id) DO NOTHING;
-- Ensure seeded admin has full panel permissions in legacy team_members.permissions JSON.
-- RBAC permissions are managed separately, but this keeps seed behavior consistent.
UPDATE team_members
SET permissions = '["*"]'::jsonb
WHERE id = 2 OR email = 'admin@yimaru.com';
-- ======================================================
-- Global Settings (LMS)
-- ======================================================
INSERT INTO global_settings (key, value)
VALUES
('platform_name', 'Yimaru LMS'),
('default_language', 'en'),
('allow_self_signup', 'true'),
('otp_expiry_minutes', '5'),
('certificate_enabled', 'true'),
('max_courses_per_instructor', '50')
ON CONFLICT (key) DO NOTHING;
-- ======================================================
-- ======================================================
-- Questions - Level A2 (EASY)
-- ======================================================
INSERT INTO questions (id, question_text, question_type, difficulty_level, points, status)
VALUES
(1, 'What would you say to greet someone before lunchtime?', 'MCQ', 'EASY', 1, 'PUBLISHED'),
(2, 'Which question is correct to ask about your routine?', 'MCQ', 'EASY', 1, 'PUBLISHED'),
(3, 'She ___ like pizza.', 'MCQ', 'EASY', 1, 'PUBLISHED'),
(4, 'I usually go to school and start class ____ eight o''clock.', 'MCQ', 'EASY', 1, 'PUBLISHED'),
(5, 'Someone says, "Here is the book you asked for." What is the best response?', 'MCQ', 'EASY', 1, 'PUBLISHED')
ON CONFLICT (id) DO NOTHING;
INSERT INTO question_options (question_id, option_text, option_order, is_correct)
VALUES
-- Q1
(1, 'Good morning.', 1, TRUE),
(1, 'How do you do?', 2, FALSE),
(1, 'Good afternoon.', 3, FALSE),
(1, 'Goodbye.', 4, FALSE),
-- Q2
(2, 'What time you wake up?', 1, FALSE),
(2, 'What time do you wake up?', 2, TRUE),
(2, 'What time are you wake up?', 3, FALSE),
(2, 'What time waking you?', 4, FALSE),
-- Q3
(3, 'do not', 1, FALSE),
(3, 'not', 2, FALSE),
(3, 'is not', 3, FALSE),
(3, 'does not', 4, TRUE),
-- Q4
(4, 'about', 1, FALSE),
(4, 'on', 2, FALSE),
(4, 'at', 3, TRUE),
(4, 'in', 4, FALSE),
-- Q5
(5, 'Never mind.', 1, FALSE),
(5, 'Really?', 2, FALSE),
(5, 'What a pity!', 3, FALSE),
(5, 'Thank you.', 4, TRUE);
-- ======================================================
-- Questions - Level B1 (MEDIUM)
-- ======================================================
INSERT INTO questions (id, question_text, question_type, difficulty_level, points, status)
VALUES
(6, 'How do you introduce your friend to another person?', 'MCQ', 'MEDIUM', 1, 'PUBLISHED'),
(7, 'How would you ask for the price of an item in a shop?', 'MCQ', 'MEDIUM', 1, 'PUBLISHED'),
(8, 'Which sentence correctly gives simple directions?', 'MCQ', 'MEDIUM', 1, 'PUBLISHED'),
(9, 'The watch shows 10:50, but the real time is 10:45. What can you say?', 'MCQ', 'MEDIUM', 1, 'PUBLISHED'),
(10, 'Which instruction is correct when giving directions?', 'MCQ', 'MEDIUM', 1, 'PUBLISHED')
ON CONFLICT (id) DO NOTHING;
INSERT INTO question_options (question_id, option_text, option_order, is_correct)
VALUES
-- Q6
(6, 'Hello, my name is Samson.', 1, FALSE),
(6, 'Good morning. Nice to meet you.', 2, FALSE),
(6, 'Let me introduce myself to my friend.', 3, FALSE),
(6, 'This is my friend, Samson.', 4, TRUE),
-- Q7
(7, 'How many are these?', 1, FALSE),
(7, 'What is this?', 2, FALSE),
(7, 'How much is this?', 3, TRUE),
(7, 'Where is the nearest shop?', 4, FALSE),
-- Q8
(8, 'Thank you very much for asking.', 1, FALSE),
(8, 'Turn left and walk two blocks.', 2, TRUE),
(8, 'Why don''t you eat out.', 3, FALSE),
(8, 'Take the bus to the park.', 4, FALSE),
-- Q9
(9, 'My watch is slow.', 1, TRUE),
(9, 'My watch is late.', 2, FALSE),
(9, 'My watch is fast.', 3, FALSE),
(9, 'My watch is early.', 4, FALSE),
-- Q10
(10, 'Turn left.', 1, TRUE),
(10, 'Turn on left.', 2, FALSE),
(10, 'Turn left side.', 3, FALSE),
(10, 'Turn to straight.', 4, FALSE);
-- ======================================================
-- Questions - Level B2 (HARD)
-- ======================================================
INSERT INTO questions (id, question_text, question_type, difficulty_level, points, status)
VALUES
(11, 'What is the most polite way to ask to speak to someone on the phone?', 'MCQ', 'HARD', 1, 'PUBLISHED'),
(12, 'How do you correctly state the age of a person who is 30 years old?', 'MCQ', 'HARD', 1, 'PUBLISHED'),
(13, 'When asking for help with a new Yimaru App feature, which option is most appropriate?', 'MCQ', 'HARD', 1, 'PUBLISHED'),
(14, 'Which word has the unvoiced "th" sound?', 'MCQ', 'HARD', 1, 'PUBLISHED'),
(15, 'Which sentence sounds like a warning, not friendly advice?', 'MCQ', 'HARD', 1, 'PUBLISHED'),
(16, 'What does this sentence mean? "I will definitely be there on time."', 'MCQ', 'HARD', 1, 'PUBLISHED')
ON CONFLICT (id) DO NOTHING;
INSERT INTO question_options (question_id, option_text, option_order, is_correct)
VALUES
-- Q11
(11, 'May I speak to Mr. Tesfaye, please?', 1, TRUE),
(11, 'Can I talk to Mr. Tesfaye?', 2, FALSE),
(11, 'Is Mr. Tesfaye there?', 3, FALSE),
(11, 'I want to talk to Mr. Tesfaye.', 4, FALSE),
-- Q12
(12, 'He is thirty years.', 1, FALSE),
(12, 'He has thirty years.', 2, FALSE),
(12, 'He has thirty years old.', 3, FALSE),
(12, 'He is thirty.', 4, TRUE),
-- Q13
(13, 'Are you familiar with how this feature works?', 1, FALSE),
(13, 'Could you walk me through how this feature works?', 2, TRUE),
(13, 'I believe I understand how this feature works.', 3, FALSE),
(13, 'I''ve tried similar features before.', 4, FALSE),
-- Q14
(14, 'That', 1, FALSE),
(14, 'They', 2, FALSE),
(14, 'These', 3, FALSE),
(14, 'Three', 4, TRUE),
-- Q15
(15, 'You might want to plan your time better.', 1, FALSE),
(15, 'If I were you, I''d start earlier.', 2, FALSE),
(15, 'You''d better meet the deadline this time.', 3, TRUE),
(15, 'Why don''t you try using a planner?', 4, FALSE),
-- Q16
(16, 'The speaker is unsure about arriving.', 1, FALSE),
(16, 'The speaker is promising to arrive on time.', 2, TRUE),
(16, 'The speaker might arrive late.', 3, FALSE),
(16, 'The speaker has already arrived.', 4, FALSE);
-- ======================================================
-- Initial Assessment Question Set
-- ======================================================
INSERT INTO question_sets (id, title, description, set_type, owner_type, status)
VALUES
(1, 'Initial Assessment', 'Default initial assessment for new users', 'INITIAL_ASSESSMENT', 'STANDALONE', 'PUBLISHED')
ON CONFLICT (id) DO NOTHING;
INSERT INTO question_set_items (set_id, question_id, display_order)
VALUES
(1, 1, 1), (1, 2, 2), (1, 3, 3), (1, 4, 4), (1, 5, 5),
(1, 6, 6), (1, 7, 7), (1, 8, 8), (1, 9, 9), (1, 10, 10),
(1, 11, 11), (1, 12, 12), (1, 13, 13), (1, 14, 14), (1, 15, 15), (1, 16, 16)
ON CONFLICT (set_id, question_id) DO NOTHING;
-- ======================================================
-- Course Management seed data removed intentionally.
-- Course/category/sub-course/video/practice/question-set fixtures
-- are no longer seeded from this baseline script.
-- ======================================================
-- ======================================================
-- Team Members / Admin Panel Users (login via /api/v1/team/login)
-- Credentials: email + password@123
-- ======================================================
INSERT INTO team_members (
id,
first_name,
last_name,
email,
phone_number,
password,
team_role,
department,
job_title,
employment_type,
hire_date,
bio,
status,
email_verified,
permissions,
created_at
)
VALUES
(
2,
'Admin',
'User',
'admin@yimaru.com',
'0922001100',
crypt('password@123', gen_salt('bf'))::bytea,
'ADMIN',
'Operations',
'Operations Manager',
'full_time',
'2024-02-01',
'Administrative staff managing day-to-day operations.',
'active',
TRUE,
'[*]'::jsonb,
CURRENT_TIMESTAMP
),
(
3,
'Content',
'MANAGER',
'content@yimaru.com',
'0933001100',
crypt('password@123', gen_salt('bf'))::bytea,
'CONTENT_MANAGER',
'Content',
'Content Lead',
'full_time',
'2024-03-01',
'Manages all course content and curriculum.',
'active',
TRUE,
'["courses.manage", "courses.publish", "content.manage"]'::jsonb,
CURRENT_TIMESTAMP
),
(
4,
'Support',
'AGENT',
'support-team@yimaru.com',
'0944001100',
crypt('password@123', gen_salt('bf'))::bytea,
'SUPPORT_AGENT',
'Support',
'Customer Support Specialist',
'full_time',
'2024-03-15',
'Handles customer inquiries and support tickets.',
'active',
TRUE,
'["users.view", "tickets.manage", "support.manage"]'::jsonb,
CURRENT_TIMESTAMP
),
(
5,
'INSTRUCTOR',
'Demo',
'instructor@yimaru.com',
'0955001100',
crypt('password@123', gen_salt('bf'))::bytea,
'INSTRUCTOR',
'Education',
'Senior Instructor',
'full_time',
'2024-04-01',
'Creates and manages course materials.',
'active',
TRUE,
'["courses.create", "courses.edit", "students.view"]'::jsonb,
CURRENT_TIMESTAMP
),
(
6,
'FINANCE',
'Officer',
'finance@yimaru.com',
'0966001100',
crypt('password@123', gen_salt('bf'))::bytea,
'FINANCE',
'Finance',
'Finance Officer',
'full_time',
'2024-04-15',
'Manages payments, subscriptions, and financial reports.',
'active',
TRUE,
'["payments.manage", "subscriptions.manage", "reports.finance"]'::jsonb,
CURRENT_TIMESTAMP
),
(
7,
'HR',
'MANAGER',
'hr@yimaru.com',
'0977001100',
crypt('password@123', gen_salt('bf'))::bytea,
'HR',
'Human Resources',
'HR Manager',
'full_time',
'2024-05-01',
'Manages team members and HR operations.',
'active',
TRUE,
'["team.manage", "team.create", "team.delete"]'::jsonb,
CURRENT_TIMESTAMP
),
(
8,
'Data',
'Analyst',
'analyst@yimaru.com',
'0988001100',
crypt('password@123', gen_salt('bf'))::bytea,
'ANALYST',
'Analytics',
'Data Analyst',
'contract',
'2024-06-01',
'Generates reports and analyzes platform metrics.',
'active',
TRUE,
'["reports.view", "analytics.view", "users.view"]'::jsonb,
CURRENT_TIMESTAMP
)
ON CONFLICT (id) DO NOTHING;