Remove FluentValidation; validator/DI cleanup #7

Merged
wamplerj merged 6 commits from fluent-validator-gone into main 2026-07-05 22:54:31 -07:00

6 Commits

Author SHA1 Message Date
miccheck-ci
d4feca8ad4 chore: refresh coverage badge [skip ci] 2026-07-06 05:54:20 +00:00
James Wampler
7b51100ab6 Split Program.cs DI registrations into per-namespace DependencyRegistration classes
All checks were successful
CI / build-and-push (push) Successful in 45s
CI / deploy-qa (push) Has been skipped
CI / smoke-qa (push) Has been skipped
Each root namespace (Audit, Common, Data, Environments, Features/Usage,
Identities, Organizations, Projects, Segments, Users, Webhooks) gets its
own static DependencyRegistration class exposing an Add<Name>Services
extension method, so Program.cs just wires them together instead of
listing every registration inline.
2026-07-05 22:39:52 -07:00
James Wampler
f920a6d0a5 Extract IAuditService, drop virtual mock seam from AuditService
Consumers now depend on IAuditService instead of the concrete class,
so tests mock the interface (Mock<IAuditService>()) rather than
subclassing AuditService via virtual methods.
2026-07-05 22:30:10 -07:00
James Wampler
75595970fb Convert logic-free classes to records per CLAUDE.md
WebhookEvent, FeatureStateResult, ProjectPermissionRequirement, AuditLog,
Tag, and FeatureUsageDaily are plain data holders with no behavior, so
switch them to records. EF-mapped entities with identity semantics
(User, Organization, Project, Feature, Segment, etc.) stay classes,
since record value-equality and deep ToString fight EF's change tracker.

Also restore `virtual` on AuditService.RecordAsync/LogAsync, which had
been dropped and broke Mock<AuditService>-based test setups.
2026-07-05 22:20:41 -07:00
James Wampler
27497e31a9 Move FeatureUsage code into MicCheck.Api.Features.Usage namespace
Groups usage-tracking (metrics, background flush, query service,
controller, entity) under its own namespace/folder, updates all
consumers and the EF migration snapshot's CLR type strings to match.
2026-07-05 22:00:13 -07:00
James Wampler
bdc85a1f3a Remove FluentValidation dependency, use plain .NET validation
Replace AbstractValidator-based request validators with a small
IModelValidator<T>/ValidationResult pattern (ported from BuyEngine's
Common namespace), wired into the MVC pipeline via a
ModelValidationActionFilter so controllers and response shape are
unaffected. Also copy over the Guard precondition helper.
2026-07-05 21:57:35 -07:00