diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-29 00:41:52 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-12-29 00:41:52 +0100 |
| commit | a304c24b32c0327436bbd8c2853e60668e161b42 (patch) | |
| tree | 08f65c05daca134cf4d2e4f779bd15d98fd66370 /src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs | |
| parent | 120a3c6bddd0fb8d9fa05df4763596956554c025 (diff) | |
Rename a lot of stuff, add Santiago real time
Diffstat (limited to 'src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs')
| -rw-r--r-- | src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs b/src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs deleted file mode 100644 index 3c9368c..0000000 --- a/src/Costasdev.Busurbano.Backend/Services/ArrivalsPipeline.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Costasdev.Busurbano.Backend.Types; -using Costasdev.Busurbano.Backend.Types.Arrivals; - -namespace Costasdev.Busurbano.Backend.Services; - -public class ArrivalsContext -{ - /// <summary> - /// The full GTFS ID of the stop (e.g., "vitrasa:1400") - /// </summary> - public required string StopId { get; set; } - - /// <summary> - /// The public code of the stop (e.g., "1400") - /// </summary> - public required string StopCode { get; set; } - - /// <summary> - /// Whether to return a reduced number of arrivals (e.g., 4 instead of 10) - /// </summary> - public bool IsReduced { get; set; } - - public Position? StopLocation { get; set; } - - public required List<Arrival> Arrivals { get; set; } - public required DateTime NowLocal { get; set; } -} - -public interface IArrivalsProcessor -{ - /// <summary> - /// Processes the arrivals in the context. Processors are executed in the order they are registered. - /// </summary> - Task ProcessAsync(ArrivalsContext context); -} - -/// <summary> -/// Orchestrates the enrichment of arrival data through a series of processors. -/// This follows a pipeline pattern where each step (processor) adds or modifies data -/// in the shared ArrivalsContext. -/// </summary> -public class ArrivalsPipeline -{ - private readonly IEnumerable<IArrivalsProcessor> _processors; - - public ArrivalsPipeline(IEnumerable<IArrivalsProcessor> processors) - { - _processors = processors; - } - - /// <summary> - /// Executes all registered processors sequentially. - /// </summary> - public async Task ExecuteAsync(ArrivalsContext context) - { - foreach (var processor in _processors) - { - await processor.ProcessAsync(context); - } - } -} |
