Chat / backend /src /modules /social /social.controller.ts
kishankrish19's picture
Deploy Stillwave fullstack clean
b0798af
Raw History Blame Contribute Delete
1.53 kB
import {
Controller,
Get,
Post,
Delete,
Param,
UseGuards,
Req,
} from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { SocialService } from './social.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
@ApiTags('Social Graph')
@Controller('me/following')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
export class SocialController {
constructor(private readonly socialService: SocialService) {}
@Get()
@ApiOperation({ summary: 'List everything current user follows' })
getFollowing(@Req() req: any) {
return this.socialService.getFollowing(req.user.userId);
}
@Post('artists/:artistId')
@ApiOperation({ summary: 'Follow an artist' })
followArtist(@Req() req: any, @Param('artistId') artistId: string) {
return this.socialService.followArtist(req.user.userId, artistId);
}
@Delete('artists/:artistId')
@ApiOperation({ summary: 'Unfollow an artist' })
unfollowArtist(@Req() req: any, @Param('artistId') artistId: string) {
return this.socialService.unfollowArtist(req.user.userId, artistId);
}
@Post('users/:userId')
@ApiOperation({ summary: 'Follow a user' })
followUser(@Req() req: any, @Param('userId') userId: string) {
return this.socialService.followUser(req.user.userId, userId);
}
@Delete('users/:userId')
@ApiOperation({ summary: 'Unfollow a user' })
unfollowUser(@Req() req: any, @Param('userId') userId: string) {
return this.socialService.unfollowUser(req.user.userId, userId);
}
}