mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
27 lines
672 B
TypeScript
27 lines
672 B
TypeScript
import { Service, Inject } from 'typedi';
|
|
import { Knex } from 'knex';
|
|
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
|
|
|
@Service()
|
|
export class InventoryTransactionsWarehouses {
|
|
@Inject()
|
|
tenancy: HasTenancyService;
|
|
|
|
/**
|
|
* Updates all accounts transctions with the priamry branch.
|
|
* @param tenantId
|
|
* @param primaryBranchId
|
|
*/
|
|
public updateTransactionsWithWarehouse = async (
|
|
tenantId: number,
|
|
primaryBranchId: number,
|
|
trx?: Knex.Transaction
|
|
) => {
|
|
const { AccountTransaction } = await this.tenancy.models(tenantId);
|
|
|
|
await AccountTransaction.query(trx).update({
|
|
branchId: primaryBranchId,
|
|
});
|
|
};
|
|
}
|