keys
This commit is contained in:
40
api/src/modules/key/key.controller.ts
Normal file
40
api/src/modules/key/key.controller.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Req,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { KeyService } from './key.service';
|
||||
import { AuthenticatedRequest } from 'src/model/interface/authenticated-request.interface';
|
||||
import { AuthGuard } from 'src/core/guards/auth.guard';
|
||||
import { Key } from 'src/model/entitites';
|
||||
import { CreateKeySystemDto } from 'src/model/dto/create-key-system.dto';
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Controller('key')
|
||||
export class KeyController {
|
||||
constructor(private service: KeyService) {}
|
||||
|
||||
@Get()
|
||||
getKeys(@Req() req: AuthenticatedRequest) {
|
||||
return this.service.getUsersKeys(req.user);
|
||||
}
|
||||
|
||||
@Put()
|
||||
updateKey(@Req() req: AuthenticatedRequest, @Body() key: Key) {
|
||||
return this.service.updateKey(req.user, key);
|
||||
}
|
||||
|
||||
@Get('cylinder')
|
||||
getCylinders(@Req() req: AuthenticatedRequest) {
|
||||
return this.service.getUsersCylinders(req.user);
|
||||
}
|
||||
|
||||
@Post('system')
|
||||
createKeySystem(@Req() req: AuthenticatedRequest, @Body() body: CreateKeySystemDto) {
|
||||
return this.service.createKeySystem(req.user, body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user