mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding download queue
This commit is contained in:
parent
0b68ddda78
commit
73b4b2c13c
27 changed files with 615 additions and 458 deletions
25
src/main/entity/download-queue.entity.ts
Normal file
25
src/main/entity/download-queue.entity.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
OneToOne,
|
||||
JoinColumn,
|
||||
} from "typeorm";
|
||||
import type { Game } from "./game.entity";
|
||||
|
||||
@Entity("download_queue")
|
||||
export class DownloadQueue {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@OneToOne("Game", "downloadQueue")
|
||||
@JoinColumn()
|
||||
game: Game;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
|
@ -6,7 +6,8 @@ import {
|
|||
UpdateDateColumn,
|
||||
OneToMany,
|
||||
} from "typeorm";
|
||||
import { Repack } from "./repack.entity";
|
||||
import type { Repack } from "./repack.entity";
|
||||
|
||||
import { DownloadSourceStatus } from "@shared";
|
||||
|
||||
@Entity("download_source")
|
||||
|
@ -26,7 +27,7 @@ export class DownloadSource {
|
|||
@Column("text", { default: DownloadSourceStatus.UpToDate })
|
||||
status: DownloadSourceStatus;
|
||||
|
||||
@OneToMany(() => Repack, (repack) => repack.downloadSource, { cascade: true })
|
||||
@OneToMany("Repack", "downloadSource", { cascade: true })
|
||||
repacks: Repack[];
|
||||
|
||||
@CreateDateColumn()
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Repack } from "./repack.entity";
|
|||
import type { GameShop } from "@types";
|
||||
import { Downloader } from "@shared";
|
||||
import type { Aria2Status } from "aria2";
|
||||
import type { DownloadQueue } from "./download-queue.entity";
|
||||
|
||||
@Entity("game")
|
||||
export class Game {
|
||||
|
@ -66,10 +67,16 @@ export class Game {
|
|||
@Column("text", { nullable: true })
|
||||
uri: string | null;
|
||||
|
||||
@OneToOne(() => Repack, { nullable: true })
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@OneToOne("Repack", "game", { nullable: true })
|
||||
@JoinColumn()
|
||||
repack: Repack;
|
||||
|
||||
@OneToOne("DownloadQueue", "game")
|
||||
downloadQueue: DownloadQueue;
|
||||
|
||||
@Column("boolean", { default: false })
|
||||
isDeleted: boolean;
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@ export * from "./repack.entity";
|
|||
export * from "./user-preferences.entity";
|
||||
export * from "./game-shop-cache.entity";
|
||||
export * from "./download-source.entity";
|
||||
export * from "./download-queue.entity";
|
||||
|
|
|
@ -19,6 +19,9 @@ export class Repack {
|
|||
@Column("text", { unique: true })
|
||||
magnet: string;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@Column("int", { nullable: true })
|
||||
page: number;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue