diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 08:56:32 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-12 10:24:53 +0100 |
| commit | d65ce8288bbda3cb6e0b37613c29d7bf52703ba7 (patch) | |
| tree | f6aaf58bbebeaa9b147e895ff8a5388881fa51d8 /src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs | |
| parent | 661cccc2da9a6c32b7b56c60313787282a9084ea (diff) | |
Some rework on the ServiceViewer (which will be repurposed for live multi-GTFS serving)
Diffstat (limited to 'src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs')
| -rw-r--r-- | src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs b/src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs index 07b6732..9599947 100644 --- a/src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs +++ b/src/Costasdev.Busurbano.ServiceViewer/Data/Gtfs/GtfsStopTime.cs @@ -1,11 +1,12 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Costasdev.ServiceViewer.Data.Extensions; using Microsoft.EntityFrameworkCore; namespace Costasdev.ServiceViewer.Data.Gtfs; -[Table("stop_times")] -[PrimaryKey(nameof(TripId), nameof(StopSequence))] +[Table("gtfs_stop_times")] +[PrimaryKey(nameof(TripId), nameof(StopSequence), nameof(FeedId))] public class GtfsStopTime { [Column("trip_id")] @@ -13,13 +14,16 @@ public class GtfsStopTime [MaxLength(32)] public string TripId { get; set; } = null!; + [Column("feed_id")]public int FeedId { get; set; } + [ForeignKey(nameof(FeedId))] public required Feed Feed { get; set; } + [ForeignKey(nameof(TripId))] public GtfsTrip GtfsTrip { get; set; } = null!; - [Column("arrival_time")] public string ArrivalTime { get; set; } - public TimeOnly ArrivalTimeOnly => TimeOnly.Parse(ArrivalTime); + [Column("arrival_time")] public string Arrival { get; set; } + public TimeSpan ArrivalTime => TimeSpan.FromGtfsTime(Arrival); - [Column("departure_time")] public string DepartureTime { get; set; } - public TimeOnly DepartureTimeOnly => TimeOnly.Parse(DepartureTime); + [Column("departure_time")] public string Departure { get; set; } + public TimeSpan DepartureTime => TimeSpan.FromGtfsTime(Departure); [Column("stop_id")] [ForeignKey(nameof(GtfsStop))] |
