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

View File

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