|
| 1 | +import { Prop } from '@nestjs/mongoose'; |
| 2 | +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; |
| 3 | +import { IsOptional, IsNumber } from 'class-validator'; |
| 4 | +import { ApiNullableProperty } from 'src/common/decorators/api-nullable-property.decorator'; |
| 5 | +import { ParseNumber } from 'src/common/decorators/transform/parse-number.decorator'; |
| 6 | +import { |
| 7 | + ExternalId, |
| 8 | + Name, |
| 9 | + FactInMovie, |
| 10 | + Rating, |
| 11 | + Votes, |
| 12 | + Logo, |
| 13 | + ShortImage, |
| 14 | + Images, |
| 15 | + VideoTypes, |
| 16 | + ItemName, |
| 17 | + PersonInMovie, |
| 18 | + ReviewInfo, |
| 19 | + SeasonInfo, |
| 20 | + CurrencyValue, |
| 21 | + Fees, |
| 22 | + Premiere, |
| 23 | + LinkedMovie, |
| 24 | + Watchability, |
| 25 | + VendorImage, |
| 26 | + YearRange, |
| 27 | +} from 'src/movie/schemas/movie.schema'; |
| 28 | + |
| 29 | +export class MovieDtoV1 { |
| 30 | + // INFO: Id values |
| 31 | + @ApiProperty({ |
| 32 | + description: 'Id фильма с кинопоиска', |
| 33 | + example: 666, |
| 34 | + }) |
| 35 | + @IsOptional() |
| 36 | + @IsNumber() |
| 37 | + @ParseNumber() |
| 38 | + id: number; |
| 39 | + |
| 40 | + @ApiProperty({ type: () => ExternalId }) |
| 41 | + externalId: ExternalId; |
| 42 | + |
| 43 | + // INFO: Name values |
| 44 | + @ApiNullableProperty({ example: 'Человек паук' }) |
| 45 | + name: string; |
| 46 | + |
| 47 | + @ApiNullableProperty({ example: 'Spider man' }) |
| 48 | + alternativeName: string; |
| 49 | + |
| 50 | + @ApiNullableProperty({ example: 'Spider man' }) |
| 51 | + enName: string; |
| 52 | + |
| 53 | + @ApiProperty({ type: () => Name, isArray: true }) |
| 54 | + names: Name[]; |
| 55 | + |
| 56 | + // INFO: Type values |
| 57 | + @ApiProperty({ |
| 58 | + example: 'movie', |
| 59 | + description: 'Тип тайтла. Доступны: movie | tv-series | cartoon | anime | animated-series | tv-show', |
| 60 | + }) |
| 61 | + type: string; |
| 62 | + |
| 63 | + @ApiProperty({ |
| 64 | + example: 1, |
| 65 | + description: |
| 66 | + 'Тип тайтла в числовом обозначении. Доступны: 1 (movie) | 2 (tv-series) | 3 (cartoon) | 4 (anime) | 5 (animated-series) | 6 (tv-show)', |
| 67 | + }) |
| 68 | + typeNumber: number; |
| 69 | + |
| 70 | + // INFO: Year values |
| 71 | + @ApiNullableProperty({ |
| 72 | + example: 2023, |
| 73 | + description: 'Год премьеры. При поиске по этому полю, можно использовать интервалы 1860-2030', |
| 74 | + }) |
| 75 | + year: number; |
| 76 | + |
| 77 | + // INFO: Description values |
| 78 | + @ApiNullableProperty({ |
| 79 | + description: 'Описание тайтла', |
| 80 | + }) |
| 81 | + description: string; |
| 82 | + |
| 83 | + @ApiNullableProperty({ |
| 84 | + description: 'Сокращенное описание', |
| 85 | + }) |
| 86 | + shortDescription: string; |
| 87 | + |
| 88 | + @ApiNullableProperty({ |
| 89 | + description: 'Слоган', |
| 90 | + }) |
| 91 | + slogan: string; |
| 92 | + |
| 93 | + @ApiNullableProperty({ |
| 94 | + example: 'completed', |
| 95 | + description: |
| 96 | + 'Статус релиза тайтла. Доступные значения: filming | pre-production | completed | announced | post-production', |
| 97 | + }) |
| 98 | + status: string; |
| 99 | + |
| 100 | + facts: FactInMovie[]; |
| 101 | + |
| 102 | + // INFO: Movie rating values |
| 103 | + @ApiPropertyOptional({ type: () => Rating }) |
| 104 | + rating: Rating; |
| 105 | + |
| 106 | + @ApiPropertyOptional({ type: () => Votes }) |
| 107 | + votes: Votes; |
| 108 | + |
| 109 | + // INFO: Length value |
| 110 | + @ApiNullableProperty({ example: 120, description: 'Продолжительность фильма' }) |
| 111 | + movieLength: number; |
| 112 | + |
| 113 | + // INFO: Age rating values |
| 114 | + @ApiNullableProperty({ |
| 115 | + example: 'pg13', |
| 116 | + description: 'Возрастной рейтинг по MPAA', |
| 117 | + }) |
| 118 | + ratingMpaa: string; |
| 119 | + |
| 120 | + @ApiNullableProperty({ |
| 121 | + example: '16', |
| 122 | + description: 'Возрастной рейтинг', |
| 123 | + }) |
| 124 | + ageRating: number; |
| 125 | + |
| 126 | + // INFO: Image values |
| 127 | + @ApiPropertyOptional({ type: () => Logo }) |
| 128 | + logo: Logo; |
| 129 | + |
| 130 | + @ApiPropertyOptional({ type: () => ShortImage }) |
| 131 | + poster: ShortImage; |
| 132 | + |
| 133 | + @ApiPropertyOptional({ type: () => ShortImage }) |
| 134 | + backdrop: ShortImage; |
| 135 | + |
| 136 | + // !TODO: Поле не приходит из парсера, нужно проставить сюда данные |
| 137 | + imagesInfo: Images; |
| 138 | + |
| 139 | + // INFO: Video value |
| 140 | + @ApiPropertyOptional({ type: () => VideoTypes }) |
| 141 | + videos: VideoTypes; |
| 142 | + |
| 143 | + // INFO: Movie base values |
| 144 | + @ApiPropertyOptional({ type: () => ItemName, isArray: true }) |
| 145 | + genres: ItemName[]; |
| 146 | + |
| 147 | + @ApiPropertyOptional({ type: () => ItemName, isArray: true }) |
| 148 | + countries: ItemName[]; |
| 149 | + |
| 150 | + @ApiPropertyOptional({ type: () => PersonInMovie, isArray: true }) |
| 151 | + persons: PersonInMovie[]; |
| 152 | + |
| 153 | + // !TODO: Поле не приходит из парсера, нужно проставить сюда данные |
| 154 | + @ApiPropertyOptional({ type: () => ReviewInfo }) |
| 155 | + reviewInfo: ReviewInfo; |
| 156 | + |
| 157 | + // !TODO: Поле не приходит из парсера, нужно проставить сюда данные |
| 158 | + @ApiPropertyOptional({ type: () => SeasonInfo, isArray: true }) |
| 159 | + seasonsInfo: SeasonInfo[]; |
| 160 | + |
| 161 | + // INFO: Currency values |
| 162 | + @ApiPropertyOptional({ type: () => CurrencyValue }) |
| 163 | + budget: CurrencyValue; |
| 164 | + |
| 165 | + @ApiPropertyOptional({ type: () => Fees }) |
| 166 | + fees: Fees; |
| 167 | + |
| 168 | + // INFO: Date values |
| 169 | + @ApiPropertyOptional({ type: () => Premiere }) |
| 170 | + premiere: Premiere; |
| 171 | + |
| 172 | + @ApiPropertyOptional({ type: () => LinkedMovie, isArray: true }) |
| 173 | + similarMovies: LinkedMovie[]; |
| 174 | + |
| 175 | + @ApiPropertyOptional({ type: () => LinkedMovie, isArray: true }) |
| 176 | + sequelsAndPrequels: LinkedMovie[]; |
| 177 | + |
| 178 | + @ApiPropertyOptional({ type: () => Watchability }) |
| 179 | + watchability: Watchability; |
| 180 | + |
| 181 | + productionCompanies: VendorImage[]; |
| 182 | + |
| 183 | + @ApiPropertyOptional({ type: () => YearRange, isArray: true }) |
| 184 | + releaseYears: YearRange[]; |
| 185 | + |
| 186 | + @ApiNullableProperty({ |
| 187 | + example: 1, |
| 188 | + description: 'Позиция тайтла в топ 10. Чтобы найти фильмы участвующие в рейтинге используйте: `!null`', |
| 189 | + }) |
| 190 | + top10?: number | null; |
| 191 | + |
| 192 | + @ApiNullableProperty({ |
| 193 | + example: 200, |
| 194 | + description: 'Позиция тайтла в топ 250. Чтобы найти фильмы участвующие в рейтинге используйте: `!null`', |
| 195 | + }) |
| 196 | + top250?: number | null; |
| 197 | +} |
0 commit comments