forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity.entity.ts
More file actions
44 lines (36 loc) · 1002 Bytes
/
Copy pathactivity.entity.ts
File metadata and controls
44 lines (36 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, Index } from 'typeorm';
export enum ActivityType {
SPLIT_CREATED = 'split_created',
PARTICIPANT_ADDED = 'participant_added',
PAYMENT_MADE = 'payment_made',
PAYMENT_RECEIVED = 'payment_received',
SPLIT_COMPLETED = 'split_completed',
REMINDER_SENT = 'reminder_sent',
SPLIT_EDITED = 'split_edited',
}
@Entity('activities')
@Index(['userId', 'createdAt'])
@Index(['userId', 'activityType'])
@Index(['userId', 'isRead'])
export class Activity {
@PrimaryGeneratedColumn('uuid')
id!: string;
@Column({ type: 'varchar' })
@Index()
userId!: string;
@Column({
type: 'enum',
enum: ActivityType,
})
@Index()
activityType!: ActivityType;
@Column({ type: 'uuid', nullable: true })
@Index()
splitId?: string;
@Column({ type: 'jsonb', default: {} })
metadata!: Record<string, any>;
@Column({ type: 'boolean', default: false })
isRead!: boolean;
@CreateDateColumn()
createdAt!: Date;
}