Skip to content

Commit

Permalink
added trip status enum, fixed relation
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriyBorkovich committed Mar 31, 2024
1 parent c1d7123 commit 64adce2
Show file tree
Hide file tree
Showing 13 changed files with 1,151 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/BSMS.Core/Entities/Passenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ public class Passenger
public string? PhoneNumber { get; set; }
public string? Email { get; set; }
public int? BusId { get; set; }

public Bus? Bus { get; set; }
public List<BusReview> BusReviews { get; set; }

Check warning on line 13 in src/BSMS.Core/Entities/Passenger.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'BusReviews' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public List<Ticket> Tickets { get; set; }

public List<Ticket> Tickets { get; set; }

Check warning on line 15 in src/BSMS.Core/Entities/Passenger.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Tickets' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
4 changes: 2 additions & 2 deletions src/BSMS.Core/Entities/Stop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
public class Stop
{
public int StopId { get; set; }
public int? RouteId { get; set; }
public int RouteId { get; set; }
public int? PreviousStopId { get; set; }

public Stop? PreviousStop { get; set; }
public Route? Route { get; set; }
public Route Route { get; set; }

Check warning on line 10 in src/BSMS.Core/Entities/Stop.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Route' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public List<Ticket> TicketEndStops { get; set; }

Check warning on line 11 in src/BSMS.Core/Entities/Stop.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'TicketEndStops' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public List<Ticket> TicketStartStops { get; set; }

Check warning on line 12 in src/BSMS.Core/Entities/Stop.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'TicketStartStops' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}
5 changes: 4 additions & 1 deletion src/BSMS.Core/Entities/Ticket.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
namespace BSMS.Core.Entities;
using System.ComponentModel.DataAnnotations.Schema;

namespace BSMS.Core.Entities;

public class Ticket
{
public int TicketId { get; set; }
public int? PassengerId { get; set; }
public int SeatId { get; set; }
[Column(TypeName = "decimal(18,2)")]
public decimal Price { get; set; }
public bool IsSold { get; set; }
public int StartStopId { get; set; }
Expand Down
6 changes: 4 additions & 2 deletions src/BSMS.Core/Entities/Trip.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace BSMS.Core.Entities;
using BSMS.Core.Enums;

namespace BSMS.Core.Entities;

public class Trip
{
public int TripId { get; set; }
public string TripStatus { get; set; } = null!;
public TripStatus Status { get; set; }
public int RouteId { get; set; }
public DateTime DepartureTime { get; set; }
public DateTime ArrivalTime { get; set; }
Expand Down
10 changes: 10 additions & 0 deletions src/BSMS.Core/Enums/TripStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace BSMS.Core.Enums;

public enum TripStatus
{
Scheduled = 100,
InTransit = 200,
Delayed = 300,
Canceled = 400,
Disrupted = 500
}
1 change: 1 addition & 0 deletions src/BSMS.Infrastructure/BSMS.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 64adce2

Please sign in to comment.