Spaces:
Sleeping
Sleeping
Download backend/src/modules/library/library.controller.ts from kishankrish19/Chat: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/src/modules/library/library.controller.ts
- Command line
-
hf download hf://spaces/kishankrish19/Chat/backend/src/modules/library/library.controller.ts
-
curl -L -o library.controller.ts https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/src/modules/library/library.controller.ts
2.08 kB
| import { | |
| Controller, | |
| Get, | |
| Post, | |
| Delete, | |
| Param, | |
| UseGuards, | |
| Req, | |
| } from '@nestjs/common'; | |
| import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; | |
| import { LibraryService } from './library.service'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| ('Your Library') | |
| ('me/library') | |
| (JwtAuthGuard) | |
| () | |
| export class LibraryController { | |
| constructor(private readonly libraryService: LibraryService) {} | |
| ('tracks') | |
| ({ summary: 'Get Liked Songs list' }) | |
| getSavedTracks(() req: any) { | |
| return this.libraryService.getSavedTracks(req.user.userId); | |
| } | |
| ('tracks/:trackId') | |
| ({ summary: 'Save (like) a track' }) | |
| saveTrack(() req: any, ('trackId') trackId: string) { | |
| return this.libraryService.saveTrack(req.user.userId, trackId); | |
| } | |
| ('tracks/:trackId') | |
| ({ summary: 'Unsave (unlike) a track' }) | |
| unsaveTrack(() req: any, ('trackId') trackId: string) { | |
| return this.libraryService.unsaveTrack(req.user.userId, trackId); | |
| } | |
| ('albums') | |
| ({ summary: 'Get saved albums' }) | |
| getSavedAlbums(() req: any) { | |
| return this.libraryService.getSavedAlbums(req.user.userId); | |
| } | |
| ('albums/:albumId') | |
| ({ summary: 'Save an album' }) | |
| saveAlbum(() req: any, ('albumId') albumId: string) { | |
| return this.libraryService.saveAlbum(req.user.userId, albumId); | |
| } | |
| ('albums/:albumId') | |
| ({ summary: 'Unsave an album' }) | |
| unsaveAlbum(() req: any, ('albumId') albumId: string) { | |
| return this.libraryService.unsaveAlbum(req.user.userId, albumId); | |
| } | |
| ('artists') | |
| ({ summary: 'Get followed artists' }) | |
| getFollowedArtists(() req: any) { | |
| return this.libraryService.getFollowedArtists(req.user.userId); | |
| } | |
| ('playlists') | |
| ({ summary: 'Get owned & followed playlists' }) | |
| getUserPlaylists(() req: any) { | |
| return this.libraryService.getUserPlaylists(req.user.userId); | |
| } | |
| } | |