All files / src/modules/listings/dto update-listing.input.ts

100% Statements 25/25
100% Branches 0/0
100% Functions 1/1
100% Lines 23/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 4711x 11x     11x       11x         11x         11x         11x   11x       11x     11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x  
import { InputType, Field } from '@nestjs/graphql';
import { IsString, IsNumber, IsOptional, IsArray, IsUrl, IsInt, IsBoolean } from 'class-validator';
 
@InputType()
export class UpdateListingInput {
  @Field({ nullable: true })
  @IsString()
  @IsOptional()
  title?: string;
 
  @Field({ nullable: true })
  @IsString()
  @IsOptional()
  description?: string;
 
  @Field({ nullable: true })
  @IsNumber()
  @IsOptional()
  price?: number;
 
  @Field({ nullable: true })
  @IsNumber()
  @IsOptional()
  addressId?: number;
 
  @Field(() => [String], { nullable: true })
  @IsArray()
  @IsUrl({}, { each: true })
  @IsOptional()
  photoUrls?: string[];
 
  // Optional parity with DTO
  @Field({ nullable: true }) @IsOptional() @IsNumber() area?: number;
  @Field({ nullable: true }) @IsOptional() @IsInt() rooms?: number;
  @Field({ nullable: true }) @IsOptional() @IsInt() floor?: number;
  @Field({ nullable: true }) @IsOptional() @IsInt() totalFloors?: number;
  @Field({ nullable: true }) @IsOptional() @IsInt() bathrooms?: number;
  @Field({ nullable: true }) @IsOptional() @IsNumber() ceilingHeight?: number;
  @Field({ nullable: true }) @IsOptional() @IsInt() yearBuilt?: number;
  @Field({ nullable: true }) @IsOptional() @IsBoolean() furnished?: boolean;
  @Field({ nullable: true }) @IsOptional() @IsBoolean() renovated?: boolean;
  @Field({ nullable: true }) @IsOptional() @IsBoolean() balcony?: boolean;
  @Field({ nullable: true }) @IsOptional() @IsBoolean() elevator?: boolean;
  @Field({ nullable: true }) @IsOptional() @IsBoolean() internet?: boolean;
  @Field({ nullable: true }) @IsOptional() @IsString() facingSide?: string;
  @Field({ nullable: true }) @IsOptional() @IsString() heating?: 'CENTRAL'|'GAS'|'ELECTRIC'|'OTHER';
}