refactor: 使用CurrentUser替代OSS中用的Req

This commit is contained in:
2025-12-19 19:37:08 +08:00
parent d8ccbcafc6
commit acc1e003e8

View File

@@ -1,6 +1,7 @@
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
import { Controller, Get, UseGuards } from '@nestjs/common';
import { OssService } from './oss.service';
import { AuthGuard } from 'src/auth/guards/auth.guard';
import { AuthUser, CurrentUser } from 'src/auth/decorator/current-user.decorator';
@Controller('oss')
export class OssController {
@@ -8,8 +9,8 @@ export class OssController {
@UseGuards(AuthGuard)
@Get('sts')
async getStsToken(@Request() req) {
const { userId } = req.user;
async getStsToken(@CurrentUser() user: AuthUser) {
const { userId } = user;
return {
...(await this.ossService.getStsToken(`${userId}`)),
userId,