Files

150 lines
3.8 KiB
TypeScript

/** Stateful moderation fixtures for mock E2E. */
export type MockReport = {
id: string;
reporter_id: string;
target_type: 'calendar' | 'event' | 'review';
target_id: string;
reason: string;
status: 'pending' | 'reviewed' | 'dismissed';
created_at: string;
resolved_at: string | null;
resolved_by: string | null;
};
export type MockTicket = {
id: string;
reporter_id: string;
error_hash: string;
error_message: string;
stacktrace: string;
context: string;
count: number;
first_seen: string;
last_seen: string;
status: 'open' | 'in_progress' | 'resolved' | 'closed';
assigned_to: string | null;
resolution_note: string | null;
};
export type MockReview = {
id: string;
user_id: string;
target_type: 'calendar' | 'event';
target_id: string;
rating: number;
comment: string;
status: 'visible' | 'hidden' | 'deleted';
reason: string | null;
likes: number;
dislikes: number;
created_at: string;
updated_at: string;
};
const now = '2026-07-14T12:00:00Z';
export function createModerationSeed() {
const reports: MockReport[] = [
{
id: 'rpt-pending-1',
reporter_id: 'user-1',
target_type: 'event',
target_id: 'evt-1',
reason: 'Spam content',
status: 'pending',
created_at: now,
resolved_at: null,
resolved_by: null,
},
{
id: 'rpt-pending-2',
reporter_id: 'user-2',
target_type: 'calendar',
target_id: 'cal-1',
reason: 'Offensive title',
status: 'pending',
created_at: now,
resolved_at: null,
resolved_by: null,
},
{
id: 'rpt-done-1',
reporter_id: 'user-1',
target_type: 'review',
target_id: 'rev-1',
reason: 'Duplicate',
status: 'reviewed',
created_at: now,
resolved_at: now,
resolved_by: 'admin-e2e-1',
},
];
const tickets: MockTicket[] = [
{
id: 'tkt-open-1',
reporter_id: 'user-1',
error_hash: 'hash-open-1',
error_message: 'NullPointer in join',
stacktrace: 'at joiner:42',
context: '{}',
count: 3,
first_seen: now,
last_seen: now,
status: 'open',
assigned_to: null,
resolution_note: null,
},
{
id: 'tkt-prog-1',
reporter_id: 'user-2',
error_hash: 'hash-prog-1',
error_message: 'Timeout on sync',
stacktrace: 'at sync:10',
context: '{}',
count: 1,
first_seen: now,
last_seen: now,
status: 'in_progress',
assigned_to: 'admin-e2e-1',
resolution_note: null,
},
];
const reviews: MockReview[] = [
{
id: 'rev-vis-1',
user_id: 'user-1',
target_type: 'event',
target_id: 'evt-1',
rating: 5,
comment: 'Great event',
status: 'visible',
reason: null,
likes: 2,
dislikes: 0,
created_at: now,
updated_at: now,
},
{
id: 'rev-vis-2',
user_id: 'user-2',
target_type: 'calendar',
target_id: 'cal-1',
rating: 1,
comment: 'Bad calendar',
status: 'visible',
reason: null,
likes: 0,
dislikes: 1,
created_at: now,
updated_at: now,
},
];
return { reports, tickets, reviews };
}
export type ModerationState = ReturnType<typeof createModerationSeed>;