mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { omit } from 'lodash';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { IManualJournal } from '@/interfaces';
|
||||
import { BranchesSettings } from '../../BranchesSettings';
|
||||
|
||||
@Service()
|
||||
export class ManualJournalBranchesDTOTransformer {
|
||||
@Inject()
|
||||
branchesSettings: BranchesSettings;
|
||||
|
||||
private excludeDTOBranchIdWhenInactive = (
|
||||
tenantId: number,
|
||||
DTO: IManualJournal
|
||||
): IManualJournal => {
|
||||
const isActive = this.branchesSettings.isMultiBranchesActive(tenantId);
|
||||
|
||||
if (isActive) return DTO;
|
||||
|
||||
return {
|
||||
...DTO,
|
||||
entries: DTO.entries.map((e) => omit(e, ['branchId'])),
|
||||
};
|
||||
};
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public transformDTO =
|
||||
(tenantId: number) =>
|
||||
(DTO: IManualJournal): IManualJournal => {
|
||||
return this.excludeDTOBranchIdWhenInactive(tenantId, DTO);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user