fix: add saldo member

This commit is contained in:
ilham
2021-12-17 14:53:42 +07:00
parent 8f5b3588d2
commit e7db0073c5
2 changed files with 86 additions and 53 deletions

View File

@@ -76,6 +76,28 @@ export class CoaService {
}
}
async findByTwoUser(from: string, destination: string, typeOfCoa: coaType) {
try {
return await this.coaRepository.findOneOrFail({
user: from,
relatedUser: destination,
type: typeOfCoa,
});
} catch (e) {
if (e instanceof EntityNotFoundError) {
throw new HttpException(
{
statusCode: HttpStatus.NOT_FOUND,
error: 'COA not found',
},
HttpStatus.NOT_FOUND,
);
} else {
throw e;
}
}
}
async findByUserWithRelated(
id: string,
relatedId: string,