feat: complete backend swagger annotations, admin pages pagination, and frontend application fixes
This commit is contained in:
1 parent
24137beb32
commit
2851ef8a25
41 files changed
+478
-128
No files matched your search
@@ -1,30 +1,40 @@
|
||||
import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards } from '@nestjs/common';
|
||||
import { WikiService } from './wiki.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import { ApiTags, ApiBearerAuth, ApiOperation, ApiQuery } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Admin - مدیریت دانشنامه (اصطلاحات علمی)')
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('admin/wiki')
|
||||
export class WikiController {
|
||||
constructor(private readonly wikiService: WikiService) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'لیست اصطلاحات دانشنامه' })
|
||||
@ApiQuery({ name: 'page', required: false, description: 'شماره صفحه' })
|
||||
@ApiQuery({ name: 'limit', required: false, description: 'تعداد آیتمها' })
|
||||
@ApiQuery({ name: 'search', required: false, description: 'جستجو' })
|
||||
async getTerms(@Query() query: any) {
|
||||
return this.wikiService.getTerms(query);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'ایجاد اصطلاح جدید' })
|
||||
async createTerm(@Body() body: any) {
|
||||
const data = await this.wikiService.createTerm(body);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Put(':key')
|
||||
@ApiOperation({ summary: 'ویرایش اصطلاح' })
|
||||
async updateTerm(@Param('key') key: string, @Body() body: any) {
|
||||
const data = await this.wikiService.updateTerm(key, body);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Delete(':key')
|
||||
@ApiOperation({ summary: 'حذف اصطلاح' })
|
||||
async deleteTerm(@Param('key') key: string) {
|
||||
await this.wikiService.deleteTerm(key);
|
||||
return { success: true };
|
||||
|
||||
Reference in new issue
Block a user