mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix: issues related to PUT operations
This commit is contained in:
@@ -28,8 +28,9 @@ export class EditBillService {
|
||||
private transformerDTO: BillDTOTransformer,
|
||||
|
||||
@Inject(Bill.name) private billModel: TenantModelProxy<typeof Bill>,
|
||||
@Inject(Vendor.name) private contactModel: TenantModelProxy<typeof Vendor>,
|
||||
) {}
|
||||
@Inject(Vendor.name) private vendorModel: TenantModelProxy<typeof Vendor>,
|
||||
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Edits details of the given bill id with associated entries.
|
||||
@@ -58,10 +59,9 @@ export class EditBillService {
|
||||
this.validators.validateBillExistance(oldBill);
|
||||
|
||||
// Retrieve vendor details or throw not found service error.
|
||||
const vendor = await this.contactModel()
|
||||
const vendor = await this.vendorModel()
|
||||
.query()
|
||||
.findById(billDTO.vendorId)
|
||||
.modify('vendor')
|
||||
.throwIfNotFound();
|
||||
|
||||
// Validate bill number uniqiness on the storage.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ToNumber } from '@/common/decorators/Validators';
|
||||
import { ItemEntryDto } from '@/modules/TransactionItemEntry/dto/ItemEntry.dto';
|
||||
import { Type } from 'class-transformer';
|
||||
import { Type, Transform } from 'class-transformer';
|
||||
import { parseBoolean } from '@/utils/parse-boolean';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import {
|
||||
ArrayMinSize,
|
||||
@@ -31,6 +32,7 @@ export class BillEntryDto extends ItemEntryDto {
|
||||
})
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Transform(({ value }) => parseBoolean(value, false))
|
||||
landedCost?: boolean;
|
||||
}
|
||||
|
||||
@@ -211,5 +213,5 @@ export class CommandBillDto {
|
||||
adjustment?: number;
|
||||
}
|
||||
|
||||
export class CreateBillDto extends CommandBillDto {}
|
||||
export class EditBillDto extends CommandBillDto {}
|
||||
export class CreateBillDto extends CommandBillDto { }
|
||||
export class EditBillDto extends CommandBillDto { }
|
||||
|
||||
Reference in New Issue
Block a user