Skip to content

Commit 5b6e432

Browse files
committed
perf(app): add the missing interface prompts
1 parent 7402388 commit 5b6e432

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

src/app.controller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Controller, Get, UseInterceptors } from "@nestjs/common";
2-
import { ApiTags } from "@nestjs/swagger";
2+
import { ApiOperation, ApiTags } from "@nestjs/swagger";
33
import { AllowAllCorsInterceptor } from "./common/interceptors/allow-all-cors.interceptor";
44
import PKG from "../package.json";
55

@@ -8,6 +8,7 @@ import PKG from "../package.json";
88
export class AppController {
99
@UseInterceptors(AllowAllCorsInterceptor)
1010
@Get(["/", "/info"])
11+
@ApiOperation({ summary: "获取服务端版本等信息" })
1112
async appInfo() {
1213
return {
1314
name: PKG.name,
@@ -18,6 +19,7 @@ export class AppController {
1819
};
1920
}
2021
@Get(["/ping"])
22+
@ApiOperation({ summary: "测试接口是否存活" })
2123
ping(): "pong" {
2224
return "pong";
2325
}

src/modules/comments/comments.controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class CommentController {
4444

4545
@Get("/")
4646
// @Auth()
47+
@ApiOperation({ summary: "获取评论列表" })
4748
async getRecentlyComments(@Query() query: PagerDto) {
4849
const { size = 10, page = 1, status = 0 } = query;
4950
return transformDataToPaginate(
@@ -127,6 +128,7 @@ export class CommentController {
127128
}
128129

129130
@Post("/reply/:id")
131+
@ApiOperation({ summary: "回复评论" })
130132
@ApiParam({
131133
name: "id",
132134
description: "cid",

src/modules/configs/configs.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
* @author: Wibus
44
* @Date: 2022-08-02 23:41:21
55
* @LastEditors: Wibus
6-
* @LastEditTime: 2022-08-03 00:04:59
6+
* @LastEditTime: 2022-08-21 11:19:20
77
* Coding With IU
88
*/
99

1010
import { Body, Controller, Get, Patch } from "@nestjs/common";
11+
import { ApiOperation } from "@nestjs/swagger";
1112
import { instanceToPlain } from "class-transformer";
1213
import { ApiName } from "~/common/decorator/openapi.decorator";
1314
import { ConfigsInterfaceKeys } from "./configs.interface";
@@ -19,6 +20,7 @@ export class ConfigsController {
1920
constructor(private readonly configsService: ConfigsService) {}
2021

2122
@Get("/")
23+
@ApiOperation({ summary: "获取配置" })
2224
async getOption() {
2325
const configs = await this.configsService.getAllConfigs();
2426
let result = {};
@@ -32,6 +34,7 @@ export class ConfigsController {
3234
}
3335

3436
@Patch("/")
37+
@ApiOperation({ summary: "更新配置" })
3538
async updateOption(@Body() body: any) {
3639
for (const key in body) {
3740
// 将 key 转换为驼峰式

src/modules/markdown/markdown.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Query,
1010
Res,
1111
} from "@nestjs/common";
12-
import { ApiProperty } from "@nestjs/swagger";
12+
import { ApiOperation } from "@nestjs/swagger";
1313
import { Auth } from "~/common/decorator/auth.decorator";
1414
import { HTTPDecorators } from "~/common/decorator/http.decorator";
1515
import { ApiName } from "~/common/decorator/openapi.decorator";
@@ -26,7 +26,7 @@ export class MarkdownController {
2626

2727
@Post("/export")
2828
@Auth()
29-
@ApiProperty({ description: "导出部分 Markdown 文件" })
29+
@ApiOperation({ summary: "导出部分 Markdown 文件" })
3030
@HTTPDecorators.Bypass
3131
async exportSomeMarkdowns(
3232
@Query() { showTitle, slug, yaml }: ExportMarkdownDto,
@@ -124,7 +124,7 @@ export class MarkdownController {
124124

125125
@Get("/export/all")
126126
@Auth()
127-
@ApiProperty({ description: "导出 Markdown YAML 数据" })
127+
@ApiOperation({ summary: "导出 Markdown YAML 数据" })
128128
@HTTPDecorators.Bypass
129129
@Header("Content-Type", "application/zip")
130130
@Header("Content-Disposition", "attachment; filename=markdown.zip")
@@ -192,7 +192,7 @@ export class MarkdownController {
192192

193193
@Post("/import")
194194
@Auth()
195-
@ApiProperty({ description: "导入 Markdown YAML 数据" })
195+
@ApiOperation({ summary: "导入 Markdown YAML 数据" })
196196
async importMarkdownData(@Body() body: ImportMarkdownDto) {
197197
const type = body.type;
198198

src/modules/post/post.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { PostService } from "./post.service";
1515
import { Paginator } from "~/common/decorator/http.decorator";
1616
import { ApiName } from "~/common/decorator/openapi.decorator";
1717
import { PagerDto } from "~/shared/dto/pager.dto";
18-
import { addYearCondition } from "~/transformers/db-query.transformer";
1918
import { ApiOperation } from "@nestjs/swagger";
2019
import { CategoryAndSlugDto } from "./post.dto";
2120
import { CannotFindException } from "~/common/exceptions/cant-find.exception";
@@ -156,6 +155,7 @@ export class PostController {
156155
}
157156

158157
@Get("/_like")
158+
@ApiOperation({ summary: "点赞文章" })
159159
async thumbsUpArticle(
160160
@Query() query: MongoIdDto,
161161
@IpLocation() location: IpRecord

0 commit comments

Comments
 (0)