36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { Controller, Get, Param, HttpStatus, Query } from '@nestjs/common';
|
|
import { WikiService } from './wiki.service';
|
|
import {
|
|
ApiTags,
|
|
ApiOperation,
|
|
ApiResponse,
|
|
ApiOkResponse,
|
|
ApiNotFoundResponse,
|
|
} from '@nestjs/swagger';
|
|
import { PaginationDto } from '../common/dto/pagination.dto';
|
|
|
|
@ApiTags('Wiki - دانشنامه ترکیبات')
|
|
@Controller('wiki')
|
|
@ApiResponse({
|
|
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
description: 'خطای داخلی سرور',
|
|
})
|
|
export class WikiController {
|
|
constructor(private readonly wikiService: WikiService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'دریافت تمام کلمات دانشنامه' })
|
|
@ApiOkResponse({ description: 'لیست کلمات به همراه توضیحات (صفحهبندی شده)' })
|
|
findAll(@Query() query: PaginationDto) {
|
|
return this.wikiService.findAll(query);
|
|
}
|
|
|
|
@Get(':key')
|
|
@ApiOperation({ summary: 'دریافت ترکیب علمی با کلید' })
|
|
@ApiOkResponse({ description: 'اطلاعات کامل ترکیب علمی' })
|
|
@ApiNotFoundResponse({ description: 'ترکیب علمی یافت نشد' })
|
|
findOne(@Param('key') key: string) {
|
|
return this.wikiService.findOneByKey(key);
|
|
}
|
|
}
|