fixing: get product by supplier and categories
This commit is contained in:
@@ -48,7 +48,7 @@ export class SupplierService {
|
||||
supplierData.id = uuid.v4();
|
||||
supplierData.name = createSupplierDto.name;
|
||||
supplierData.code = createSupplierDto.code;
|
||||
supplierData.status = true;
|
||||
supplierData.status = false;
|
||||
|
||||
await this.connection.transaction(async (manager) => {
|
||||
const result = await manager.insert(Supplier, supplierData);
|
||||
@@ -158,4 +158,24 @@ export class SupplierService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async findByActive() {
|
||||
try {
|
||||
return await this.supplierRepository.findOneOrFail({
|
||||
status: true,
|
||||
});
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
{
|
||||
statusCode: HttpStatus.NOT_FOUND,
|
||||
error: 'Supplier Data not found',
|
||||
},
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user