update swagger
This commit is contained in:
@@ -20,9 +20,16 @@ import { UserRole } from '../users/enums/user-role.enum';
|
||||
import { CustomersService } from './customers.service';
|
||||
import { UpdateCustomerDto } from './dto/update-customer.dto';
|
||||
import { SWAGGER_JWT_AUTH } from '../swagger/swagger.setup';
|
||||
import {
|
||||
ApiStandardController,
|
||||
ApiStandardEmptyResponse,
|
||||
ApiStandardOkResponse,
|
||||
} from '../swagger/decorators/swagger-response.decorator';
|
||||
import { Customer } from './entities/customer.entity';
|
||||
|
||||
@ApiTags('Customers')
|
||||
@ApiBearerAuth(SWAGGER_JWT_AUTH)
|
||||
@ApiStandardController()
|
||||
@Controller('customers')
|
||||
@UseGuards(RolesGuard, PermissionsGuard)
|
||||
export class CustomersController {
|
||||
@@ -30,11 +37,13 @@ export class CustomersController {
|
||||
|
||||
@Roles(UserRole.ADMIN)
|
||||
@Permissions(PermissionCode.CUSTOMERS_READ)
|
||||
@ApiStandardOkResponse(Customer, { isArray: true })
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.customersService.findAll();
|
||||
}
|
||||
|
||||
@ApiStandardOkResponse(Customer)
|
||||
@Get(':id')
|
||||
findOne(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@@ -43,6 +52,7 @@ export class CustomersController {
|
||||
return this.customersService.findOne(id, user);
|
||||
}
|
||||
|
||||
@ApiStandardOkResponse(Customer)
|
||||
@Patch(':id')
|
||||
update(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@@ -54,6 +64,7 @@ export class CustomersController {
|
||||
|
||||
@Roles(UserRole.ADMIN)
|
||||
@Permissions(PermissionCode.CUSTOMERS_DELETE)
|
||||
@ApiStandardEmptyResponse()
|
||||
@Delete(':id')
|
||||
remove(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.customersService.remove(id);
|
||||
|
||||
Reference in New Issue
Block a user