-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/accentsBackground
- Loading branch information
Showing
14 changed files
with
433 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,57 @@ | ||
import { Body, Controller, Get, Post, Put } from "@nestjs/common"; | ||
import { Body, Controller, Get, Post, Put, Query } from "@nestjs/common"; | ||
import { SearchService } from "../services/search.service"; | ||
|
||
@Controller("search") | ||
export class SearchController | ||
{ | ||
constructor(private readonly searchService: SearchService) | ||
{} | ||
|
||
// This endpoint is used to search for tracks by title. | ||
@Post("search") | ||
async searchByTitle(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchByTitle(title); | ||
} | ||
|
||
// This endpoint is used to search for albums based on their title. | ||
@Post("album") | ||
async searchByAlbum(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchByAlbum(title); | ||
} | ||
|
||
// This endpoint is used to get the details of a specific artist. | ||
@Post("artist") | ||
async searchForArtist(@Body() body: { artist: string }): Promise<any> | ||
{ | ||
const { artist } = body; | ||
return await this.searchService.artistSearch(artist); | ||
} | ||
|
||
// This endpoint is used to get the details of a specific album. | ||
@Post("album-info") | ||
async albumInfo(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchAlbums(title); | ||
} | ||
constructor(private readonly searchService: SearchService) | ||
{ | ||
} | ||
|
||
// This endpoint is used to search for tracks by title. | ||
@Post("search") | ||
async searchByTitle(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchByTitle(title); | ||
} | ||
|
||
// This endpoint is used to search for albums based on their title. | ||
@Post("album") | ||
async searchByAlbum(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchByAlbum(title); | ||
} | ||
|
||
// This endpoint is used to get the details of a specific artist. | ||
@Post("artist") | ||
async searchForArtist(@Body() body: { artist: string }): Promise<any> | ||
{ | ||
const { artist } = body; | ||
return await this.searchService.artistSearch(artist); | ||
} | ||
|
||
// This endpoint is used to get the details of a specific album. | ||
@Post("album-info") | ||
async albumInfo(@Body() body: { title: string }): Promise<any> | ||
{ | ||
const { title } = body; | ||
return await this.searchService.searchAlbums(title); | ||
} | ||
|
||
// This endpoint is used to get songs for a specific mood. | ||
@Get("mood") | ||
async getPlaylistByMood(@Query("mood") mood: string): Promise<any> | ||
{ | ||
return await this.searchService.getPlaylistSongsByMood(mood); | ||
} | ||
|
||
// This endpoint is used to get suggested moods and their corresponding songs. | ||
@Get("suggested-moods") | ||
async getSuggestedMoods(): Promise<any> | ||
{ | ||
return await this.searchService.getSuggestedMoods(); | ||
} | ||
|
||
} |
Oops, something went wrong.