CREATE EXTENSION IF NOT EXISTS pgcrypto; -- ====================================================== -- Customer/Learner Users (login via /api/v1/auth/customer-login) -- Credentials: email + password@123 -- OPEN_LEARNER demo user is seeded by migration 000061_open_learner_role (not here). -- ====================================================== 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; -- ====================================================== -- 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; -- Legacy team_members row may pre-exist; align admin permissions with seed expectations. UPDATE team_members SET permissions = '["*"]'::jsonb WHERE id = 2 OR email = 'admin@yimaru.com'; -- ====================================================== -- RBAC safety seed: ensure ADMIN has permission grants -- NOTE: API authorization uses RBAC role_permissions, not -- team_members.permissions JSON. -- ====================================================== INSERT INTO role_permissions (role_id, permission_id) SELECT r.id, p.id FROM roles r CROSS JOIN permissions p WHERE r.name = 'ADMIN' ON CONFLICT (role_id, permission_id) DO NOTHING;