03_ride_lifecycle implemented and not tested

This commit is contained in:
Kalana B. Thilakarathna
2026-08-21 02:08:11 +05:30
parent 942a39b0eb
commit c9f5006727
62 changed files with 10736 additions and 77 deletions
+20 -6
View File
@@ -1,19 +1,33 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class DeliveryRun : Template
{
public RideType RideType { get; set; }
public RideStatus Status { get; set; } = RideStatus.Draft;
public Guid FK_VehicleId { get; set; }
[ForeignKey("FK_VehicleId")]
public Vehicle Vehicle { get; set; }
//public Guid FK_DriverId { get; set; }
//[ForeignKey("FK_DriverId")]
//public Driver Driver { get; set; }
public int Meterstart { get; set; }
public int Meterend { get; set; }
public Guid FK_DriverProfileId { get; set; }
[ForeignKey("FK_DriverProfileId")]
public DriverProfile DriverProfile { get; set; }
public Guid FK_RouteId { get; set; }
[ForeignKey("FK_RouteId")]
public Route Route { get; set; }
public Guid FK_SourceWarehouseId { get; set; }
[ForeignKey("FK_SourceWarehouseId")]
public Warehouse SourceWarehouse { get; set; }
public int Meterstart { get; set; }
public int Meterend { get; set; }
public DateTime? StartedAt { get; set; }
public DateTime? ActivatedAt { get; set; }
public DateTime? ClosedAt { get; set; }
}
}
@@ -0,0 +1,11 @@
namespace Distribution.Models
{
public class DriverComplianceConfig
{
public Guid Id { get; set; } = Guid.NewGuid();
public bool EnforceLicenseExpiry { get; set; } = false;
public bool EnforceMedicalClearance { get; set; } = false;
public DateTime UpdatedAt { get; set; } = DateTime.Now;
public Guid UpdatedBy { get; set; }
}
}
+15
View File
@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class DriverProfile : Template
{
public Guid FK_UserId { get; set; }
[ForeignKey("FK_UserId")]
public User User { get; set; }
public string LicenseNumber { get; set; }
public DateTime LicenseExpiry { get; set; }
public DateTime MedicalClearanceExpiry { get; set; }
}
}
+8
View File
@@ -20,4 +20,12 @@ namespace Distribution.Models
Damage,
Adjustment
}
public enum RideType { Delivery, Sale }
public enum RideStatus { Draft, Open, Active, CancelRequested, Cancelled, Closed }
public enum CancelRequestType { VehicleBreakdown, DriverUnavailable, RouteIssue, Other }
public enum CancelRequestStatus { Pending, Approved, Rejected }
}
+23
View File
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class RideCancelRequest
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid FK_RideId { get; set; }
[ForeignKey("FK_RideId")]
public DeliveryRun Ride { get; set; }
public CancelRequestType TypeCode { get; set; }
public string Reason { get; set; }
public Guid RequestedBy { get; set; }
public DateTime RequestedAt { get; set; } = DateTime.Now;
public CancelRequestStatus Status { get; set; } = CancelRequestStatus.Pending;
public Guid? ApprovedBy { get; set; }
public DateTime? ApprovedAt { get; set; }
}
}
+7 -1
View File
@@ -1,10 +1,16 @@
namespace Distribution.Models
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class Vehicle : Template
{
public string RegNumber { get; set; }
public string NumberPlate { get; set; }
public VehicleType Type { get; set; }
public Guid? FK_DefaultWarehouseId { get; set; }
[ForeignKey("FK_DefaultWarehouseId")]
public Warehouse DefaultWarehouse { get; set; }
}
public enum VehicleType
{