forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.entity.ts
More file actions
52 lines (42 loc) · 1.28 KB
/
Copy pathuser.entity.ts
File metadata and controls
52 lines (42 loc) · 1.28 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
import {
Column,
CreateDateColumn,
Entity,
OneToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { UserRole } from '../enums';
import { GithubAccount } from './github-account.entity';
@Entity('users')
export class User {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'varchar', unique: true, nullable: true })
email: string | null;
@Column({ unique: true })
username: string;
@Column({ type: 'varchar', nullable: true })
displayName: string | null;
@Column({ type: 'varchar', nullable: true })
avatarUrl: string | null;
@Column({ type: 'simple-array', default: UserRole.CONTRIBUTOR })
roles: UserRole[];
/**
* Stellar public key the user has linked to receive payouts / fund escrow.
* Custody of the corresponding secret key always remains with the user
* (their wallet, e.g. Freighter) — MergeFi never stores private keys for
* end users, only for the platform treasury signer (see TREASURY_SECRET).
*/
@Column({ type: 'varchar', nullable: true })
stellarAddress: string | null;
@OneToOne(() => GithubAccount, (account) => account.user, {
cascade: true,
nullable: true,
})
githubAccount: GithubAccount | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}