29 lines
610 B
TypeScript
29 lines
610 B
TypeScript
import { Entity, PrimaryColumn, Column, CreateDateColumn, Index } from 'typeorm';
|
|
|
|
export type GroupEventType =
|
|
| 'GROUP_CREATED'
|
|
| 'GROUP_RENAMED'
|
|
| 'GROUP_INVITE_ROTATED'
|
|
| 'GROUP_DELETED';
|
|
|
|
@Entity('group_events')
|
|
@Index(['groupId', 'createdAt'])
|
|
export class GroupEventEntity {
|
|
@PrimaryColumn()
|
|
id: string; // ULID oder UUID, kommt vom Server oder Client
|
|
|
|
@Column()
|
|
groupId: string;
|
|
|
|
@Column({ type: 'varchar', length: 64 })
|
|
type: GroupEventType;
|
|
|
|
@Column({ type: 'json' })
|
|
payload: any;
|
|
|
|
@Column({ nullable: true })
|
|
actorId?: string;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
} |