add: get product by categories
This commit is contained in:
@@ -53,6 +53,19 @@ export class ProductService {
|
||||
});
|
||||
}
|
||||
|
||||
findAllByCategories(page, categories) {
|
||||
return this.productRepository.findAndCount({
|
||||
where: {
|
||||
subCategories: categories,
|
||||
},
|
||||
skip: page * 10,
|
||||
take: 10,
|
||||
order: {
|
||||
version: 'DESC',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findOne(code: string) {
|
||||
try {
|
||||
return await this.productRepository.findOneOrFail({ code: code });
|
||||
|
||||
Reference in New Issue
Block a user