Skip to content

Commit 372fc78

Browse files
committed
feat(season): add support for versioned season DTOs
- Delete `SeasonDocsResponseDto` in `src/season/dto/season-docs.response.dto.ts` - Add `SeasonDocsResponseDtoV1` in `src/season/dto/v1/season-docs.response.dto.ts` - Add `SeasonV1` and `EpisodeV1` in `src/season/dto/v1/season.dto.ts` - Add `SeasonDocsResponseDtoV1_4` in `src/season/dto/v1.4/season-docs.response.dto.ts` - Add `SeasonV1_4` and `EpisodeV1_4` in `src/season/dto/v1.4/season.dto.ts` The changes introduce versioned DTOs for seasons, allowing for more flexibility and compatibility with different API versions.
1 parent 3ee2572 commit 372fc78

5 files changed

+106
-9
lines changed

src/season/dto/season-docs.response.dto.ts

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { AbstractDocsResponseDto } from '../../../common/dto/abstract/abstract-docs.response.dto';
2+
import { SeasonV1_4 } from './season.dto';
3+
4+
export class SeasonDocsResponseDtoV1_4 extends AbstractDocsResponseDto(SeasonV1_4) {
5+
constructor(partial: Partial<SeasonDocsResponseDtoV1_4>) {
6+
super(partial);
7+
Object.assign(this, partial);
8+
}
9+
}

src/season/dto/v1.4/season.dto.ts

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { ApiPropertyOptional } from '@nestjs/swagger';
2+
import { ShortImage } from '../../../movie/schemas/movie.schema';
3+
import { EpisodeV1, SeasonV1 } from '../v1/season.dto';
4+
import { Expose } from 'class-transformer';
5+
6+
export class EpisodeV1_4 extends EpisodeV1 {
7+
@Expose()
8+
@ApiPropertyOptional({ type: () => ShortImage })
9+
still: ShortImage;
10+
11+
@Expose()
12+
@ApiPropertyOptional()
13+
airDate?: string;
14+
15+
@Expose()
16+
@ApiPropertyOptional({ deprecated: true })
17+
date?: string;
18+
19+
@Expose()
20+
@ApiPropertyOptional()
21+
enDescription?: string;
22+
}
23+
24+
export class SeasonV1_4 extends SeasonV1 {
25+
@Expose()
26+
@ApiPropertyOptional({ type: () => ShortImage })
27+
poster?: ShortImage;
28+
29+
@Expose()
30+
@ApiPropertyOptional()
31+
name?: string;
32+
33+
@Expose()
34+
@ApiPropertyOptional()
35+
enName?: string;
36+
37+
@Expose()
38+
@ApiPropertyOptional()
39+
duration?: number;
40+
41+
@Expose()
42+
@ApiPropertyOptional()
43+
description?: string;
44+
45+
@Expose()
46+
@ApiPropertyOptional()
47+
enDescription?: string;
48+
49+
@Expose()
50+
@ApiPropertyOptional()
51+
airDate?: string;
52+
53+
@Expose()
54+
@ApiPropertyOptional({ type: () => EpisodeV1_4, isArray: true })
55+
episodes: EpisodeV1_4[];
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { AbstractDocsResponseDto } from '../../../common/dto/abstract/abstract-docs.response.dto';
2+
import { SeasonV1 } from './season.dto';
3+
4+
export class SeasonDocsResponseDtoV1 extends AbstractDocsResponseDto(SeasonV1) {
5+
constructor(partial: Partial<SeasonDocsResponseDtoV1>) {
6+
super(partial);
7+
Object.assign(this, partial);
8+
}
9+
}

src/season/dto/v1/season.dto.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { ApiPropertyOptional } from '@nestjs/swagger';
2+
3+
export class EpisodeV1 {
4+
@ApiPropertyOptional()
5+
number?: number;
6+
7+
@ApiPropertyOptional()
8+
name?: string;
9+
10+
@ApiPropertyOptional()
11+
enName?: string;
12+
13+
@ApiPropertyOptional({ deprecated: true })
14+
date?: string;
15+
16+
@ApiPropertyOptional()
17+
description?: string;
18+
}
19+
20+
export class SeasonV1 {
21+
@ApiPropertyOptional()
22+
movieId: number;
23+
24+
@ApiPropertyOptional()
25+
number?: number;
26+
27+
@ApiPropertyOptional()
28+
episodesCount?: number;
29+
30+
@ApiPropertyOptional({ type: () => EpisodeV1, isArray: true })
31+
episodes: EpisodeV1[];
32+
}

0 commit comments

Comments
 (0)