mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
add column
This commit is contained in:
@@ -43,6 +43,20 @@ export class CreateFirstMile1810000000000 implements MigrationInterface {
|
||||
default: 0,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
name: 'estimated_km',
|
||||
type: 'numeric',
|
||||
precision: 10,
|
||||
scale: 2,
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
name: 'exact_km',
|
||||
type: 'numeric',
|
||||
precision: 10,
|
||||
scale: 2,
|
||||
isNullable: true,
|
||||
},
|
||||
{ name: 'vehicle_id', type: 'uuid', isNullable: true },
|
||||
{ name: 'created_at', type: 'timestamptz', default: 'now()' },
|
||||
{ name: 'updated_at', type: 'timestamptz', default: 'now()' },
|
||||
|
||||
@@ -34,7 +34,23 @@ export class CreateFirstMileDto {
|
||||
@Min(0)
|
||||
remainingPayment?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Planned distance for the leg, in km', example: 42.5 })
|
||||
@IsOptional()
|
||||
@Transform(toNumber)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
estimatedKm?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Actual distance travelled, in km', example: 44.1 })
|
||||
@IsOptional()
|
||||
@Transform(toNumber)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
exactKm?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
format: 'uuid',
|
||||
description: 'Assigned vehicle (FK → vehicles.id). May be null until assigned.',
|
||||
nullable: true,
|
||||
})
|
||||
|
||||
@@ -34,6 +34,12 @@ export class FirstMile extends BaseEntity {
|
||||
@Column({ name: 'remaining_payment', type: 'numeric', precision: 14, scale: 2, default: 0 })
|
||||
remainingPayment!: number;
|
||||
|
||||
@Column({ name: 'estimated_km', type: 'numeric', precision: 10, scale: 2, nullable: true })
|
||||
estimatedKm?: number | null;
|
||||
|
||||
@Column({ name: 'exact_km', type: 'numeric', precision: 10, scale: 2, nullable: true })
|
||||
exactKm?: number | null;
|
||||
|
||||
@Column({ name: 'vehicle_id', type: 'uuid', nullable: true })
|
||||
vehicleId?: string | null;
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ export class FirstMileService {
|
||||
status: dto.status ?? 'PAYMENT_PENDING',
|
||||
advancedPayment: dto.advancedPayment ?? 0,
|
||||
remainingPayment: dto.remainingPayment ?? 0,
|
||||
estimatedKm: dto.estimatedKm ?? null,
|
||||
exactKm: dto.exactKm ?? null,
|
||||
vehicleId: dto.vehicleId ?? null,
|
||||
});
|
||||
}
|
||||
@@ -92,6 +94,8 @@ export class FirstMileService {
|
||||
...(dto.status !== undefined ? { status: dto.status } : {}),
|
||||
...(dto.advancedPayment !== undefined ? { advancedPayment: dto.advancedPayment } : {}),
|
||||
...(dto.remainingPayment !== undefined ? { remainingPayment: dto.remainingPayment } : {}),
|
||||
...(dto.estimatedKm !== undefined ? { estimatedKm: dto.estimatedKm } : {}),
|
||||
...(dto.exactKm !== undefined ? { exactKm: dto.exactKm } : {}),
|
||||
...(dto.vehicleId !== undefined ? { vehicleId: dto.vehicleId } : {}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user