feat: api keys

This commit is contained in:
Ahmed Bouhuolia
2025-07-01 23:05:58 +02:00
parent 9f6e9e85a5
commit 84cb7693c8
16 changed files with 266 additions and 8 deletions

View File

@@ -0,0 +1,26 @@
import { Controller, Post, Param, Get } from '@nestjs/common';
import { GenerateApiKey } from './commands/GenerateApiKey.service';
import { GetApiKeysService } from './queries/GetApiKeys.service';
@Controller('api-keys')
export class AuthApiKeysController {
constructor(
private readonly getApiKeysService: GetApiKeysService,
private readonly generateApiKeyService: GenerateApiKey,
) {}
@Post('generate')
async generate() {
return this.generateApiKeyService.generate();
}
@Post(':id/revoke')
async revoke(@Param('id') id: number) {
return this.generateApiKeyService.revoke(id);
}
@Get()
async getApiKeys() {
return this.getApiKeysService.getApiKeys();
}
}