forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaintenance-pool.entity.ts
More file actions
69 lines (55 loc) · 1.67 KB
/
Copy pathmaintenance-pool.entity.ts
File metadata and controls
69 lines (55 loc) · 1.67 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
import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
OneToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { Repository } from './repository.entity';
import { User } from './user.entity';
import { Escrow } from './escrow.entity';
import { AssetType, MaintenancePoolStatus } from '../enums';
@Entity('maintenance_pools')
export class MaintenancePool {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
@ManyToOne(() => Repository, { onDelete: 'CASCADE', nullable: true })
@JoinColumn()
repository: Repository | null;
@Column({ type: 'varchar', nullable: true })
repositoryId: string | null;
@ManyToOne(() => User, { onDelete: 'SET NULL', nullable: true })
@JoinColumn()
createdBy: User | null;
@Column({ type: 'varchar', nullable: true })
createdById: string | null;
@Column({ type: 'decimal', precision: 20, scale: 7, default: 0 })
monthlyDeposit: string;
/** Current spendable balance held in the pool's escrow contract. */
@Column({ type: 'decimal', precision: 20, scale: 7, default: 0 })
balance: string;
@Column({ type: 'enum', enum: AssetType, default: AssetType.USDC })
asset: AssetType;
@Column({
type: 'enum',
enum: MaintenancePoolStatus,
default: MaintenancePoolStatus.ACTIVE,
})
status: MaintenancePoolStatus;
@OneToOne(() => Escrow, (escrow) => escrow.maintenancePool, {
nullable: true,
})
escrow: Escrow | null;
/** Denormalized copy of escrow.id, set whenever `escrow` is assigned. */
@Column({ type: 'varchar', nullable: true })
escrowId: string | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}