Merge branch 'main' into feat/adc/search-view-v2

This commit is contained in:
Clément Le Bihan
2024-01-14 17:55:07 +01:00
committed by GitHub

View File

@@ -28,15 +28,15 @@ import { ArtistController } from "src/artist/artist.controller";
export class SearchController { export class SearchController {
constructor(private readonly searchService: SearchService) {} constructor(private readonly searchService: SearchService) {}
@Get("songs/:query") @Get("songs")
@ApiOkResponse({ type: _Song, isArray: true }) @ApiOkResponse({ type: _Song, isArray: true })
@ApiOperation({ description: "Search a song" }) @ApiOperation({ description: "Search a song" })
@ApiUnauthorizedResponse({ description: "Invalid token" }) @ApiUnauthorizedResponse({ description: "Invalid token" })
async searchSong( async searchSong(
@Request() req: any, @Request() req: any,
@Query("q") query: string | null, @Query("q") query: string | null,
@Query("artistId") artistId: number, @Query("artistId", new ParseIntPipe({ optional: true })) artistId: number,
@Query("genreId") genreId: number, @Query("genreId", new ParseIntPipe({ optional: true })) genreId: number,
@Query("include") include: string, @Query("include") include: string,
@Query("skip", new DefaultValuePipe(0), ParseIntPipe) skip: number, @Query("skip", new DefaultValuePipe(0), ParseIntPipe) skip: number,
@Query("take", new DefaultValuePipe(20), ParseIntPipe) take: number, @Query("take", new DefaultValuePipe(20), ParseIntPipe) take: number,
@@ -51,7 +51,7 @@ export class SearchController {
); );
} }
@Get("artists/:query") @Get("artists")
@UseGuards(JwtAuthGuard) @UseGuards(JwtAuthGuard)
@ApiOkResponse({ type: _Artist, isArray: true }) @ApiOkResponse({ type: _Artist, isArray: true })
@ApiUnauthorizedResponse({ description: "Invalid token" }) @ApiUnauthorizedResponse({ description: "Invalid token" })