هذا الالتزام موجود في:
2026-04-20 15:12:16 +03:00
التزام 28f7241bcd
172 ملفات معدلة مع 21907 إضافات و0 حذوفات

عرض الملف

@@ -0,0 +1,52 @@
import { Body, Controller, Get, Param, Post, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { CurrentUser } from '../../common/decorators/current-user.decorator';
import { Throttle } from '../../common/decorators/throttle.decorator';
import { PaginationQueryDto } from '../../common/dto/pagination-query.dto';
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
import { JwtPayload } from '../../common/interfaces/jwt-payload.interface';
import { ToggleFollowDto } from './dto/toggle-follow.dto';
import { FollowsService } from './follows.service';
@ApiTags('Follows')
@Controller('follows')
export class FollowsController {
constructor(private readonly followsService: FollowsService) {}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post('toggle')
@Throttle(30, 60_000)
async toggleFollow(@CurrentUser() user: JwtPayload, @Body() dto: ToggleFollowDto) {
return this.followsService.toggleFollow(user.sub, dto);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('followers/:userId')
async followers(@Param('userId') userId: string, @Query() query: PaginationQueryDto) {
return this.followsService.getFollowers(userId, query.page, query.limit);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('following/:userId')
async following(@Param('userId') userId: string, @Query() query: PaginationQueryDto) {
return this.followsService.getFollowing(userId, query.page, query.limit);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('status/:targetUserId')
async status(@CurrentUser() user: JwtPayload, @Param('targetUserId') targetUserId: string) {
return this.followsService.getFollowStatus(user.sub, targetUserId);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('suggestions')
@Throttle(60, 60_000)
async suggestions(@CurrentUser() user: JwtPayload, @Query() query: PaginationQueryDto) {
return this.followsService.getSuggestions(user.sub, query.page, query.limit);
}
}