api-server/src/modules/users/users.controller.ts
WangDL 007b56dad5
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 1m0s
feat: AI三层架构 + 全局JwtAuthGuard + 12个Repository迁Prisma
- AI: 新三层架构 Provider→Gateway→Workflow(15文件,DeepSeek+MiniMax)
- Auth: 全局JwtAuthGuard + @Public()装饰器白名单路由
- DB: 12个Repository从Map/Array迁到Prisma
- Schema: 新增AiUsageLog、WaitlistEntry模型
- API: /api-docs-json加Basic Auth保护
- 清理: 删除infrastructure/ai、docs/旧文档

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:39:46 +08:00

32 lines
1.2 KiB
TypeScript

import { Controller, Get, Patch, Body } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth } from '@nestjs/swagger';
import { UsersService } from './users.service';
import { CurrentUser } from '../../common/decorators/current-user.decorator';
import type { UserPayload } from '../../common/types';
@ApiTags('users')
@Controller('users')
@ApiBearerAuth()
export class UsersController {
constructor(private readonly usersService: UsersService) {}
@Get('me')
@ApiOperation({ summary: '获取当前用户信息' })
@ApiResponse({ status: 200, description: '用户信息' })
async getProfile(@CurrentUser() user: UserPayload) {
return this.usersService.getProfile(String(user.id));
}
@Patch('me')
@ApiOperation({ summary: '更新用户资料' })
async updateProfile(@CurrentUser() user: UserPayload, @Body() body: any) {
return this.usersService.updateProfile(String(user.id), body);
}
@Patch('me/preferences')
@ApiOperation({ summary: '更新用户偏好' })
async updatePreferences(@CurrentUser() user: UserPayload, @Body() body: any) {
return this.usersService.updatePreferences(String(user.id), body);
}
}