forked from datawhale/whale-town-end
feat: 完善管理员系统和用户管理模块
- 更新管理员控制器和数据库管理功能 - 完善管理员操作日志系统 - 添加全面的属性测试覆盖 - 优化用户管理和用户档案服务 - 更新代码检查规范文档 功能改进: - 增强管理员权限验证 - 完善操作日志记录 - 优化数据库管理接口 - 提升系统安全性和可维护性
This commit is contained in:
@@ -64,7 +64,11 @@ import {
|
||||
AdminUpdateUserDto,
|
||||
AdminBatchUpdateStatusDto,
|
||||
AdminDatabaseResponseDto,
|
||||
AdminHealthCheckResponseDto
|
||||
AdminHealthCheckResponseDto,
|
||||
AdminCreateUserProfileDto,
|
||||
AdminUpdateUserProfileDto,
|
||||
AdminCreateZulipAccountDto,
|
||||
AdminUpdateZulipAccountDto
|
||||
} from './admin_database.dto';
|
||||
import { PAGINATION_LIMITS, REQUEST_ID_PREFIXES } from './admin_constants';
|
||||
import { safeLimitValue, createSuccessResponse, getCurrentTimestamp } from './admin_utils';
|
||||
@@ -239,12 +243,12 @@ export class AdminDatabaseController {
|
||||
summary: '创建用户档案',
|
||||
description: '为指定用户创建档案信息'
|
||||
})
|
||||
@ApiBody({ type: 'AdminCreateUserProfileDto', description: '用户档案创建数据' })
|
||||
@ApiBody({ type: AdminCreateUserProfileDto, description: '用户档案创建数据' })
|
||||
@ApiResponse({ status: 201, description: '创建成功' })
|
||||
@ApiResponse({ status: 400, description: '请求参数错误' })
|
||||
@ApiResponse({ status: 409, description: '用户档案已存在' })
|
||||
@Post('user-profiles')
|
||||
async createUserProfile(@Body() createProfileDto: any): Promise<AdminApiResponse> {
|
||||
async createUserProfile(@Body() createProfileDto: AdminCreateUserProfileDto): Promise<AdminApiResponse> {
|
||||
return await this.databaseManagementService.createUserProfile(createProfileDto);
|
||||
}
|
||||
|
||||
@@ -253,13 +257,13 @@ export class AdminDatabaseController {
|
||||
description: '根据档案ID更新用户档案信息'
|
||||
})
|
||||
@ApiParam({ name: 'id', description: '档案ID', example: '1' })
|
||||
@ApiBody({ type: 'AdminUpdateUserProfileDto', description: '用户档案更新数据' })
|
||||
@ApiBody({ type: AdminUpdateUserProfileDto, description: '用户档案更新数据' })
|
||||
@ApiResponse({ status: 200, description: '更新成功' })
|
||||
@ApiResponse({ status: 404, description: '档案不存在' })
|
||||
@Put('user-profiles/:id')
|
||||
async updateUserProfile(
|
||||
@Param('id') id: string,
|
||||
@Body() updateProfileDto: any
|
||||
@Body() updateProfileDto: AdminUpdateUserProfileDto
|
||||
): Promise<AdminApiResponse> {
|
||||
return await this.databaseManagementService.updateUserProfile(BigInt(id), updateProfileDto);
|
||||
}
|
||||
@@ -320,12 +324,12 @@ export class AdminDatabaseController {
|
||||
summary: '创建Zulip账号关联',
|
||||
description: '创建游戏用户与Zulip账号的关联'
|
||||
})
|
||||
@ApiBody({ type: 'AdminCreateZulipAccountDto', description: 'Zulip账号关联创建数据' })
|
||||
@ApiBody({ type: AdminCreateZulipAccountDto, description: 'Zulip账号关联创建数据' })
|
||||
@ApiResponse({ status: 201, description: '创建成功' })
|
||||
@ApiResponse({ status: 400, description: '请求参数错误' })
|
||||
@ApiResponse({ status: 409, description: '关联已存在' })
|
||||
@Post('zulip-accounts')
|
||||
async createZulipAccount(@Body() createAccountDto: any): Promise<AdminApiResponse> {
|
||||
async createZulipAccount(@Body() createAccountDto: AdminCreateZulipAccountDto): Promise<AdminApiResponse> {
|
||||
return await this.databaseManagementService.createZulipAccount(createAccountDto);
|
||||
}
|
||||
|
||||
@@ -334,13 +338,13 @@ export class AdminDatabaseController {
|
||||
description: '根据关联ID更新Zulip账号关联信息'
|
||||
})
|
||||
@ApiParam({ name: 'id', description: '关联ID', example: '1' })
|
||||
@ApiBody({ type: 'AdminUpdateZulipAccountDto', description: 'Zulip账号关联更新数据' })
|
||||
@ApiBody({ type: AdminUpdateZulipAccountDto, description: 'Zulip账号关联更新数据' })
|
||||
@ApiResponse({ status: 200, description: '更新成功' })
|
||||
@ApiResponse({ status: 404, description: '关联不存在' })
|
||||
@Put('zulip-accounts/:id')
|
||||
async updateZulipAccount(
|
||||
@Param('id') id: string,
|
||||
@Body() updateAccountDto: any
|
||||
@Body() updateAccountDto: AdminUpdateZulipAccountDto
|
||||
): Promise<AdminApiResponse> {
|
||||
return await this.databaseManagementService.updateZulipAccount(id, updateAccountDto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user