forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepository.entity.ts
More file actions
66 lines (50 loc) · 1.25 KB
/
Copy pathrepository.entity.ts
File metadata and controls
66 lines (50 loc) · 1.25 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
import {
Column,
CreateDateColumn,
Entity,
Index,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { User } from './user.entity';
import { Issue } from './issue.entity';
@Entity('repositories')
@Index(['owner', 'name'], { unique: true })
export class Repository {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ unique: true })
githubRepoId: string;
@Column()
owner: string;
@Column()
name: string;
@Column()
fullName: string;
@Column({ nullable: true, type: 'text' })
description: string | null;
@Column({ default: 'main' })
defaultBranch: string;
@Column({ default: false })
private: boolean;
@Column({ type: 'varchar', nullable: true })
primaryLanguage: string | null;
@Column({ default: 0 })
stargazersCount: number;
@ManyToOne(() => User, { nullable: true, onDelete: 'SET NULL' })
@JoinColumn()
maintainer: User | null;
@Column({ type: 'varchar', nullable: true })
maintainerId: string | null;
@OneToMany(() => Issue, (issue) => issue.repository)
issues: Issue[];
@Column({ type: 'timestamptz', nullable: true })
lastSyncedAt: Date | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}