improved openapi docs (added search filters)

main
Inga 🏳‍🌈 11 months ago
parent 8e521876e7
commit 71f602efd4
  1. 16
      src/movies.controller.ts

@ -7,63 +7,75 @@ import {
Param,
Query,
} from '@nestjs/common';
import { EnrichedDataService } from './types';
import { IsIn, IsInt, IsOptional, IsString, Length } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsIn, IsInt, IsOptional, IsString, Length } from 'class-validator';
import { EnrichedDataService } from './types';
const ENTRY_TYPES = ['movie', 'series', 'episode'] as const;
class SearchDto {
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
actors?: string;
@ApiPropertyOptional()
@IsString()
@Length(2, 2)
@IsOptional()
availableLanguages?: string;
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
directors?: string;
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
localTitle?: string;
@ApiPropertyOptional()
@IsString()
@Length(2, 2)
@IsOptional()
originalLanguage?: string;
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
productionCountries?: string;
@ApiPropertyOptional()
@IsInt()
@Type(() => Number)
@IsOptional()
productionYear?: number;
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
studios?: string;
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()
title?: string;
@ApiPropertyOptional()
@IsString()
@IsIn(ENTRY_TYPES)
@IsOptional()
type?: (typeof ENTRY_TYPES)[number];
@ApiPropertyOptional()
@IsString()
@Length(1)
@IsOptional()

Loading…
Cancel
Save