fix: writing the bill journal entries.

This commit is contained in:
a.bouhuolia
2020-12-19 12:08:42 +02:00
parent 112eaec488
commit 920875d7d9
10 changed files with 170 additions and 92 deletions

View File

@@ -11,6 +11,8 @@ interface IJournalTransactionsFilter {
toAmount: number,
contactsIds?: number[],
contactType?: string,
referenceType?: string[],
referenceId?: number[],
};
export default class AccountTransactionsRepository extends TenantRepository {
@@ -42,6 +44,12 @@ export default class AccountTransactionsRepository extends TenantRepository {
if (filter.contactType) {
query.where('contact_type', filter.contactType);
}
if (filter.referenceType && filter.referenceType.length > 0) {
query.whereIn('reference_type', filter.referenceType);
}
if (filter.referenceId && filter.referenceId.length > 0) {
query.whereIn('reference_id', filter.referenceId);
}
});
});
}

View File

@@ -177,7 +177,20 @@ export default class CachableRepository extends EntityRepository{
*
* @param {string|number[]} values -
*/
async deleteWhereIn(values: string | number[]) {
async deleteWhereIn(field: string, values: string | number[]) {
const result = await super.deleteWhereIn(field, values);
// Flushes the repository cache after delete operation.
this.flushCache();
return result;
}
/**
*
* @param {string|number[]} values
*/
async deleteWhereIdIn(values: string | number[]) {
const result = await super.deleteWhereIdIn(values);
// Flushes the repository cache after delete operation.

View File

@@ -175,7 +175,7 @@ export default class EntityRepository {
}
/**
*
* Deletes the given entries in the array on the specific field.
* @param {string} field -
* @param {number|string} values -
*/