Skip to content

Commit f9f019e

Browse files
committed
fix: date params isn't transform to filter
1 parent 532169a commit f9f019e

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

src/movie/dto/v1.4/movie-request.dto.ts

+14-24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { SortOrder } from 'mongoose';
2424
import { Expose } from 'class-transformer';
2525
import { EnumParam } from '../../../common/decorators/types/enum-param';
2626
import { IRequestModel } from '../../../common/interfaces/request-model.interface';
27+
import { DateParam } from '../../../common/decorators/types/date-param';
2728

2829
export enum MovieFieldV1_4 {
2930
'id' = 'id',
@@ -150,7 +151,7 @@ export enum MovieSelectFieldV1_4 {
150151
'persons' = 'persons',
151152
'facts' = 'facts',
152153
'fees' = 'fees',
153-
'premiere.world' = 'premiere.world',
154+
'premiere' = 'premiere',
154155
'similarMovies' = 'similarMovies',
155156
'sequelsAndPrequels' = 'sequelsAndPrequels',
156157
'watchability' = 'watchability',
@@ -512,33 +513,39 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
512513
})
513514
@IsOptional()
514515
@ToArray()
516+
@StringParam()
515517
'persons.enProfession': string[];
516518

517519
@ApiNullableProperty({ type: 'string', isArray: true, description: 'Поиск по сборам в мире (пример: `1000-6666666`)' })
518520
@IsOptional()
519521
@ToArray()
520522
@Validate(IsNumberParam)
523+
@NumberParam()
521524
'fees.world': string[];
522525
@ApiNullableProperty({ type: 'string', isArray: true, description: 'Поиск по сборам в США (пример: `1000-6666666`)' })
523526
@IsOptional()
524527
@ToArray()
525528
@Validate(IsNumberParam)
529+
@NumberParam()
526530
'fees.usa': string[];
527531
@ApiNullableProperty({ type: 'string', isArray: true, description: 'Поиск по сборам в России (пример: `1000-6666666`)' })
528532
@IsOptional()
529533
@ToArray()
530534
@Validate(IsNumberParam)
535+
@NumberParam()
531536
'fees.russia': string[];
532537

533538
@ApiNullableProperty({ type: 'string', isArray: true, description: 'Поиск по дате премьеры в мире (пример: `01.01.2020, 01.01.2020-31.12.2020`)' })
534539
@IsOptional()
535540
@ToArray()
536541
@Validate(IsDateParam)
542+
@DateParam()
537543
'premiere.world': string[];
538544
@ApiNullableProperty({ type: 'string', isArray: true, description: 'Поиск по дате премьеры в США (пример: `01.01.2020, 01.01.2020-31.12.2020`)' })
539545
@IsOptional()
540546
@ToArray()
541547
@Validate(IsDateParam)
548+
@DateParam()
542549
'premiere.usa': string[];
543550
@ApiNullableProperty({
544551
type: 'string',
@@ -548,6 +555,7 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
548555
@IsOptional()
549556
@ToArray()
550557
@Validate(IsDateParam)
558+
@DateParam()
551559
'premiere.russia': string[];
552560
@ApiNullableProperty({
553561
type: 'string',
@@ -557,6 +565,7 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
557565
@IsOptional()
558566
@ToArray()
559567
@Validate(IsDateParam)
568+
@DateParam()
560569
'premiere.digital': string[];
561570
@ApiNullableProperty({
562571
type: 'string',
@@ -566,6 +575,7 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
566575
@IsOptional()
567576
@ToArray()
568577
@Validate(IsDateParam)
578+
@DateParam()
569579
'premiere.cinema': string[];
570580
@ApiNullableProperty({
571581
type: 'string',
@@ -574,20 +584,23 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
574584
})
575585
@IsOptional()
576586
@ToArray()
587+
@StringParam()
577588
'premiere.country': string[];
578589

579590
@ApiNullableProperty({ isArray: true, description: 'Поиск по ID KinoPoisk из списка похожих фильмов (пример: `666, 555, !666`)' })
580591
@IsOptional()
581592
@ToArray()
582593
@Validate(IsValueInRange, [250, 7000000])
583594
@Validate(IsNumberParam)
595+
@NumberParam()
584596
'similarMovies.id': string[];
585597

586598
@ApiNullableProperty({ isArray: true, description: 'Поиск по ID KinoPoisk из списка сиквелов и преквелов (пример: `666, 555, !666`)' })
587599
@IsOptional()
588600
@ToArray()
589601
@Validate(IsValueInRange, [250, 7000000])
590602
@Validate(IsNumberParam)
603+
@NumberParam()
591604
'sequelsAndPrequels.id': string[];
592605

593606
@ApiNullableProperty({
@@ -644,29 +657,6 @@ export class MovieRequestDtoV1_4 implements IRequestModel {
644657
}
645658

646659
public model2Select() {
647-
const defaultSelectFields = [
648-
'id',
649-
'externalId',
650-
'name',
651-
'logo',
652-
'poster',
653-
'alternativeName',
654-
'enName',
655-
'names',
656-
'description',
657-
'shortDescription',
658-
'horizontalPoster',
659-
'type',
660-
'movieLength',
661-
'seriesLength',
662-
'totalSeriesLength',
663-
'year',
664-
'votes',
665-
'rating',
666-
'releaseYears',
667-
'genres',
668-
'countries',
669-
];
670660
const select = new SelectBuilder();
671661

672662
return select.build(this.selectFields, defaultSelectFields);

src/review/dto/v1.4/review-request.dto.ts

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { NumberParam } from '../../../common/decorators/types/number-param';
2020
import { IsDateParam } from '../../../common/validation/is-date-param';
2121
import { DateParam } from '../../../common/decorators/types/date-param';
2222
import { EnumParam } from '../../../common/decorators/types/enum-param';
23+
import { StringParam } from '../../../common/decorators/types/string-param';
2324

2425
export enum ReviewFieldV1_4 {
2526
'id' = 'id',
@@ -133,6 +134,7 @@ export class ReviewRequestDtoV1_4 implements IRequestModel {
133134
@IsOptional()
134135
@ToArray()
135136
@Validate(IsString)
137+
@StringParam()
136138
author?: string[];
137139

138140
@ApiNullableProperty({

0 commit comments

Comments
 (0)