Crear-editar productos, depuracion de archivos users

This commit is contained in:
2025-06-27 13:14:50 -04:00
parent ed2a1da038
commit 2840bbec11
23 changed files with 333 additions and 1193 deletions

View File

@@ -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')