forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport-template.entity.ts
More file actions
105 lines (86 loc) · 2.5 KB
/
Copy pathexport-template.entity.ts
File metadata and controls
105 lines (86 loc) · 2.5 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
JoinColumn,
} from "typeorm";
import { User } from "@/entities/user.entity";
import { ExportFormat, ReportType } from "./export-job.entity";
export interface ExportTemplateFilters {
startDate?: string;
endDate?: string;
categories?: string[];
participants?: string[];
minAmount?: number;
maxAmount?: number;
currency?: string;
paidByMe?: boolean;
owedToMe?: boolean;
settled?: boolean;
}
export interface ExportTemplateSettings {
includeTaxFields: boolean;
includeReceipts: boolean;
groupByCategory: boolean;
groupByMonth: boolean;
includeChart: boolean;
includeSummary: boolean;
logoUrl?: string;
companyName?: string;
taxId?: string;
}
@Entity("export_templates")
export class ExportTemplate {
@PrimaryGeneratedColumn("uuid")
id!: string;
@Column({ name: "user_id" })
userId!: string;
@ManyToOne(() => User)
@JoinColumn({ name: "user_id" })
user!: User;
@Column()
name!: string;
// nullable: true → TypeScript type must include null
@Column({ type: "text", nullable: true })
description!: string | null;
@Column({
type: "enum",
enum: ExportFormat,
default: ExportFormat.CSV,
})
format!: ExportFormat;
@Column({
type: "enum",
enum: ReportType,
default: ReportType.CUSTOM,
})
reportType!: ReportType;
@Column({ type: "jsonb" })
filters!: ExportTemplateFilters;
// nullable: true → TypeScript type must include null
@Column({ type: "jsonb", nullable: true })
settings!: ExportTemplateSettings | null;
@Column({ name: "is_default", default: false })
isDefault!: boolean;
@Column({ name: "is_scheduled", default: false })
isScheduled!: boolean;
// nullable: true → TypeScript type must include null
@Column({ name: "schedule_cron", nullable: true })
scheduleCron!: string | null;
// nullable: true → TypeScript type must include null
@Column({ name: "email_recipients", type: "jsonb", nullable: true })
emailRecipients!: string[] | null;
// nullable: true → TypeScript type must include null
@Column({ name: "email_subject_template", nullable: true })
emailSubjectTemplate!: string | null;
// nullable: true → TypeScript type must include null
@Column({ name: "email_body_template", type: "text", nullable: true })
emailBodyTemplate!: string | null;
@CreateDateColumn({ name: "created_at" })
createdAt!: Date;
@UpdateDateColumn({ name: "updated_at" })
updatedAt!: Date;
}