WIP(initial-implementation): parallel batch P2/P3/P5 — code complete, unreviewed
Snapshot of the parallel batch (Phases 2 + 3 + 5) at session pause. Solution does
NOT build cleanly yet — known cross-phase compile issues remain to be resolved
before review. See plans/initial-implementation/PLAN.md "Resume Notes" section
for the exact tomorrow-morning action list.
Phase 2 (Storage):
- Repository interfaces in Marathon.Application/Abstractions
- DateRange, ExportKind, StorageOptions in Marathon.Application/Storage
- EF Core 8 + SQLite (WAL) persistence: 7 entities + configurations + 4 repos
- Hand-written InitialCreate migration (dotnet ef blocked by parallel work)
- ClosedXML ExcelExporter with exact customer-spec wide columns
- PersistenceModule.AddMarathonPersistence DI extension
- Round-trip + export tests (cannot run yet — see cross-phase issues)
Phase 3 (Scraping):
- IOddsScraper, IBetPlacer in Marathon.Application/Abstractions
- ScrapingOptions in Marathon.Infrastructure/Configuration
- MarathonbetScraper with 4 parsers (Upcoming, Live, EventOdds, Results)
- Helpers: ServerTimeProvider, PeriodScopeMapper, OutcomeCodeMapper, MoscowDateParser
- UserAgentRotatorHandler + Polly v8 resilience pipeline
- ScrapingModule.AddMarathonScraping DI extension
- GlobalUsings.cs aliases for EventId / Configuration disambiguation
- Parser tests with trimmed HTML fixtures
- ScrapeResultsAsync interim no-op (Phase 8 will replace via watch-list polling)
Phase 5 (UI shell — killed mid-final-verify, assumed ~95%):
- Marathon.UI populated: MainLayout, App.razor, Pages (Home, Settings),
Components, Theme (MarathonTheme.cs + Tokens.cs + app.css), Resources
(SharedResource.{cs,ru.resx,en.resx}), Services (ISettingsWriter), wwwroot
- WPF host: App.xaml(.cs), MainWindow.xaml(.cs), Marathon.Hosts.WpfBlazor.csproj
with Microsoft.AspNetCore.Components.WebView.Wpf + MudBlazor + Serilog
- appsettings.json + appsettings.Development.json with all sections wired
- bUnit tests: MainLayoutTests, LocaleSwitcherTests, ThemeToggleTests,
JsonSettingsWriterTests + Support helpers
Cross-phase issues to resolve at next session:
1. Phase 2 repository classes are 'internal' — Phase 3's tests can't reference
them. Fix: add InternalsVisibleTo to Marathon.Infrastructure.csproj.
2. Phase 5: LocalizationOptions namespace ambiguity (AspNetCore vs Extensions).
3. Phase 5: WpfBlazor Serilog API mismatch.
Reviewer has NOT run on this batch. Move to Phase 4 only after build is green
and a combined parallel-batch reviewer passes.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class AnomalyConfiguration : IEntityTypeConfiguration<AnomalyEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AnomalyEntity> builder)
|
||||
{
|
||||
builder.ToTable("Anomalies");
|
||||
|
||||
builder.HasKey(a => a.Id);
|
||||
builder.Property(a => a.Id).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(a => a.EventCode).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(a => a.DetectedAt).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(a => a.Kind).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(a => a.Score).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(a => a.EvidenceJson).HasColumnType("TEXT").IsRequired();
|
||||
|
||||
builder.HasIndex(a => a.EventCode).HasDatabaseName("IX_Anomalies_EventCode");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class BetConfiguration : IEntityTypeConfiguration<BetEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BetEntity> builder)
|
||||
{
|
||||
builder.ToTable("Bets");
|
||||
|
||||
builder.HasKey(b => b.Id);
|
||||
builder.Property(b => b.Id).HasColumnType("INTEGER").ValueGeneratedOnAdd();
|
||||
builder.Property(b => b.SnapshotId).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(b => b.Scope).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(b => b.PeriodNumber).HasColumnType("INTEGER");
|
||||
builder.Property(b => b.Type).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(b => b.Side).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(b => b.Value).HasColumnType("TEXT");
|
||||
builder.Property(b => b.Rate).HasColumnType("TEXT").IsRequired();
|
||||
|
||||
builder.HasIndex(b => b.SnapshotId).HasDatabaseName("IX_Bets_SnapshotId");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class EventConfiguration : IEntityTypeConfiguration<EventEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<EventEntity> builder)
|
||||
{
|
||||
builder.ToTable("Events");
|
||||
|
||||
builder.HasKey(e => e.EventCode);
|
||||
builder.Property(e => e.EventCode).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(e => e.SportCode).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(e => e.CountryCode).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(e => e.LeagueId).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(e => e.Category).HasColumnType("TEXT").HasDefaultValue(string.Empty);
|
||||
builder.Property(e => e.ScheduledAt).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(e => e.Side1Name).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(e => e.Side2Name).HasColumnType("TEXT").IsRequired();
|
||||
|
||||
// Index for date-range queries and sport filtering
|
||||
builder.HasIndex(e => new { e.SportCode, e.ScheduledAt }).HasDatabaseName("IX_Events_SportCode_ScheduledAt");
|
||||
builder.HasIndex(e => e.ScheduledAt).HasDatabaseName("IX_Events_ScheduledAt");
|
||||
|
||||
builder.HasMany(e => e.Snapshots)
|
||||
.WithOne(s => s.Event)
|
||||
.HasForeignKey(s => s.EventCode)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(e => e.Result)
|
||||
.WithOne(r => r.Event)
|
||||
.HasForeignKey<EventResultEntity>(r => r.EventCode)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasMany(e => e.Anomalies)
|
||||
.WithOne(a => a.Event)
|
||||
.HasForeignKey(a => a.EventCode)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class EventResultConfiguration : IEntityTypeConfiguration<EventResultEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<EventResultEntity> builder)
|
||||
{
|
||||
builder.ToTable("EventResults");
|
||||
|
||||
builder.HasKey(r => r.EventCode);
|
||||
builder.Property(r => r.EventCode).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(r => r.Side1Score).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(r => r.Side2Score).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(r => r.WinnerSide).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(r => r.CompletedAt).HasColumnType("TEXT").IsRequired();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class LeagueConfiguration : IEntityTypeConfiguration<LeagueEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<LeagueEntity> builder)
|
||||
{
|
||||
builder.ToTable("Leagues");
|
||||
|
||||
builder.HasKey(l => l.Id);
|
||||
builder.Property(l => l.Id).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(l => l.SportCode).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(l => l.Country).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(l => l.NameRu).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(l => l.NameEn).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(l => l.Category).HasColumnType("TEXT").HasDefaultValue(string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class SnapshotConfiguration : IEntityTypeConfiguration<SnapshotEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SnapshotEntity> builder)
|
||||
{
|
||||
builder.ToTable("Snapshots");
|
||||
|
||||
builder.HasKey(s => s.Id);
|
||||
builder.Property(s => s.Id).HasColumnType("INTEGER").ValueGeneratedOnAdd();
|
||||
builder.Property(s => s.EventCode).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(s => s.CapturedAt).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(s => s.Source).HasColumnType("INTEGER").IsRequired();
|
||||
|
||||
builder.HasIndex(s => s.EventCode).HasDatabaseName("IX_Snapshots_EventCode");
|
||||
|
||||
builder.HasMany(s => s.Bets)
|
||||
.WithOne(b => b.Snapshot)
|
||||
.HasForeignKey(b => b.SnapshotId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Marathon.Infrastructure.Persistence.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Marathon.Infrastructure.Persistence.Configurations;
|
||||
|
||||
internal sealed class SportConfiguration : IEntityTypeConfiguration<SportEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SportEntity> builder)
|
||||
{
|
||||
builder.ToTable("Sports");
|
||||
|
||||
builder.HasKey(s => s.Code);
|
||||
builder.Property(s => s.Code).HasColumnType("INTEGER").IsRequired();
|
||||
builder.Property(s => s.NameRu).HasColumnType("TEXT").IsRequired();
|
||||
builder.Property(s => s.NameEn).HasColumnType("TEXT").IsRequired();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user