diff --git a/src/stations/dto/station-query.dto.ts b/src/stations/dto/station-query.dto.ts index 17da4ee..0c1cfd3 100644 --- a/src/stations/dto/station-query.dto.ts +++ b/src/stations/dto/station-query.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsEnum, IsOptional } from 'class-validator'; +import { IsEnum, IsOptional, IsString } from 'class-validator'; import { PortType } from 'src/ports/port.entity'; import { StationStatus } from '../station.entity'; import { Transform } from 'class-transformer'; @@ -16,4 +16,9 @@ export class StationQueryDto { @IsEnum(StationStatus) @Transform(({ value }) => ('' + value).toLowerCase()) status: StationStatus; + + @ApiProperty() + @IsOptional() + @IsString() + qs: string; } diff --git a/src/stations/stations.service.ts b/src/stations/stations.service.ts index 35416fe..fec32c0 100644 --- a/src/stations/stations.service.ts +++ b/src/stations/stations.service.ts @@ -20,6 +20,9 @@ export class StationsService { if (query.type) { where.ports = { type: query.type }; } + if (query.qs) { + where.name = query.qs; + } return this.stationRepository.find({ where, relations: ['merchant', 'ports'],