2023-10-10 16:34:25 +02:00
|
|
|
import {
|
2023-12-09 23:34:12 -05:00
|
|
|
AuthDto,
|
2023-10-10 16:34:25 +02:00
|
|
|
PersonResponseDto,
|
|
|
|
|
SearchDto,
|
|
|
|
|
SearchExploreResponseDto,
|
|
|
|
|
SearchPeopleDto,
|
|
|
|
|
SearchResponseDto,
|
|
|
|
|
SearchService,
|
|
|
|
|
} from '@app/domain';
|
2023-04-03 06:24:18 +02:00
|
|
|
import { Controller, Get, Query } from '@nestjs/common';
|
2023-03-02 21:47:08 -05:00
|
|
|
import { 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
|
|
|
|
|
|
|
|
@Get()
|
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
|
|
|
}
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|