mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix: issues related to PUT operations
This commit is contained in:
@@ -8,6 +8,7 @@ import { BranchTransactionDTOTransformer } from '@/modules/Branches/integrations
|
||||
import { WarehouseTransactionDTOTransform } from '@/modules/Warehouses/Integrations/WarehouseTransactionDTOTransform';
|
||||
import { VendorCredit } from '../models/VendorCredit';
|
||||
import { assocItemEntriesDefaultIndex } from '@/utils/associate-item-entries-index';
|
||||
import { formatDateFields } from '@/utils/format-date-fields';
|
||||
import { VendorCreditAutoIncrementService } from './VendorCreditAutoIncrement.service';
|
||||
import { ServiceError } from '@/modules/Items/ServiceError';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
@@ -30,7 +31,7 @@ export class VendorCreditDTOTransformService {
|
||||
private branchDTOTransform: BranchTransactionDTOTransformer,
|
||||
private warehouseDTOTransform: WarehouseTransactionDTOTransform,
|
||||
private vendorCreditAutoIncrement: VendorCreditAutoIncrementService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Transforms the credit/edit vendor credit DTO to model.
|
||||
@@ -70,7 +71,10 @@ export class VendorCreditDTOTransformService {
|
||||
autoNextNumber;
|
||||
|
||||
const initialDTO = {
|
||||
...omit(vendorCreditDTO, ['open', 'attachments']),
|
||||
...formatDateFields(
|
||||
omit(vendorCreditDTO, ['open', 'attachments']),
|
||||
['vendorCreditDate'],
|
||||
),
|
||||
amount,
|
||||
currencyCode: vendorCurrencyCode,
|
||||
exchangeRate: vendorCreditDTO.exchangeRate || 1,
|
||||
@@ -78,8 +82,8 @@ export class VendorCreditDTOTransformService {
|
||||
entries,
|
||||
...(vendorCreditDTO.open &&
|
||||
!oldVendorCredit?.openedAt && {
|
||||
openedAt: moment().toMySqlDateTime(),
|
||||
}),
|
||||
openedAt: moment().toMySqlDateTime(),
|
||||
}),
|
||||
};
|
||||
return composeAsync(
|
||||
this.branchDTOTransform.transformDTO<VendorCredit>,
|
||||
|
||||
Reference in New Issue
Block a user