aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
commita304c24b32c0327436bbd8c2853e60668e161b42 (patch)
tree08f65c05daca134cf4d2e4f779bd15d98fd66370 /src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs
parent120a3c6bddd0fb8d9fa05df4763596956554c025 (diff)
Rename a lot of stuff, add Santiago real time
Diffstat (limited to 'src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs')
-rw-r--r--src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs b/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs
deleted file mode 100644
index 50f0791..0000000
--- a/src/Costasdev.Busurbano.ServiceViewer/Data/AppDbContext.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using Costasdev.ServiceViewer.Data.Gtfs;
-using Costasdev.ServiceViewer.Data.Gtfs.Enums;
-using Microsoft.EntityFrameworkCore;
-
-namespace Costasdev.ServiceViewer.Data;
-
-public class AppDbContext : DbContext
-{
- public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
- {
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- // Route -> Agency
- modelBuilder.Entity<GtfsRoute>()
- .HasOne(r => r.Agency)
- .WithMany()
- .HasForeignKey(r => new { r.AgencyId, r.FeedId })
- .HasPrincipalKey(a => new { a.Id, a.FeedId });
-
- // Trip -> Route
- modelBuilder.Entity<GtfsTrip>()
- .HasOne(t => t.Route)
- .WithMany()
- .HasForeignKey(t => new { t.RouteId, t.FeedId })
- .HasPrincipalKey(a => new { a.Id, a.FeedId });
-
- // Relación StopTimes -> Trip
- modelBuilder.Entity<GtfsStopTime>()
- .HasOne(st => st.GtfsTrip)
- .WithMany()
- .HasForeignKey(st => new { st.TripId, st.FeedId })
- .HasPrincipalKey(a => new { a.Id, a.FeedId });
-
- // Relación StopTimes -> Stop
- modelBuilder.Entity<GtfsStopTime>()
- .HasOne(st => st.GtfsStop)
- .WithMany()
- .HasForeignKey(st => new { st.StopId, st.FeedId })
- .HasPrincipalKey(a => new { a.Id, a.FeedId });
-
- modelBuilder.Entity<GtfsTrip>()
- .Property(t => t.TripWheelchairAccessible)
- .HasDefaultValue(TripWheelchairAccessible.Empty);
-
- modelBuilder.Entity<GtfsTrip>()
- .Property(t => t.TripBikesAllowed)
- .HasDefaultValue(TripBikesAllowed.Empty);
- }
-
- public DbSet<GtfsAgency> Agencies { get; set; }
- public DbSet<GtfsCalendar> Calendars { get; set; }
- public DbSet<GtfsCalendarDate> CalendarDates { get; set; }
- public DbSet<GtfsRoute> Routes { get; set; }
- public DbSet<GtfsStop> Stops { get; set; }
- public DbSet<GtfsStopTime> StopTimes { get; set; }
- public DbSet<GtfsTrip> Trips { get; set; }
-}