feat: adding download queue

This commit is contained in:
Chubby Granny Chaser 2024-06-04 15:33:47 +01:00
parent 0b68ddda78
commit 73b4b2c13c
No known key found for this signature in database
27 changed files with 615 additions and 458 deletions

View 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;
}

View file

@ -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()

View file

@ -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;

View file

@ -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";

View file

@ -19,6 +19,9 @@ export class Repack {
@Column("text", { unique: true })
magnet: string;
/**
* @deprecated
*/
@Column("int", { nullable: true })
page: number;