Skip to content

Commit

Permalink
Merge branch 'develop' into feat/accentsBackground
Browse files Browse the repository at this point in the history
  • Loading branch information
21434809 authored Sep 26, 2024
2 parents b821e45 + 156a22a commit 52ba53c
Show file tree
Hide file tree
Showing 14 changed files with 433 additions and 347 deletions.
86 changes: 51 additions & 35 deletions Backend/src/search/controller/search.controller.ts
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();
}

}
Loading

0 comments on commit 52ba53c

Please sign in to comment.