Chat / backend /src /modules /search /search.controller.ts
kishankrish19's picture
Deploy Stillwave fullstack clean
b0798af
Raw History Blame Contribute Delete
898 Bytes
import { Controller, Get, Query } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { SearchService } from './search.service';
@ApiTags('Search & Browse')
@Controller()
export class SearchController {
constructor(private readonly searchService: SearchService) {}
@Get('search')
@ApiOperation({
summary:
'Full-text + fuzzy search across tracks, artists, albums, playlists',
})
search(@Query('q') q: string, @Query('type') type?: string) {
return this.searchService.search(q || '', type);
}
@Get('search/suggest')
@ApiOperation({ summary: 'Type-ahead search suggestions' })
suggest(@Query('q') q: string) {
return this.searchService.suggest(q || '');
}
@Get('browse/categories')
@ApiOperation({ summary: 'Genre & mood browse category tiles' })
getCategories() {
return this.searchService.getCategories();
}
}