37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { Controller, Get, Post, Put, Delete, Param, Body, UseGuards, ParseIntPipe } from '@nestjs/common';
|
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
|
import { CredentialsService } from './credentials.service';
|
|
import { CreateCredentialDto } from './dto/create-credential.dto';
|
|
import { UpdateCredentialDto } from './dto/update-credential.dto';
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
@Controller('credentials')
|
|
export class CredentialsController {
|
|
constructor(private credentials: CredentialsService) {}
|
|
|
|
@Get()
|
|
findAll() {
|
|
return this.credentials.findAll();
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id', ParseIntPipe) id: number) {
|
|
return this.credentials.findOne(id);
|
|
}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateCredentialDto) {
|
|
return this.credentials.create(dto);
|
|
}
|
|
|
|
@Put(':id')
|
|
update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateCredentialDto) {
|
|
return this.credentials.update(id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id', ParseIntPipe) id: number) {
|
|
return this.credentials.remove(id);
|
|
}
|
|
}
|