2023-10-10 16:34:25 +02:00
|
|
|
import {
|
2023-12-09 23:34:12 -05:00
|
|
|
AuthDto,
|
2024-02-12 20:50:47 -05:00
|
|
|
MetadataSearchDto,
|
2023-10-10 16:34:25 +02:00
|
|
|
PersonResponseDto,
|
2024-02-24 01:42:37 +01:00
|
|
|
PlacesResponseDto,
|
2023-10-10 16:34:25 +02:00
|
|
|
SearchDto,
|
|
|
|
|
SearchExploreResponseDto,
|
|
|
|
|
SearchPeopleDto,
|
2024-02-24 01:42:37 +01:00
|
|
|
SearchPlacesDto,
|
2023-10-10 16:34:25 +02:00
|
|
|
SearchResponseDto,
|
|
|
|
|
SearchService,
|
2024-02-12 20:50:47 -05:00
|
|
|
SmartSearchDto,
|
2023-10-10 16:34:25 +02:00
|
|
|
} from '@app/domain';
|
2024-02-13 13:54:58 -06:00
|
|
|
import { SearchSuggestionRequestDto } from '@app/domain/search/dto/search-suggestion.dto';
|
2024-02-17 11:00:55 -06:00
|
|
|
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
2024-02-12 20:50:47 -05:00
|
|
|
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
2023-12-09 23:34:12 -05:00
|
|
|
import { Auth, Authenticated } from '../app.guard';
|
2023-07-01 14:27:34 -04:00
|
|
|
import { UseValidation } from '../app.utils';
|
2023-03-02 21:47:08 -05:00
|
|
|
|
|
|
|
|
@ApiTags('Search')
|
|
|
|
|
@Controller('search')
|
2023-03-24 00:53:56 -04:00
|
|
|
@Authenticated()
|
2023-04-03 06:24:18 +02:00
|
|
|
@UseValidation()
|
2023-03-02 21:47:08 -05:00
|
|
|
export class SearchController {
|
2023-03-24 00:53:56 -04:00
|
|
|
constructor(private service: SearchService) {}
|
2023-03-02 21:47:08 -05:00
|
|
|
|
2024-02-17 11:00:55 -06:00
|
|
|
@Post('metadata')
|
|
|
|
|
searchMetadata(@Auth() auth: AuthDto, @Body() dto: MetadataSearchDto): Promise<SearchResponseDto> {
|
2024-02-12 20:50:47 -05:00
|
|
|
return this.service.searchMetadata(auth, dto);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-17 11:00:55 -06:00
|
|
|
@Post('smart')
|
|
|
|
|
searchSmart(@Auth() auth: AuthDto, @Body() dto: SmartSearchDto): Promise<SearchResponseDto> {
|
2024-02-12 20:50:47 -05:00
|
|
|
return this.service.searchSmart(auth, dto);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 21:47:08 -05:00
|
|
|
@Get()
|
2024-02-12 20:50:47 -05:00
|
|
|
@ApiOperation({ deprecated: true })
|
2023-12-09 23:34:12 -05:00
|
|
|
search(@Auth() auth: AuthDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
|
|
|
|
|
return this.service.search(auth, dto);
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|
|
|
|
|
|
2023-03-05 15:44:31 -05:00
|
|
|
@Get('explore')
|
2023-12-09 23:34:12 -05:00
|
|
|
getExploreData(@Auth() auth: AuthDto): Promise<SearchExploreResponseDto[]> {
|
|
|
|
|
return this.service.getExploreData(auth) as Promise<SearchExploreResponseDto[]>;
|
2023-03-05 15:44:31 -05:00
|
|
|
}
|
2023-11-25 15:46:20 +00:00
|
|
|
|
|
|
|
|
@Get('person')
|
2023-12-09 23:34:12 -05:00
|
|
|
searchPerson(@Auth() auth: AuthDto, @Query() dto: SearchPeopleDto): Promise<PersonResponseDto[]> {
|
|
|
|
|
return this.service.searchPerson(auth, dto);
|
2023-11-25 15:46:20 +00:00
|
|
|
}
|
2024-02-13 13:54:58 -06:00
|
|
|
|
2024-02-24 01:42:37 +01:00
|
|
|
@Get('places')
|
|
|
|
|
searchPlaces(@Query() dto: SearchPlacesDto): Promise<PlacesResponseDto[]> {
|
|
|
|
|
return this.service.searchPlaces(dto);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-13 13:54:58 -06:00
|
|
|
@Get('suggestions')
|
|
|
|
|
getSearchSuggestions(@Auth() auth: AuthDto, @Query() dto: SearchSuggestionRequestDto): Promise<string[]> {
|
|
|
|
|
return this.service.getSearchSuggestions(auth, dto);
|
|
|
|
|
}
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|