refactor: search e2e (#7732)

This commit is contained in:
Jason Rasmussen
2024-03-08 11:20:54 -05:00
committed by GitHub
parent ffdd504008
commit 89f6190fb0
8 changed files with 239 additions and 339 deletions

View File

@@ -123,7 +123,7 @@ class BaseSearchDto {
@ValidateBoolean({ optional: true })
isNotInAlbum?: boolean;
@Optional()
@ValidateUUID({ each: true, optional: true })
personIds?: string[];
}

View File

@@ -1,5 +1,4 @@
import { AssetEntity } from '@app/infra/entities';
import { ImmichLogger } from '@app/infra/logger';
import { Inject, Injectable } from '@nestjs/common';
import { AssetOrder, AssetResponseDto, mapAsset } from '../asset';
import { AuthDto } from '../auth';
@@ -30,7 +29,6 @@ import { SearchResponseDto } from './response-dto';
@Injectable()
export class SearchService {
private logger = new ImmichLogger(SearchService.name);
private configCore: SystemConfigCore;
constructor(

View File

@@ -12,7 +12,7 @@ import {
SmartSearchDto,
} from '@app/domain';
import { SearchSuggestionRequestDto } from '@app/domain/search/dto/search-suggestion.dto';
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Query } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { Auth, Authenticated } from '../app.guard';
import { UseValidation } from '../app.utils';
@@ -24,22 +24,24 @@ import { UseValidation } from '../app.utils';
export class SearchController {
constructor(private service: SearchService) {}
@Get()
@ApiOperation({ deprecated: true })
search(@Auth() auth: AuthDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
return this.service.search(auth, dto);
}
@Post('metadata')
@HttpCode(HttpStatus.OK)
searchMetadata(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> {
return this.service.searchMetadata(auth, dto);
}
@Post('smart')
@HttpCode(HttpStatus.OK)
searchSmart(@Auth() auth: AuthDto, @Body() dto: SmartSearchDto): Promise<SearchResponseDto> {
return this.service.searchSmart(auth, dto);
}
@Get()
@ApiOperation({ deprecated: true })
search(@Auth() auth: AuthDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
return this.service.search(auth, dto);
}
@Get('explore')
getExploreData(@Auth() auth: AuthDto): Promise<SearchExploreResponseDto[]> {
return this.service.getExploreData(auth) as Promise<SearchExploreResponseDto[]>;