|
|
@@ -18,10 +18,16 @@ import { PageResult } from '../../core/vo/page-result';
|
|
|
import { PageResultMapper } from '../../core/mapper/page-result.mapper';
|
|
|
import { ArticleSearchRecordMapper } from '../mapper/article-search-record.mapper';
|
|
|
import { ArticleSearchRecordVo } from '../vo/article-search-record.vo';
|
|
|
+import { ArticleSearchRecommendMapper } from '../mapper/article-search-recommend.mapper';
|
|
|
+import { ArticleSearchRecommendVo } from '../vo/article-search-recommend.vo';
|
|
|
+import { CreateArticleSearchRecommendRequest } from '../dto/create-article-search-recommend.request';
|
|
|
|
|
|
@Controller('articles')
|
|
|
export class ArticleController {
|
|
|
- constructor(private readonly articleService: ArticleService) {}
|
|
|
+ constructor(
|
|
|
+ private readonly articleService: ArticleService,
|
|
|
+ private readonly articleSearchRecommendMapper: ArticleSearchRecommendMapper,
|
|
|
+ ) {}
|
|
|
@Post()
|
|
|
@ApiBearerAuth()
|
|
|
@ApiOkResponse({
|
|
|
@@ -65,12 +71,12 @@ export class ArticleController {
|
|
|
@Get('search-records')
|
|
|
@ApiBearerAuth()
|
|
|
@ApiOkResponse({
|
|
|
- description: '查询列表',
|
|
|
+ description: '历史关键词列表',
|
|
|
schema: {
|
|
|
allOf: [
|
|
|
{
|
|
|
type: 'array',
|
|
|
- items: { $ref: getSchemaPath(ArticleVo) }, // 泛型内容具体化
|
|
|
+ items: { $ref: getSchemaPath(ArticleSearchRecordVo) }, // 泛型内容具体化
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
@@ -81,6 +87,36 @@ export class ArticleController {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ @Get('active-search-recommends')
|
|
|
+ @ApiBearerAuth()
|
|
|
+ @ApiOkResponse({
|
|
|
+ description: '推荐关键词',
|
|
|
+ type: ArticleSearchRecommendVo, // 单个对象
|
|
|
+ isArray: true, // 指定返回值是数组
|
|
|
+ })
|
|
|
+ async activeArticleSearchRecommends() {
|
|
|
+ return this.articleSearchRecommendMapper.toVos(
|
|
|
+ await this.articleService.activeArticleSearchRecommends(),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @Post('search-recommends')
|
|
|
+ @ApiBearerAuth()
|
|
|
+ @ApiOkResponse({
|
|
|
+ description: '创建推荐关键词',
|
|
|
+ type: ArticleSearchRecommendVo,
|
|
|
+ })
|
|
|
+ async createArticleSearchRecommend(
|
|
|
+ @Body()
|
|
|
+ createArticleSearchRecommendRequest: CreateArticleSearchRecommendRequest,
|
|
|
+ ) {
|
|
|
+ return this.articleSearchRecommendMapper.toVo(
|
|
|
+ await this.articleService.createArticleSearchRecommend(
|
|
|
+ createArticleSearchRecommendRequest,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
@Get(':id')
|
|
|
@ApiBearerAuth()
|
|
|
@ApiOkResponse({
|