feat: complete backend swagger annotations, admin pages pagination, and frontend application fixes

This commit is contained in:
parsa committed 2026-07-10 16:13:52 +03:30
1 parent 24137beb32
commit 2851ef8a25
41 files changed
+478 -128

No files matched your search

+10
View File
@@ -1,30 +1,40 @@
import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards, Request } from '@nestjs/common';
import { BlogsService } from './blogs.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { ApiTags, ApiBearerAuth, ApiOperation, ApiQuery } from '@nestjs/swagger';
@ApiTags('Admin - مدیریت مقالات (بلاگ)')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('admin/blogs')
export class BlogsController {
constructor(private readonly blogsService: BlogsService) {}
@Get()
@ApiOperation({ summary: 'لیست مقالات' })
@ApiQuery({ name: 'page', required: false, description: 'شماره صفحه' })
@ApiQuery({ name: 'limit', required: false, description: 'تعداد آیتم‌ها' })
@ApiQuery({ name: 'search', required: false, description: 'جستجو' })
async getBlogs(@Query() query: any) {
return this.blogsService.getBlogs(query);
}
@Post()
@ApiOperation({ summary: 'ایجاد مقاله جدید' })
async createBlog(@Body() body: any, @Request() req: any) {
const data = await this.blogsService.createBlog(body, req.user.id);
return { success: true, data };
}
@Put(':id')
@ApiOperation({ summary: 'ویرایش مقاله' })
async updateBlog(@Param('id') id: string, @Body() body: any) {
const data = await this.blogsService.updateBlog(id, body);
return { success: true, data };
}
@Delete(':id')
@ApiOperation({ summary: 'حذف مقاله' })
async deleteBlog(@Param('id') id: string) {
await this.blogsService.deleteBlog(id);
return { success: true };