Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { |
||
13 | |||
14 | @Entity() |
||
15 | export class UserSavingsRecord { |
||
16 | @PrimaryGeneratedColumn('uuid') |
||
17 | private id: string; |
||
18 | |||
19 | @Column({ type: 'integer', nullable: false, comment: 'Stored in base 100' }) |
||
20 | private amount: number; |
||
21 | |||
22 | @Column('enum', { enum: SavingsRecordType, nullable: false }) |
||
23 | private type: SavingsRecordType; |
||
24 | |||
25 | @ManyToOne(type => User, { nullable: false, onDelete: 'CASCADE' }) |
||
26 | private user: User; |
||
27 | |||
28 | @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) |
||
29 | private createdAt: Date; |
||
30 | |||
31 | constructor( |
||
32 | amount: number, |
||
33 | type: SavingsRecordType, |
||
34 | user: User, |
||
35 | ) { |
||
36 | this.amount = amount; |
||
37 | this.type = type; |
||
38 | this.user = user; |
||
39 | } |
||
40 | |||
41 | public getId(): string { |
||
42 | return this.id; |
||
43 | } |
||
44 | |||
45 | public getAmount(): number { |
||
46 | return this.amount; |
||
47 | } |
||
48 | |||
49 | public getType(): SavingsRecordType { |
||
50 | return this.type; |
||
51 | } |
||
52 | |||
53 | public getUser(): User { |
||
54 | return this.user; |
||
55 | } |
||
57 |