150 lines
3.9 KiB
TypeScript
150 lines
3.9 KiB
TypeScript
/** Content/system seed data for mock E2E (users, calendars, events, …). */
|
|
|
|
const now = '2026-07-14T12:00:00Z';
|
|
|
|
export function createContentSeed() {
|
|
const users = [
|
|
{
|
|
id: 'user-e2e-1',
|
|
email: 'alice@eventhub.local',
|
|
nickname: 'Alice',
|
|
role: 'user',
|
|
status: 'active',
|
|
language: 'ru',
|
|
phone: null,
|
|
avatar_url: null,
|
|
last_login: now,
|
|
created_at: now,
|
|
updated_at: now,
|
|
},
|
|
{
|
|
id: 'user-e2e-2',
|
|
email: 'bob@eventhub.local',
|
|
nickname: 'Bob',
|
|
role: 'user',
|
|
status: 'frozen',
|
|
language: 'en',
|
|
phone: null,
|
|
avatar_url: null,
|
|
last_login: now,
|
|
created_at: now,
|
|
updated_at: now,
|
|
},
|
|
];
|
|
|
|
const calendars = [
|
|
{
|
|
id: 'cal-e2e-1',
|
|
title: 'E2E Calendar',
|
|
description: 'for tests',
|
|
type: 'personal',
|
|
category: 'sport',
|
|
owner_id: 'user-e2e-1',
|
|
status: 'active',
|
|
reason: null,
|
|
tags: [],
|
|
color: '#3366ff',
|
|
image_url: '',
|
|
rating_avg: 4.5,
|
|
rating_count: 2,
|
|
short_name: 'e2ecal',
|
|
confirmation: 'none',
|
|
settings: null,
|
|
created_at: now,
|
|
updated_at: now,
|
|
},
|
|
];
|
|
|
|
const events = [
|
|
{
|
|
id: 'evt-e2e-1',
|
|
calendar_id: 'cal-e2e-1',
|
|
title: 'E2E Workout',
|
|
description: 'test event',
|
|
event_type: 'single',
|
|
start_time: '2026-01-01T10:00:00Z',
|
|
duration: 60,
|
|
recurrence: null,
|
|
master_id: null,
|
|
is_instance: false,
|
|
specialist_id: null,
|
|
location: null,
|
|
tags: [],
|
|
capacity: 10,
|
|
online_link: null,
|
|
status: 'active',
|
|
reason: null,
|
|
rating_avg: 5,
|
|
rating_count: 1,
|
|
created_at: now,
|
|
updated_at: now,
|
|
},
|
|
];
|
|
|
|
const subscriptions = [
|
|
{
|
|
id: 'sub-e2e-1',
|
|
user_id: 'user-e2e-1',
|
|
plan: 'monthly',
|
|
status: 'active',
|
|
trial_used: false,
|
|
started_at: now,
|
|
expires_at: '2027-01-01T00:00:00Z',
|
|
auto_renew: true,
|
|
created_at: now,
|
|
updated_at: now,
|
|
},
|
|
];
|
|
|
|
const bannedWords = [
|
|
{ word: 'spamword', added_by: 'admin-e2e-1', added_at: now },
|
|
{ word: 'badword', added_by: 'admin-e2e-1', added_at: now },
|
|
];
|
|
|
|
const admins = [
|
|
{
|
|
id: 'admin-e2e-1',
|
|
email: 'e2e@eventhub.local',
|
|
nickname: 'E2E Admin',
|
|
role: 'superadmin',
|
|
language: 'ru',
|
|
phone: null,
|
|
avatar_url: null,
|
|
timezone: 'Europe/Moscow',
|
|
created_at: now,
|
|
updated_at: now,
|
|
last_login: now,
|
|
},
|
|
{
|
|
id: 'admin-e2e-2',
|
|
email: 'mod@eventhub.local',
|
|
nickname: 'Mod Admin',
|
|
role: 'moderator',
|
|
language: 'ru',
|
|
phone: null,
|
|
avatar_url: null,
|
|
timezone: 'UTC',
|
|
created_at: now,
|
|
updated_at: now,
|
|
last_login: now,
|
|
},
|
|
];
|
|
|
|
const audit = [
|
|
{
|
|
id: 'audit-e2e-1',
|
|
admin_id: 'admin-e2e-1',
|
|
action: 'user.update',
|
|
target_type: 'user',
|
|
target_id: 'user-e2e-1',
|
|
details: { status: 'frozen' },
|
|
ip: '127.0.0.1',
|
|
created_at: now,
|
|
},
|
|
];
|
|
|
|
return { users, calendars, events, subscriptions, bannedWords, admins, audit };
|
|
}
|
|
|
|
export type ContentState = ReturnType<typeof createContentSeed>;
|