distribute saldo

This commit is contained in:
2021-12-09 03:57:34 +07:00
parent e25f97ee9c
commit 78a2cadb5e
3 changed files with 71 additions and 38 deletions

View File

@@ -51,6 +51,24 @@ export class CoaService {
}
}
async findByUserWithRelated(id: string, relatedId: string, typeOfCoa: coaType) {
try {
return await this.coaRepository.findOneOrFail({ user: id, type: typeOfCoa, relatedUser:relatedId });
} catch (e) {
if (e instanceof EntityNotFoundError) {
throw new HttpException(
{
statusCode: HttpStatus.NOT_FOUND,
error: 'Coa Data not found',
},
HttpStatus.NOT_FOUND,
);
} else {
throw e;
}
}
}
async findByName(name: string) {
try {
return await this.coaRepository.findOneOrFail({ name: name });