mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding import download source
This commit is contained in:
parent
ddd9ea69df
commit
48e07370e4
70 changed files with 925 additions and 1261 deletions
30
src/main/entity/download-source.entity.ts
Normal file
30
src/main/entity/download-source.entity.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
OneToMany,
|
||||
} from "typeorm";
|
||||
import { Repack } from "./repack.entity";
|
||||
|
||||
@Entity("download_source")
|
||||
export class DownloadSource {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column("text", { nullable: true, unique: true })
|
||||
url: string;
|
||||
|
||||
@Column("text", { unique: true })
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => Repack, (repack) => repack.downloadSource, { cascade: true })
|
||||
repacks: Repack[];
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
|
@ -63,6 +63,9 @@ export class Game {
|
|||
@Column("float", { default: 0 })
|
||||
fileSize: number;
|
||||
|
||||
@Column("text", { nullable: true })
|
||||
uri: string | null;
|
||||
|
||||
@OneToOne(() => Repack, { nullable: true })
|
||||
@JoinColumn()
|
||||
repack: Repack;
|
||||
|
|
|
@ -2,3 +2,4 @@ export * from "./game.entity";
|
|||
export * from "./repack.entity";
|
||||
export * from "./user-preferences.entity";
|
||||
export * from "./game-shop-cache.entity";
|
||||
export * from "./download-source.entity";
|
||||
|
|
|
@ -4,7 +4,9 @@ import {
|
|||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
} from "typeorm";
|
||||
import { DownloadSource } from "./download-source.entity";
|
||||
|
||||
@Entity("repack")
|
||||
export class Repack {
|
||||
|
@ -17,9 +19,6 @@ export class Repack {
|
|||
@Column("text", { unique: true })
|
||||
magnet: string;
|
||||
|
||||
@Column("int")
|
||||
page: number;
|
||||
|
||||
@Column("text")
|
||||
repacker: string;
|
||||
|
||||
|
@ -29,6 +28,9 @@ export class Repack {
|
|||
@Column("datetime")
|
||||
uploadDate: Date | string;
|
||||
|
||||
@ManyToOne(() => DownloadSource, { nullable: true, onDelete: "CASCADE" })
|
||||
downloadSource: DownloadSource;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue