forked from stellara-network/Stellara_Contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudit.entity.ts
More file actions
40 lines (29 loc) · 866 Bytes
/
audit.entity.ts
File metadata and controls
40 lines (29 loc) · 866 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
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, Index } from 'typeorm';
@Entity('audit_logs')
export class AuditLog {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ nullable: true })
@Index()
userId: string;
@Column()
@Index()
action: string; // e.g., 'CREATE_USER', 'LOGIN', 'TRANSFER_FUNDS'
@Column({ nullable: true })
resource: string; // e.g., 'User', 'Transaction'
@Column({ nullable: true })
resourceId: string;
@Column('jsonb', { nullable: true })
details: Record<string, any>;
@Column({ nullable: true })
ipAddress: string;
@Column({ nullable: true })
userAgent: string;
@Column({ default: 'SUCCESS' })
status: 'SUCCESS' | 'FAILURE' | 'WARNING';
@Column({ default: 'low' })
severity: 'low' | 'medium' | 'high' | 'critical';
@CreateDateColumn()
@Index()
createdAt: Date;
}