Skip to content

Commit

Permalink
chore: update expose
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwitr0 committed Dec 13, 2023
1 parent b6eb6a4 commit 2cfdbf1
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 170 deletions.
9 changes: 1 addition & 8 deletions src/image/dto/v1.4/image-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsNumber, IsOptional, Min, Validate } from 'class-validator';
import { ParseNumber } from '../../../common/decorators/transform/parse-number.decorator';
import { SetDefaultValue } from '../../../common/decorators/transform/set-default-value.decorator';
import { Expose } from 'class-transformer';
import { IsValueInRange } from '../../../common/validation/is-value-in-range';
import { ToArray } from '../../../common/decorators/transform/to-array.decorator';
import { IsEnumParam } from '../../../common/validation/is-enum-param';
Expand All @@ -20,6 +19,7 @@ import { StringParam } from '../../../common/decorators/types/string-param';
import { ApiNullableProperty } from '../../../common/decorators/api-nullable-property.decorator';
import { IsDateParam } from '../../../common/validation/is-date-param';
import { DateParam } from '../../../common/decorators/types/date-param';
import { Expose } from 'class-transformer';

export enum ImageFieldV1_4 {
'movieId' = 'movieId',
Expand Down Expand Up @@ -138,38 +138,33 @@ export class ImageRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsValueInRange, [1, 7000000])
@NumberParam()
@Expose()
movieId?: string[];

@ApiPropertyOptional({ description: 'Поиск картинок по типу (пример: `"cover", "!cover"`)', isArray: true, enum: ImageTypeV1_4 })
@IsOptional()
@ToArray()
@Validate(IsEnumParam, [ImageTypeV1_4])
@EnumParam()
@Expose()
type?: string[];

@ApiPropertyOptional({ description: 'Поиск картинок по языку (пример: `"en", "!de"`)', isArray: true, enum: ImageLanguageV1_4 })
@IsOptional()
@ToArray()
@StringParam()
@Expose()
language?: string[];

@ApiPropertyOptional({ description: 'Поиск картинок по высоте (пример: `"1920", "360-1920"`)', isArray: true })
@IsOptional()
@ToArray()
@Validate(IsValueInRange, [1, 10000])
@NumberParam()
@Expose()
height?: string[];

@ApiPropertyOptional({ description: 'Поиск картинок по ширине (пример: `"1080", "320-1080"`)', isArray: true })
@IsOptional()
@ToArray()
@Validate(IsValueInRange, [1, 10000])
@NumberParam()
@Expose()
width?: string[];

@ApiNullableProperty({
Expand All @@ -181,7 +176,6 @@ export class ImageRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
updatedAt: string;

@ApiNullableProperty({
Expand All @@ -193,7 +187,6 @@ export class ImageRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
createdAt: string;

public model2Where() {
Expand Down
7 changes: 1 addition & 6 deletions src/keyword/dto/v1.4/keyword-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsNumber, IsOptional, Min, Validate } from 'class-validator';
import { ParseNumber } from '../../../common/decorators/transform/parse-number.decorator';
import { SetDefaultValue } from '../../../common/decorators/transform/set-default-value.decorator';
import { Expose } from 'class-transformer';
import { IsValueInRange } from '../../../common/validation/is-value-in-range';
import { ToArray } from '../../../common/decorators/transform/to-array.decorator';
import { IsEnumParam } from '../../../common/validation/is-enum-param';
Expand All @@ -19,6 +18,7 @@ import { StringParam } from '../../../common/decorators/types/string-param';
import { ApiNullableProperty } from '../../../common/decorators/api-nullable-property.decorator';
import { IsDateParam } from '../../../common/validation/is-date-param';
import { DateParam } from '../../../common/decorators/types/date-param';
import { Expose } from 'class-transformer';

export enum KeywordFieldV1_4 {
'id' = 'id',
Expand Down Expand Up @@ -97,22 +97,19 @@ export class KeywordRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsValueInRange, [1, 100000000000])
@NumberParam()
@Expose()
id?: string[];

@ApiPropertyOptional({ description: 'Поиск ключевых слов по id фильма (пример: `"666", "!666"`)', isArray: true })
@IsOptional()
@ToArray()
@Validate(IsValueInRange, [1, 7000000])
@NumberParam()
@Expose()
'movies.id'?: string[];

@ApiPropertyOptional({ description: 'Поиск ключевых слов по наименованию (пример: `"1980-е", "!1980-е"`)', isArray: true })
@IsOptional()
@ToArray()
@StringParam()
@Expose()
title?: string[];

@ApiNullableProperty({
Expand All @@ -124,7 +121,6 @@ export class KeywordRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
updatedAt: string;

@ApiNullableProperty({
Expand All @@ -136,7 +132,6 @@ export class KeywordRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
createdAt: string;

public model2Where() {
Expand Down
7 changes: 1 addition & 6 deletions src/list/dto/v1.4/list-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsNumber, IsOptional, IsString, Min, Validate } from 'class-validator';
import { ParseNumber } from '../../../common/decorators/transform/parse-number.decorator';
import { SetDefaultValue } from '../../../common/decorators/transform/set-default-value.decorator';
import { Expose } from 'class-transformer';
import { IsValueInRange } from '../../../common/validation/is-value-in-range';
import { ToArray } from '../../../common/decorators/transform/to-array.decorator';
import { IsEnumParam } from '../../../common/validation/is-enum-param';
Expand All @@ -21,6 +20,7 @@ import { NumberParam } from '../../../common/decorators/types/number-param';
import { IsNumberParam } from '../../../common/validation/is-number-param';
import { IsDateParam } from '../../../common/validation/is-date-param';
import { DateParam } from '../../../common/decorators/types/date-param';
import { Expose } from 'class-transformer';

export enum ListFieldV1_4 {
name = 'name',
Expand Down Expand Up @@ -112,15 +112,13 @@ export class ListRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsString)
@StringParam()
@Expose()
slug?: string[];

@ApiNullableProperty({ isArray: true, description: 'Поиск по категории (пример: `"Фильмы", "!Фильмы"`)', enum: ListCatregoryV1_4 })
@IsOptional()
@ToArray()
@Validate(IsEnumParam, [ListCatregoryV1_4])
@EnumParam()
@Expose()
category?: string[];

@ApiNullableProperty({ isArray: true, description: 'Поиск по количеству фильмов (пример: `"1-200", "10"`)' })
Expand All @@ -129,7 +127,6 @@ export class ListRequestDtoV1_4 implements IRequestModel {
@Validate(IsValueInRange, [1, 1000])
@Validate(IsNumberParam)
@NumberParam()
@Expose()
moviesCount?: string[];

@ApiNullableProperty({
Expand All @@ -141,7 +138,6 @@ export class ListRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
updatedAt: string;

@ApiNullableProperty({
Expand All @@ -153,7 +149,6 @@ export class ListRequestDtoV1_4 implements IRequestModel {
@ToArray()
@Validate(IsDateParam)
@DateParam()
@Expose()
createdAt: string;
public model2Where() {
const filter = new FilterBuilder();
Expand Down
Loading

0 comments on commit 2cfdbf1

Please sign in to comment.