Skip to content

Commit

Permalink
fix: Fixes for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Oct 15, 2020
1 parent 9145b24 commit 92636f7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
8 changes: 1 addition & 7 deletions apps/api/src/seasons/seasons.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common'
import { InjectModel } from '@nestjs/mongoose'

import { Season, SeasonModel } from '@pct-org/mongo-models'

@Injectable()
Expand Down Expand Up @@ -29,16 +28,11 @@ export class SeasonsService {
)
}

public async findOne(id: string, lean = true): Promise<Season[]> {
public async findOne(id: string, lean = true): Promise<Season> {
return this.seasonModel.findById(
id,
{},
{
// skip: showsArgs.offset,
// limit: showsArgs.limit,
sort: {
number: 0 // Sort on season number
},
lean
}
)
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/shared/torrent/torrent.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export class TorrentService implements OnApplicationBootstrap {
this.maxConcurrent = this.configService.get(ConfigService.MAX_CONCURRENT_DOWNLOADS)
}

protected onApplicationBootstrap(): void {
/**
* When application boots we want to check for incomplete or queued downloads ti start
*/
public onApplicationBootstrap(): void {
// Check for incomplete downloads and add them to the downloads
this.checkForIncompleteDownloads()
}
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/status/status.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export class StatusService {

return {
version: 'unknown', // TODO:: Get git tag
totalMovies: this.movieModel.countDocuments(),
totalShows: this.showModel.countDocuments(),
totalEpisodes: this.episodesModel.countDocuments(),
totalMovies: await this.movieModel.countDocuments(),
totalShows: await this.showModel.countDocuments(),
totalEpisodes: await this.episodesModel.countDocuments(),
disk: {
free: formatKbToString(disk.available, false),
used: formatKbToString(folderSize, false),
Expand Down
14 changes: 8 additions & 6 deletions libs/mongo-models/src/download/download.object-type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Field, ObjectType } from '@nestjs/graphql'

import { Episode, Movie, Subtitle } from '../'
import { Episode } from '../episode/episode.object-type'
import { Movie } from '../movie/movie.object-type'
import { Subtitle } from '../shared/subtitle.object-type'

@ObjectType()
export class Download {
Expand All @@ -15,7 +17,7 @@ export class Download {
itemType: string

@Field({ description: 'The type of torrent, default or searched.', defaultValue: 'scraped' })
torrentType: string
torrentType?: string

@Field(type => Episode, {
description: 'The episode if type === "episode".',
Expand All @@ -38,16 +40,16 @@ export class Download {
progress: number

@Field({ description: 'Status of the download.', defaultValue: 'queued' })
status: string
status?: string

@Field({ description: 'Remaining time for the download.', nullable: true })
timeRemaining: string
timeRemaining?: string

@Field({ description: 'Formatted download speed.', nullable: true })
speed: string
speed?: string

@Field({ description: 'Number of peers of the download.', nullable: true })
numPeers: number
numPeers?: number

@Field({ description: 'The time at which the download was created.' })
createdAt: number
Expand Down

0 comments on commit 92636f7

Please sign in to comment.