Crear-editar productos, depuracion de archivos users
This commit is contained in:
@@ -3,7 +3,7 @@ import { InventoryService } from './inventory.service';
|
||||
import { CreateProductDto } from './dto/create-product.dto';
|
||||
import { UpdateProductDto } from './dto/update-product.dto';
|
||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { Roles } from '../../common/decorators/roles.decorator';
|
||||
// import { Roles } from '../../common/decorators/roles.decorator';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
|
||||
@ApiTags('inventory')
|
||||
@@ -42,22 +42,19 @@ export class UsersController {
|
||||
@Body() createUserDto: CreateProductDto,
|
||||
@Query('roleId') roleId?: string,
|
||||
) {
|
||||
const data = await this.inventoryService.create(
|
||||
createUserDto,
|
||||
roleId ? parseInt(roleId) : undefined,
|
||||
);
|
||||
const data = await this.inventoryService.create(createUserDto)
|
||||
return { message: 'User created successfully', data };
|
||||
}
|
||||
|
||||
// @Patch(':id')
|
||||
@Patch(':id')
|
||||
// @Roles('admin')
|
||||
// @ApiOperation({ summary: 'Update a user' })
|
||||
// @ApiResponse({ status: 200, description: 'User updated successfully.' })
|
||||
// @ApiResponse({ status: 404, description: 'User not found.' })
|
||||
// async update(@Param('id') id: string, @Body() UpdateProductDto: UpdateProductDto) {
|
||||
// const data = await this.inventoryService.update(id, UpdateProductDto);
|
||||
// return { message: 'User updated successfully', data };
|
||||
// }
|
||||
@ApiOperation({ summary: 'Update a product' })
|
||||
@ApiResponse({ status: 200, description: 'Product updated successfully.' })
|
||||
@ApiResponse({ status: 404, description: 'Product not found.' })
|
||||
async update(@Param('id') id: string, @Body() UpdateProductDto: UpdateProductDto) {
|
||||
const data = await this.inventoryService.update(id, UpdateProductDto);
|
||||
return { message: 'User updated successfully', data };
|
||||
}
|
||||
|
||||
// @Delete(':id')
|
||||
// @Roles('admin')
|
||||
|
||||
Reference in New Issue
Block a user