mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { ManualJournalTransfromer } from './ManualJournalTransformer';
|
||||
import { TransformerInjectable } from '@/lib/Transformer/TransformerInjectable';
|
||||
|
||||
@Service()
|
||||
export class GetManualJournal {
|
||||
@Inject()
|
||||
private tenancy: HasTenancyService;
|
||||
|
||||
@Inject()
|
||||
private transformer: TransformerInjectable;
|
||||
|
||||
/**
|
||||
* Retrieve manual journal details with assocaited journal transactions.
|
||||
* @param {number} tenantId
|
||||
* @param {number} manualJournalId
|
||||
*/
|
||||
public getManualJournal = async (
|
||||
tenantId: number,
|
||||
manualJournalId: number
|
||||
) => {
|
||||
const { ManualJournal } = this.tenancy.models(tenantId);
|
||||
|
||||
const manualJournal = await ManualJournal.query()
|
||||
.findById(manualJournalId)
|
||||
.withGraphFetched('entries.account')
|
||||
.withGraphFetched('entries.contact')
|
||||
.withGraphFetched('entries.branch')
|
||||
.withGraphFetched('transactions')
|
||||
.withGraphFetched('media')
|
||||
.throwIfNotFound();
|
||||
|
||||
return this.transformer.transform(
|
||||
tenantId,
|
||||
manualJournal,
|
||||
new ManualJournalTransfromer()
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user