fix: resolve 3 review findings (permission codes, profile guard, JSDoc)

This commit is contained in:
2026-07-02 12:22:49 +08:00
parent 75acb5c7a2
commit ef645c0f40
85 changed files with 15566 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ export class AuthController {
}
}
@Public()
@UseGuards(JwtAuthGuard)
@Get('profile')
getProfile(@Request() req: any) {

View File

@@ -4,8 +4,8 @@ export const PERMISSION_KEY = 'permissions';
/**
* 声明接口所需权限。
* 多次调用 = AND 逻辑(需要同时满足所有组);
* 单次调用多个参数 = OR 逻辑(满足其中一个即可)
* 多个参数之间为 OR 关系(用户拥有其中任一权限即可通过)。
* 不支持 AND 语义:多次调用装饰器会被全局 PermissionGuard 合并为扁平数组,效果等同于单次多参数调用
*/
export const RequirePermission = (...permissions: string[]) =>
SetMetadata(PERMISSION_KEY, permissions);

View File

@@ -20,6 +20,7 @@ const PRESET_PERMISSIONS: Array<{ code: string; name: string; group: string }> =
{ code: 'occupancy:checkin', name: '办理入住', group: 'occupancy' },
{ code: 'occupancy:checkout', name: '办理退宿', group: 'occupancy' },
{ code: 'occupancy:transfer', name: '调换宿舍', group: 'occupancy' },
{ code: 'occupancy:delete', name: '删除入住记录', group: 'occupancy' },
{ code: 'expense:view', name: '查看费用', group: 'expense' },
{ code: 'expense:create', name: '录入费用', group: 'expense' },
{ code: 'expense:edit', name: '编辑费用', group: 'expense' },