UNPKG

@wearesage/schema

Version:

A flexible schema definition and validation system for TypeScript with multi-database support

31 lines (24 loc) 930 B
import { Entity, Property, Id, ManyToOne, Index, Timestamp, Auth } from '../core/decorators'; import { Space } from './Space'; @Entity() @Auth({ permissions: ['user'] }) // Users can see events in spaces they have access to export class Event { @Id() id!: string; // Space this event belongs to @ManyToOne({ target: () => Space, inverse: 'events' }) space!: Space; @Property({ required: true }) @Index() eventType!: 'file_change' | 'build_started' | 'build_succeeded' | 'build_failed' | 'lint_error' | 'typescript_error' | 'runtime_error' | 'test_result' | 'deployment' | 'user_action' | 'space_update' | 'custom'; @Property({ required: true }) eventData!: Record<string, any>; @Property() severity?: 'info' | 'warning' | 'error'; @Property() source?: string; // Source of the event (file path, service name, etc.) @Timestamp({ onCreate: true }) timestamp!: Date; }