add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -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()
);
};
}