Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.
/ models Public archive

Commit ba2de9e

Browse files
committed
feat: add support for storing origin data
1 parent 2742c93 commit ba2de9e

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

src/models/origin.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
2+
3+
@Entity()
4+
export class Origin {
5+
@PrimaryGeneratedColumn()
6+
// @ts-ignore
7+
databaseId: string
8+
9+
@Column('varchar', { nullable: false })
10+
// @ts-ignore
11+
hostname: string
12+
13+
@Column('varchar', { nullable: false })
14+
// @ts-ignore
15+
releasePath: string
16+
17+
@Column('varchar', { nullable: false })
18+
// @ts-ignore
19+
packagesPath: string
20+
21+
@Column('timestamptz', { nullable: false })
22+
// @ts-ignore
23+
lastUpdated: Date
24+
25+
@Column('bool', { nullable: false })
26+
// @ts-ignore
27+
hasInRelease: boolean
28+
29+
@Column('bool', { nullable: false })
30+
// @ts-ignore
31+
hasReleaseGpg: boolean
32+
33+
@Column('bool', { nullable: false })
34+
// @ts-ignore
35+
supportsPaymentV1: boolean
36+
37+
@Column('bool', { nullable: false })
38+
// @ts-ignore
39+
supportsPaymentV2: boolean
40+
41+
@Column('bool', { nullable: false })
42+
// @ts-ignore
43+
supportsHttps: boolean
44+
}

src/models/repository.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Column, Entity, Index, PrimaryColumn } from 'typeorm'
1+
import { Column, Entity, Index, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm'
2+
import { Origin } from './origin'
23

34
@Entity()
45
export class Repository {
@@ -55,4 +56,9 @@ export class Repository {
5556
@Index('package_current_idx')
5657
// @ts-ignore
5758
isPruned: boolean
59+
60+
@OneToOne(() => Origin, origin => origin.databaseId, { nullable: false })
61+
@JoinColumn({ name: 'originId' })
62+
// @ts-ignore
63+
repository: Repository
5864
}

0 commit comments

Comments
 (0)