mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { IWarehouseTransfer } from '@/interfaces';
|
||||
import { CRUDWarehouseTransfer } from './CRUDWarehouseTransfer';
|
||||
import { WarehouseTransferTransformer } from './WarehouseTransferTransfomer';
|
||||
import { TransformerInjectable } from '@/lib/Transformer/TransformerInjectable';
|
||||
|
||||
@Service()
|
||||
export class GetWarehouseTransfer extends CRUDWarehouseTransfer {
|
||||
@Inject()
|
||||
private tenancy: HasTenancyService;
|
||||
|
||||
@Inject()
|
||||
private transformer: TransformerInjectable;
|
||||
|
||||
/**
|
||||
* Retrieves the specific warehouse transfer transaction.
|
||||
* @param {number} tenantId
|
||||
* @param {number} warehouseTransferId
|
||||
* @param {IEditWarehouseTransferDTO} editWarehouseDTO
|
||||
* @returns {Promise<IWarehouseTransfer>}
|
||||
*/
|
||||
public getWarehouseTransfer = async (
|
||||
tenantId: number,
|
||||
warehouseTransferId: number
|
||||
): Promise<IWarehouseTransfer> => {
|
||||
const { WarehouseTransfer } = this.tenancy.models(tenantId);
|
||||
|
||||
// Retrieves the old warehouse transfer transaction.
|
||||
const warehouseTransfer = await WarehouseTransfer.query()
|
||||
.findById(warehouseTransferId)
|
||||
.withGraphFetched('entries.item')
|
||||
.withGraphFetched('fromWarehouse')
|
||||
.withGraphFetched('toWarehouse');
|
||||
|
||||
this.throwIfTransferNotFound(warehouseTransfer);
|
||||
|
||||
// Retrieves the transfromed warehouse transfers.
|
||||
return this.transformer.transform(
|
||||
tenantId,
|
||||
warehouseTransfer,
|
||||
new WarehouseTransferTransformer()
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user