Chat / backend /src /modules /recommendations /recommendations.controller.ts
kishankrish19's picture
Deploy Stillwave fullstack clean
b0798af
Raw History Blame Contribute Delete
1.58 kB
import { Controller, Get, Param, UseGuards, Req } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { RecommendationsService } from './recommendations.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
@ApiTags('Recommendation Engine')
@Controller('me/recommendations')
export class RecommendationsController {
constructor(private readonly recsService: RecommendationsService) {}
@Get('home')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@ApiOperation({
summary: 'Home feed shelves: Recently Played, Made For You, Popular Albums',
})
getHomeShelves(@Req() req: any) {
return this.recsService.getHomeShelves(req.user.userId);
}
@Get('discover-weekly')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@ApiOperation({
summary: 'Weekly personalized mix generated via pgvector similarity',
})
getDiscoverWeekly(@Req() req: any) {
return this.recsService.getDiscoverWeekly(req.user.userId);
}
@Get('tracks/:id/related')
@ApiOperation({ summary: 'Related tracks (Fans also like) via pgvector' })
getRelatedTracks(@Param('id') id: string) {
return this.recsService.getRelatedTracks(id);
}
@Get('radio/:seedType/:seedId')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@ApiOperation({
summary: 'Infinite radio queue seeded from a track, artist, or playlist',
})
getRadio(
@Req() req: any,
@Param('seedType') seedType: string,
@Param('seedId') seedId: string,
) {
return this.recsService.getRadio(req.user.userId, seedType, seedId);
}
}