chore(comment): 注释改为英文

This commit is contained in:
dayjoy
2025-09-30 14:27:53 +08:00
parent 2651bd1373
commit 2341e36aa9
11 changed files with 41 additions and 45 deletions

View File

@@ -40,9 +40,9 @@ export const getGroupMembers = async (groupId: number, token: string): Promise<U
@Tags('Chat Group')
export class GroupController extends Controller {
/**
* 获取当前聊天群组的全部用户信息
* @summary 获取当前聊天群组的全部用户信息
* @description 获取当前聊天群组的全部用户信息
* Get all users in the current chat group
* @summary Get group members
* @description Returns the full member list of the current chat group
*/
@Get('/members')
@Security("jwt")
@@ -65,4 +65,4 @@ export class GroupController extends Controller {
data: users,
};
}
}
}

View File

@@ -5,9 +5,9 @@ import type { ApiResponse } from '../types/api';
@Tags('Test')
export class TestController extends Controller {
/**
* 测试接口
* @summary 测试接口
* @description 用于测试API连通性的基础接口
* Test endpoint
* @summary Test endpoint
* @description Basic endpoint to verify API connectivity
*/
@Get('/test')
@Response<ApiResponse>(200, 'Success')

View File

@@ -8,9 +8,9 @@ import type {UserInfo} from "../types/user";
@Tags('User')
export class UserController extends Controller {
/**
* 获取当前用户的信息
* @summary 获取当前用户的信息
* @description 获取当前用户的信息
* Get current user information
* @summary Get current user information
* @description Returns the authenticated user's profile
*/
@Get('/info')
@Security('jwt')
@@ -24,4 +24,4 @@ export class UserController extends Controller {
data: rest
};
}
}
}

View File

@@ -10,7 +10,7 @@ dotenv.config({ path: path.resolve(__dirname, "../../../.env") });
import "./database";
import { sequelize } from "./database/instance";
import {errorHandler} from "./middleware/errorHandler";
import {RegisterTsoaRoutes} from "./middleware/tsoa.middleware"; // tsoa 生成的
import {RegisterTsoaRoutes} from "./middleware/tsoa.middleware";
const port = process.env.PORT || 3005;

View File

@@ -16,7 +16,7 @@ export async function expressAuthentication(
throw new ApiError(401, "Unauthorized");
}
// 返回的对象会挂到 request.user
// Returned object is assigned to request.user
return await getUserInfoByToken(token);
}
throw new ApiError(401, "Unsupported security scheme");
@@ -45,7 +45,7 @@ export const getUserInfoByToken = async (token: string): Promise<UserInfo> => {
try {
const response = await axios.post<ApiResponse<Omit<UserInfo, 'token'>>>(
"https://egret.byteawake.com/api/user/info",
{}, // 请求体数据,这里为空对象
{}, // Empty request body
{
headers: {
Authorization: `Bearer ${token}`,
@@ -74,4 +74,3 @@ export const getUserInfoByToken = async (token: string): Promise<UserInfo> => {
};

View File

@@ -8,7 +8,7 @@ export function errorHandler(err: any, req: Request, res: Response, next: NextFu
return res.status(err.status).json({code: err.status, message: err.message, data: null});
}
// tsoa 内部生成的验证错误
// Validation errors generated by tsoa
if (err.status && err.status >= 400) {
return res.status(err.status).json({ message: err.message });
}

View File

@@ -2,11 +2,11 @@ import swaggerUi from 'swagger-ui-express';
import path from 'path';
export function RegisterTsoaRoutes(app: any) {
// Register tsoa routes - 动态导入以避免编译时错误
// Register tsoa routes via dynamic import to avoid compile-time errors
const { RegisterRoutes } = require('../routes/routes');
RegisterRoutes(app);
// Serve swagger documentation - 动态导入swagger文档
// Serve swagger documentation (dynamic import)
const swaggerDocument = require(path.join(__dirname, '../swagger.json'));
app.use('/v3/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
}