summaryrefslogtreecommitdiff
path: root/src/models/entities/log.ts
blob: 182a9fbed82acdc43f8cc49b493923848f3ab58b (plain)
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
45
46
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id';

@Entity()
export class Log {
	@PrimaryColumn(id())
	public id: string;

	@Index()
	@Column('timestamp with time zone', {
		comment: 'The created date of the Log.'
	})
	public createdAt: Date;

	@Index()
	@Column('varchar', {
		length: 64, array: true, default: '{}'
	})
	public domain: string[];

	@Index()
	@Column('enum', {
		enum: ['error', 'warning', 'info', 'success', 'debug']
	})
	public level: string;

	@Column('varchar', {
		length: 8
	})
	public worker: string;

	@Column('varchar', {
		length: 128
	})
	public machine: string;

	@Column('varchar', {
		length: 2048
	})
	public message: string;

	@Column('jsonb', {
		default: {}
	})
	public data: Record<string, any>;
}