forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissue.entity.ts
More file actions
90 lines (71 loc) · 2.19 KB
/
Copy pathissue.entity.ts
File metadata and controls
90 lines (71 loc) · 2.19 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
import {
Column,
CreateDateColumn,
Entity,
Index,
JoinColumn,
ManyToOne,
OneToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { Repository } from './repository.entity';
import { Milestone } from './milestone.entity';
import { Bounty } from './bounty.entity';
@Entity('issues')
@Index(['repositoryId', 'number'], { unique: true })
export class Issue {
@PrimaryGeneratedColumn('uuid')
id: string;
@ManyToOne(() => Repository, (repo) => repo.issues, { onDelete: 'CASCADE' })
@JoinColumn()
repository: Repository;
@Column()
repositoryId: string;
@Column({ unique: true })
githubIssueId: string;
@Column()
number: number;
@Column()
title: string;
@Column({ type: 'text', nullable: true })
body: string | null;
@Column({ default: 'open' })
state: 'open' | 'closed';
@Column({ type: 'simple-array', default: '' })
labels: string[];
@Column()
githubUrl: string;
@Column({ type: 'varchar', nullable: true })
authorLogin: string | null;
/** True for maintenance-type work (dep bumps, docs, cleanup) eligible for the pool. */
@Column({ default: false })
isMaintenanceType: boolean;
@ManyToOne(() => Milestone, (milestone) => milestone.issues, {
nullable: true,
onDelete: 'SET NULL',
})
@JoinColumn()
milestone: Milestone | null;
@Column({ type: 'varchar', nullable: true })
milestoneId: string | null;
@OneToOne(() => Bounty, (bounty) => bounty.issue, { nullable: true })
bounty: Bounty | null;
@Column({ type: 'timestamptz', nullable: true })
closedAt: Date | null;
/**
* GitHub's own `updated_at` for this issue, as of the last write that
* touched it (from either sync or a webhook). Sync and the `issues`
* webhook handler both write through the same optimistic-concurrency
* guard in GithubSyncService: a write is only applied if its incoming
* `updated_at` is >= this value, so whichever source has the freshest
* GitHub-side data always wins regardless of which one happens to run
* or commit second — see #24.
*/
@Column({ type: 'timestamptz', nullable: true })
githubUpdatedAt: Date | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}