Spaces:
Sleeping
Sleeping
Download backend/src/modules/artists/artists.controller.ts from kishankrish19/Chat: direct link, hf CLI and curl.
- Browser
- Download file 2.06 kB
-
https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/src/modules/artists/artists.controller.ts
- Command line
-
hf download hf://spaces/kishankrish19/Chat/backend/src/modules/artists/artists.controller.ts
-
curl -L -o artists.controller.ts https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/backend/src/modules/artists/artists.controller.ts
2.06 kB
| import { | |
| Controller, | |
| Get, | |
| Post, | |
| Patch, | |
| Param, | |
| Body, | |
| UseGuards, | |
| } from '@nestjs/common'; | |
| import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; | |
| import { ArtistsService } from './artists.service'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| ('Artists') | |
| ('artists') | |
| export class ArtistsController { | |
| constructor(private readonly artistsService: ArtistsService) {} | |
| (':id') | |
| ({ summary: 'Get artist profile & monthly listener count' }) | |
| getArtistById(('id') id: string) { | |
| return this.artistsService.findOne(id); | |
| } | |
| (':id/albums') | |
| ({ summary: 'List artist discography (albums, EPs, singles)' }) | |
| getArtistAlbums(('id') id: string) { | |
| return this.artistsService.getAlbums(id); | |
| } | |
| (':id/top-tracks') | |
| ({ summary: 'Get top 10 tracks by play_count' }) | |
| getArtistTopTracks(('id') id: string) { | |
| return this.artistsService.getTopTracks(id); | |
| } | |
| (':id/related') | |
| ({ summary: 'Get related artists via pgvector similarity' }) | |
| getRelatedArtists(('id') id: string) { | |
| return this.artistsService.getRelated(id); | |
| } | |
| () | |
| (JwtAuthGuard) | |
| () | |
| ({ summary: 'Create new artist profile (onboarding)' }) | |
| createArtist( | |
| () dto: { name: string; bio?: string; image_url?: string }, | |
| ) { | |
| return this.artistsService.create(dto); | |
| } | |
| (':id') | |
| (JwtAuthGuard) | |
| () | |
| ({ summary: 'Update artist bio, image, or name' }) | |
| updateArtist( | |
| ('id') id: string, | |
| () dto: { name?: string; bio?: string; image_url?: string }, | |
| ) { | |
| return this.artistsService.update(id, dto); | |
| } | |
| (':id/monthly-listeners') | |
| (JwtAuthGuard) | |
| () | |
| ({ | |
| summary: 'Time-series monthly listener counts for artist dashboard', | |
| }) | |
| getMonthlyListeners(('id') id: string) { | |
| return this.artistsService.getMonthlyListenersTimeSeries(id); | |
| } | |
| } | |