fix: get product all
This commit is contained in:
parent
c5b5a4ab06
commit
5da48273c0
|
@ -69,7 +69,7 @@ export class ProductController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('get-all')
|
@Get('all')
|
||||||
async findAll(
|
async findAll(
|
||||||
@Query('page') page: number,
|
@Query('page') page: number,
|
||||||
@Query('sub-category') subcategory: string,
|
@Query('sub-category') subcategory: string,
|
||||||
|
@ -179,24 +179,6 @@ export class ProductController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('categories/:id')
|
|
||||||
async findOneCategories(@Param('id', ParseUUIDPipe) id: string) {
|
|
||||||
return {
|
|
||||||
data: await this.productCategoriesService.findOne(id),
|
|
||||||
statusCode: HttpStatus.OK,
|
|
||||||
message: 'success',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get('sub-categories/:id')
|
|
||||||
async findOneSubCategories(@Param('id', ParseUUIDPipe) id: string) {
|
|
||||||
return {
|
|
||||||
data: await this.productSubCategoriesService.findOne(id),
|
|
||||||
statusCode: HttpStatus.OK,
|
|
||||||
message: 'success',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
async update(
|
async update(
|
||||||
@Param('id', ParseUUIDPipe) id: string,
|
@Param('id', ParseUUIDPipe) id: string,
|
||||||
|
|
|
@ -54,7 +54,7 @@ export class ProductService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async findAll(page, supplier, categories, subCategories) {
|
async findAll(page, supplier, categories, subCategories) {
|
||||||
if (supplier != 'null' && !supplier) {
|
if (supplier == 'null' || !supplier) {
|
||||||
supplier = (await this.supplierService.findByActive()).id;
|
supplier = (await this.supplierService.findByActive()).id;
|
||||||
}
|
}
|
||||||
const baseQuery = this.productRepository
|
const baseQuery = this.productRepository
|
||||||
|
|
Loading…
Reference in New Issue
Block a user