cost-savings-api
ASP.NET Core 8 API that records and serves cost savings agents achieve on bookings, kept in sync with booking changes via a MassTransit/SQS consumer and backed by MongoDB.
Health score
0 to 100 across seven weighted factors; nothing is hidden. Green is 75 and above, amber 50 to 74, red below 50. How scoring works.
Facts
| Languages | csharp |
| Frameworks | ASP.NET Core 8, MediatR, FluentValidation 12, MassTransit 8, Serilog |
| Runtimes | .NET 8 |
| Tests / CI | good / CI in place |
| Last commit | 2025-12-31 |
| Owner | Owner unknown (mapping to be curated) |
| Domain | Data and insight (system generated; curate in repo-owners.json to override) |
| Product area | Shared platform |
| Hosted | AWS Deployed to AWS
|
| Releases | 0 release pipeline(s): |
| Integration | rest, jwt, masstransit, sqs, wcf |
| Source | Open in Azure DevOps |
Risk flags
No risk flags recorded.
Each flag links to its glossary definition.
Dependencies in context
Entanglement
loosely attached Bound into the core by 1 mechanism(s).
- Speaks WCF (client)
Detaches when its WCF surface gains a modern interface or its WCF calls move to one.
Depends on / used by
Migration playbooks
Generated from this repo's assessment data: what is feasible, what blocks it, and the steps in order. Ratings: green means actionable now, amber means sequence other work first, red means blocked, grey means not applicable.
ZDD adoption
No excuseNothing technical is holding this repo on the three-week release. It either already deploys without downtime (AWS) or is a modern, well-tested service the automated stealth path can carry today. Already deploys as a container to AWS, which releases without downtime today. Separating it from the three-week release is a process decision, not a technical one.
- Consumes WCF contract packages: never take a breaking client bump mid-feature, and treat obsolete warnings as migration debt
- Serialized state or messages in flight (Redis or queues): new code must deserialize objects written by the previous version
- Adopt the four-stage discipline from the ZDD engineering standard: pre-deployment compatibility, deployment, feature activation behind a flag, post-release cleanup.
- Make every change dual-version safe: backwards-compatible APIs (new major version for breaking wire changes), expand and contract for any schema change, and consumers tolerant of unknown fields.
- Audit serialized data: anything in Redis, queues or shared caches must deserialize cleanly across adjacent versions.
- Wrap behaviour changes in feature flags so code deploys dark and release becomes a business decision, not a deployment event.
- Use ECS rolling deployments with health checks gating traffic, and take this service off the three-week release train.
- Verify with area-scoped regression rather than the whole-platform cycle, and watch error rates after rollout with automated rollback on alert.
SQL Server exit
Not applicableNo SQL Server dependency is recorded for this repo. Nothing to migrate.
Containerisation
Already containerisedIts pipelines already build containers and deploy to AWS. Nothing to do here.
Recommended actions
No specific actions for this repo. It either needs only normal maintenance, or its work is covered by an estate-level action. See the full programme.
Assessment notes
cost-savings-api
Purpose
CRUD API for "cost savings" — the discounts/savings a travel counsellor achieves against booking components — with a Reasons reference-data controller, per-component validation (standard, flight, fare, ticket types), and a BookingChangedConsumer that keeps saved cost savings aligned with booking changes arriving over MassTransit/Amazon SQS. A separate TC.CostSavings.Importer console backfills or re-imports cost savings by pulling bookings from the backoffice Accounts GraphQL API and the Phenix booking WCF service.
Tech stack
C# on .NET 8, layered solution (API, Application, Common, DataAccess, Domain, Messaging, Importer). MediatR pipeline with validation and current-user behaviors, FluentValidation 12, Serilog with an S3 request/response logging sink, Asp.Versioning, Swashbuckle, Phenix.Auth.JWTBearer, TC.ConnectionBroker 1.20 (Api/Aws/Mongo/HttpClient), MongoDB.Driver 3.4 with TC.ScriptRunner.Mongo change scripts, MassTransit 8.5 + TC.MassTransit.AmazonSQS; the importer additionally uses Dapper/Microsoft.Data.SqlClient and ConnectionBroker Sql/Wcf.
Deployment
No classic release pipelines (release_count 0); traced via build->yaml-deploy, build pipeline cost-savings-api. azure-pipelines.yml uses the shared InternalOSS/azure-pipelines-templates ci.yml to container-build TC.CostSavings.API (.NET 8 SDK, containerAfterBuild, useTFVarsDeployment, functional area/namespace phenix, eu-west-1) for ECS; a second build.yaml packs TC.CostSavings.Domain as a NuGet package (consumed elsewhere, e.g. the streams-masstransit adapter). Per-environment appsettings for qa/preproduction/production.
Dependencies
Internal: TC.ConnectionBroker.* (tc-connectionbroker), TC.Exceptions.WebApiClient.AspNetCore (tc-exceptions), TC.Diagnostics.HealthChecks (tc-diagnostics-portal), the backoffice Accounts GraphQL API and TC.Phenix.Accounts.Events contracts (backoffice), TC.StreamsMassTransitAdapter.Events (tc-streams-masstransit-adapter). TC.Phenix.Services.Client (importer's WCF booking service) and TC.MassTransit.AmazonSQS map to no included repo with confidence. External: AWS (SQS eu-west-1, S3 logging buckets).
Data stores
Owns the CostSavings MongoDB database (CostSavings and Reasons collections, script-runner change scripts, Mongo health check). Writes request/response logs to per-environment S3 buckets (tc-costsavings-api-{qa,stg,prod}-request-response-logs). The importer also reads booking data from SQL via Dapper for backfills.
Integration points
Inbound REST with Phenix JWT bearer auth and API versioning; inbound BookingChangedEvent messages via MassTransit over Amazon SQS; the importer makes outbound GraphQL calls to backoffice Accounts and WCF calls to the Phenix booking service.
Code health
Good: five xUnit test projects (~189 Fact/Theory tests) covering handlers, validators, component merging, messaging consumers and domain calculations. README is a single pointer to an Azure DevOps wiki page — documentation lives off-repo. Clean configuration-by-extension structure. Last commit 2025-12-31.
Modernisation risks
Low — modern .NET 8, containerised ECS deployment via Terraform tfvars, solid tests and YAML CI. Residual concerns: correctness depends on upstream BookingChangedEvent/accounts contracts (schema drift risk), the importer retains legacy WCF and direct SQL paths into backoffice for backfills, and in-repo documentation is minimal.