feat: 明确OperationId

This commit is contained in:
dayjoy
2025-10-11 14:20:29 +08:00
parent 7f057a50ca
commit 99c8fa5f2d
3 changed files with 6 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import {Controller, Get, Route, Response, Tags, Request, Security} from 'tsoa'; import {Controller, Get, Route, Response, Tags, Request, Security, OperationId} from 'tsoa';
import {ApiError, ApiResponse} from '../types/api'; import {ApiError, ApiResponse} from '../types/api';
import type {Request as ExpressRequest} from 'express'; import type {Request as ExpressRequest} from 'express';
import axios from "axios"; import axios from "axios";
@@ -45,6 +45,7 @@ export class GroupController extends Controller {
* @description Returns the full member list of the current chat group * @description Returns the full member list of the current chat group
*/ */
@Get('/members') @Get('/members')
@OperationId('Group_GetGroupMembers') // MUST: Specify operationId for better API documentation
@Security("jwt") @Security("jwt")
@Response<ApiResponse<UserInfo[]>>(200, 'Success') @Response<ApiResponse<UserInfo[]>>(200, 'Success')
@Response<ApiResponse<null>>(400, 'Bad Request') @Response<ApiResponse<null>>(400, 'Bad Request')

View File

@@ -1,4 +1,4 @@
import { Controller, Get, Route, Response, Tags } from 'tsoa'; import {Controller, Get, Route, Response, Tags, OperationId} from 'tsoa';
import type { ApiResponse } from '../types/api'; import type { ApiResponse } from '../types/api';
@Route('api') @Route('api')
@@ -10,6 +10,7 @@ export class TestController extends Controller {
* @description Basic endpoint to verify API connectivity * @description Basic endpoint to verify API connectivity
*/ */
@Get('/test') @Get('/test')
@OperationId('Test_GetTest') // MUST: Specify operationId for better API documentation
@Response<ApiResponse>(200, 'Success') @Response<ApiResponse>(200, 'Success')
public async getTest(): Promise<ApiResponse> { public async getTest(): Promise<ApiResponse> {
return { return {

View File

@@ -1,4 +1,4 @@
import {Controller, Get, Route, Response, Tags, Middlewares, Request, Security} from 'tsoa'; import {Controller, Get, Route, Response, Tags, Middlewares, Request, Security, OperationId} from 'tsoa';
import type { ApiResponse } from '../types/api'; import type { ApiResponse } from '../types/api';
import type { Request as ExpressRequest } from 'express'; import type { Request as ExpressRequest } from 'express';
import type {UserInfo} from "../types/user"; import type {UserInfo} from "../types/user";
@@ -13,6 +13,7 @@ export class UserController extends Controller {
* @description Returns the authenticated user's profile * @description Returns the authenticated user's profile
*/ */
@Get('/info') @Get('/info')
@OperationId('User_GetUserGroupInfo') // MUST: Specify operationId for better API documentation
@Security('jwt') @Security('jwt')
@Response<ApiResponse<UserInfo>>(200, 'Success') @Response<ApiResponse<UserInfo>>(200, 'Success')
@Response(401, 'Unauthorized') @Response(401, 'Unauthorized')