fix: update revokeToken method to use @Param decorator for token retrieval

This commit is contained in:
lborv
2025-10-27 20:07:26 +02:00
parent 1a2d7b20c0
commit 9080f193c1
2 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import {
Controller,
Delete,
Inject,
Param,
Post,
UseGuards,
} from "@nestjs/common";
@ -28,8 +29,8 @@ export class ApiController {
return this.apiService.generateToken(body.id);
}
@Delete("token/revoke")
revokeToken(@Body() body: { token: string }) {
return this.apiService.revokeToken(body.token);
@Delete("token/revoke/:token")
revokeToken(@Param("token") token: string) {
return this.apiService.revokeToken(token);
}
}

View File

@ -24,6 +24,7 @@ export class ProjectController {
) {}
@Put("create")
@UseGuards(AdminGuard)
createProject(@Body() body: { name: string }) {
return this.projectService.create(body.name);
}
@ -63,6 +64,5 @@ export class ProjectController {
@UseGuards(AdminGuard)
getAllApiTokens(@Req() req: Request & { apiToken: { id: string } }) {
return this.projectService.getAllApiTokens(req.apiToken.id);
}
}
}
}