Add AuthScopedValidator and register FluentValidation

Introduced AuthScopedValidator to enforce non-empty AddedWho on IAuthScoped entities with a clear error message. Registered all validators from the assembly in DI to enable automatic validation for authentication-scoped entities.
This commit is contained in:
2025-12-17 11:37:58 +01:00
parent 9b800dce20
commit 752f781f54
2 changed files with 18 additions and 0 deletions

View File

@@ -1,7 +1,9 @@
using DigitalData.Core.Infrastructure;
using FluentValidation;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using ReC.Application.Common.Interfaces;
using ReC.Application.Common.Validations;
using ReC.Domain.Entities;
namespace ReC.Infrastructure;
@@ -23,6 +25,8 @@ public static class DependencyInjection
services.AddDbRepository(opt => opt.RegisterFromAssembly<TRecDbContext>(typeof(RecActionView).Assembly));
services.AddValidatorsFromAssembly(typeof(AuthScopedValidator).Assembly);
return services;
}