|
|
|
@ -10,7 +10,7 @@ import { |
|
|
|
|
import { ApiPropertyOptional } from '@nestjs/swagger'; |
|
|
|
|
import { Type } from 'class-transformer'; |
|
|
|
|
import { IsIn, IsInt, IsOptional, IsString, Length } from 'class-validator'; |
|
|
|
|
import { EnrichedDataService } from './types'; |
|
|
|
|
import { EnrichedDataService, MovieData } from './types'; |
|
|
|
|
|
|
|
|
|
const ENTRY_TYPES = ['movie', 'series', 'episode'] as const; |
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ export class MoviesController { |
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
@Get() |
|
|
|
|
searchMovies(@Query() query: SearchDto) { |
|
|
|
|
searchMovies(@Query() query: SearchDto): MovieData[] { |
|
|
|
|
if (!Object.values(query).some((filterValue) => filterValue)) { |
|
|
|
|
throw new BadRequestException('Query should not be empty'); |
|
|
|
|
} |
|
|
|
@ -100,7 +100,7 @@ export class MoviesController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Get(':id') |
|
|
|
|
getMovie(@Param('id') id: string) { |
|
|
|
|
getMovie(@Param('id') id: string): MovieData { |
|
|
|
|
const result = /^\d+$/.test(id) |
|
|
|
|
? this.enrichedDataService.getMetadataByInternalId(parseInt(id, 10)) |
|
|
|
|
: this.enrichedDataService.getMetadataByImdbId(id); |
|
|
|
|