|
| 1 | +import { IsNumber, IsOptional, IsString } from 'class-validator'; |
| 2 | + |
| 3 | +export class ItemShipping { |
| 4 | + constructor(partial: ItemShipping) { |
| 5 | + this.name = partial.name; |
| 6 | + this.quantity = partial.quantity; |
| 7 | + this.height = partial.height; |
| 8 | + this.weight = partial.weight; |
| 9 | + this.width = partial.width; |
| 10 | + this.length = partial.length; |
| 11 | + this.code = partial?.code ? partial.code : undefined; |
| 12 | + } |
| 13 | + |
| 14 | + name: string; |
| 15 | + code?: string; |
| 16 | + quantity: number; |
| 17 | + height: number; |
| 18 | + weight: number; |
| 19 | + width: number; |
| 20 | + length: number; |
| 21 | +} |
| 22 | + |
| 23 | +export class GetShippingFeeDTO { |
| 24 | + constructor(data: GetShippingFeeDTO) { |
| 25 | + this.service_type_id = data?.service_type_id; |
| 26 | + this.from_district_id = data?.from_district_id; |
| 27 | + this.from_ward_code = data?.from_ward_code; |
| 28 | + this.to_district_id = data?.to_district_id; |
| 29 | + this.to_ward_code = data?.to_ward_code; |
| 30 | + this.height = data?.height; |
| 31 | + this.weight = data?.weight; |
| 32 | + this.width = data?.width; |
| 33 | + this.length = data?.length; |
| 34 | + this.insurance_value = data?.insurance_value; |
| 35 | + this.items = data?.items.map((item) => new ItemShipping(item)); |
| 36 | + this.province_id = data?.province_id; |
| 37 | + } |
| 38 | + |
| 39 | + @IsOptional() |
| 40 | + @IsNumber() |
| 41 | + service_type_id?: number; |
| 42 | + |
| 43 | + @IsNumber() |
| 44 | + from_district_id?: number; |
| 45 | + |
| 46 | + @IsOptional() |
| 47 | + from_ward_code?: string; |
| 48 | + |
| 49 | + @IsNumber() |
| 50 | + to_district_id: number; |
| 51 | + |
| 52 | + @IsString() |
| 53 | + to_ward_code: string; |
| 54 | + |
| 55 | + height: number; |
| 56 | + weight: number; |
| 57 | + width: number; |
| 58 | + length: number; |
| 59 | + |
| 60 | + insurance_value?: number; |
| 61 | + items: ItemShipping[]; |
| 62 | + |
| 63 | + province_id?: number; |
| 64 | +} |
0 commit comments