This commit is contained in:
Bastian Wagner
2024-10-23 13:58:14 +02:00
parent d4ddcafd2b
commit b453945183
33 changed files with 570 additions and 19 deletions

View File

@@ -1,7 +1,10 @@
import {
Body,
Controller,
Delete,
Get,
HttpException,
HttpStatus,
Param,
Post,
Put,
@@ -13,7 +16,6 @@ import { AuthenticatedRequest } from 'src/model/interface/authenticated-request.
import { AuthGuard } from 'src/core/guards/auth.guard';
import { Key } from 'src/model/entitites';
import { CreateKeySystemDto } from 'src/model/dto/create-key-system.dto';
import { HandoverKeyDto } from 'src/model/dto';
@UseGuards(AuthGuard)
@Controller('key')
@@ -25,11 +27,26 @@ export class KeyController {
return this.service.getUsersKeys(req.user);
}
@Post()
postKey(@Req() req: AuthenticatedRequest, @Body() key: Key) {
return this.service.createKey(req.user, key);
}
@Put()
updateKey(@Req() req: AuthenticatedRequest, @Body() key: Key) {
return this.service.updateKey(req.user, key);
}
@Put(':id/restore')
restoreKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.restoreKey(req.user, id);
}
@Delete(':id')
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.deleteKey(req.user, id);
}
@Get('cylinder')
getCylinders(@Req() req: AuthenticatedRequest) {
return this.service.getUsersCylinders(req.user);
@@ -56,4 +73,9 @@ export class KeyController {
getKeyHandouts(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
return this.service.getKeyHandovers(req.user, id);
}
@Get('Archive')
getArchive(@Req() req: AuthenticatedRequest) {
return this.service.getDeletedKeys(req.user);
}
}