2023-03-05 15:44:31 -05:00
|
|
|
import {
|
|
|
|
|
AuthUserDto,
|
|
|
|
|
SearchConfigResponseDto,
|
|
|
|
|
SearchDto,
|
|
|
|
|
SearchExploreResponseDto,
|
|
|
|
|
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-06-16 15:39:53 -04:00
|
|
|
import { AuthUser } from '../decorators/auth-user.decorator';
|
2023-03-02 21:47:08 -05:00
|
|
|
import { Authenticated } from '../decorators/authenticated.decorator';
|
2023-04-03 06:24:18 +02:00
|
|
|
import { UseValidation } from '../decorators/use-validation.decorator';
|
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-06-16 15:39:53 -04:00
|
|
|
search(@AuthUser() authUser: AuthUserDto, @Query() dto: SearchDto): Promise<SearchResponseDto> {
|
2023-03-24 00:53:56 -04:00
|
|
|
return this.service.search(authUser, dto);
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('config')
|
|
|
|
|
getSearchConfig(): SearchConfigResponseDto {
|
2023-03-24 00:53:56 -04:00
|
|
|
return this.service.getConfig();
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|
2023-03-05 15:44:31 -05:00
|
|
|
|
|
|
|
|
@Get('explore')
|
2023-06-16 15:39:53 -04:00
|
|
|
getExploreData(@AuthUser() authUser: AuthUserDto): Promise<SearchExploreResponseDto[]> {
|
2023-03-24 00:53:56 -04:00
|
|
|
return this.service.getExploreData(authUser) as Promise<SearchExploreResponseDto[]>;
|
2023-03-05 15:44:31 -05:00
|
|
|
}
|
2023-03-02 21:47:08 -05:00
|
|
|
}
|