Vista (intefaz y bd), esquema y endpoints de store agregados
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Req } from '@nestjs/common';
|
||||
import { InventoryService } from './inventory.service';
|
||||
import { CreateProductDto } from './dto/create-product.dto';
|
||||
import { UpdateProductDto } from './dto/update-product.dto';
|
||||
@@ -6,12 +6,12 @@ import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
// import { Roles } from '../../common/decorators/roles.decorator';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
|
||||
@ApiTags('inventory')
|
||||
@Controller('inventory')
|
||||
@ApiTags('products')
|
||||
@Controller('products')
|
||||
export class UsersController {
|
||||
constructor(private readonly inventoryService: InventoryService) {}
|
||||
|
||||
@Get()
|
||||
@Get('/store')
|
||||
// @Roles('admin')
|
||||
@ApiOperation({ summary: 'Get all products with pagination and filters' })
|
||||
@ApiResponse({ status: 200, description: 'Return paginated products.' })
|
||||
@@ -24,6 +24,22 @@ export class UsersController {
|
||||
};
|
||||
}
|
||||
|
||||
@Get('/inventory')
|
||||
// @Roles('admin')
|
||||
@ApiOperation({ summary: 'Get all products with pagination and filters' })
|
||||
@ApiResponse({ status: 200, description: 'Return paginated products.' })
|
||||
async findAllByUserId(@Req() req: Request, @Query() paginationDto: PaginationDto) {
|
||||
console.log(req['user'].id)
|
||||
const id = 1
|
||||
// const id = Number(req['user'].id);
|
||||
const result = await this.inventoryService.findAllByUserId(id,paginationDto);
|
||||
return {
|
||||
message: 'products fetched successfully',
|
||||
data: result.data,
|
||||
meta: result.meta
|
||||
};
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
// @Roles('admin')
|
||||
@ApiOperation({ summary: 'Get a product by ID' })
|
||||
|
||||
Reference in New Issue
Block a user