add: callback transaction
This commit is contained in:
@@ -10,6 +10,12 @@ export class ProductHistoryPriceService {
|
||||
private productHistoryPriceService: Repository<ProductHistoryPrice>,
|
||||
) {}
|
||||
|
||||
async create(dataProduct: ProductHistoryPrice) {
|
||||
const result = await this.productHistoryPriceService.save(dataProduct);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async findOne(product: string, partner: string) {
|
||||
try {
|
||||
return await this.productHistoryPriceService.findOneOrFail({
|
||||
@@ -34,6 +40,24 @@ export class ProductHistoryPriceService {
|
||||
}
|
||||
}
|
||||
|
||||
async findById(id: string) {
|
||||
try {
|
||||
return await this.productHistoryPriceService.findOneOrFail(id);
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
{
|
||||
statusCode: HttpStatus.NOT_FOUND,
|
||||
error: 'Price not found',
|
||||
},
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async findOneByProductId(
|
||||
page: number,
|
||||
productId: string,
|
||||
|
||||
Reference in New Issue
Block a user