BarrierTrialsApi
Version 1 · Document the BarrierTrialsApi comment-import API and its EF Core persistence
BarrierTrialsApi
Imports steward / in-running comments for barrier-trial runners and writes them onto matching trial_run records. It is the only project using EF Core (Pomelo MySQL) rather than raw ADO.NET.
SDK: Microsoft.NET.Sdk.Web. Key packages: Microsoft.EntityFrameworkCore 8.0.26, Pomelo.EntityFrameworkCore.MySql 8.0.3, Swashbuckle.AspNetCore 6.6.2. Project reference: Domain.
Startup
Program.cs registers OdinDbContext with UseMySql (auto-detected server version) from the DefaultConnection connection string, registers IBarrierTrialsCommentService → BarrierTrialsCommentService (scoped), a health check at /health, ExceptionMiddleware, Swagger (dev only), and controllers.
Endpoint
BarrierTrialsController exposes POST /api/BarrierTrials/import-comments (service injected via primary constructor; validates meeting_date).
Request — BarrierTrialsCommentImportRequest:
MeetingDto—meeting_date(DateOnly),course,discipline(regex^(T|G|H)$).RunnerDto[]—horse,comment_long,comment_short.
Response — BarrierTrialsCommentImportResponse with a per-runner result summary.
Service
BarrierTrialsCommentService matches incoming runners to TrialRuns by normalized horse name + course + date + discipline, updates OfficialInrunning / OfficialInrunningShort, and returns a per-runner outcome. OdinDbContext is injected via a primary constructor.
Persistence
OdinDbContext exposes DbSet<TrialRun> TrialRuns and DbSet<Course> Courses. The entities come from the shared Domain project. The default connection targets the temp-qdg database.
Related
- Entities are defined in the
Domainlibrary — see [[overview]].