feat(mvp): complete MVP hardening — API, Web, config system, SignalR, tests

This commit is contained in:
Arnaud Dartois committed 2026-07-18 18:58:20 +00:00
1 parent 3fc42be4b2
commit c2837af089
59 files changed
+4920 -81

No files matched your search

@@ -0,0 +1,40 @@
using FluentValidation;
using Heimdall.Application.DTOs;
namespace Heimdall.Application.Validators;
public class CreateAppSettingValidator : AbstractValidator<CreateAppSettingRequest>
{
public CreateAppSettingValidator()
{
RuleFor(x => x.Key).NotEmpty().MaximumLength(200)
.Matches(@"^[a-z0-9][a-z0-9._-]*[a-z0-9]$")
.WithMessage("Key must start and end with a lowercase alphanumeric character, and contain only lowercase letters, digits, dots, hyphens, or underscores");
RuleFor(x => x.Value).NotNull();
RuleFor(x => x.Category).NotEmpty().MaximumLength(100);
RuleFor(x => x.ValueType).Must(t => t is "string" or "int" or "bool" or "double" or "select")
.WithMessage("ValueType must be one of: string, int, bool, double, select");
}
}
public class UpdateAppSettingValidator : AbstractValidator<UpdateAppSettingRequest>
{
public UpdateAppSettingValidator()
{
RuleFor(x => x.Value).NotEmpty();
When(x => x.Category is not null, () =>
RuleFor(x => x.Category!).MaximumLength(100));
When(x => x.ValueType is not null, () =>
RuleFor(x => x.ValueType!).Must(t => t is "string" or "int" or "bool" or "double" or "select")
.WithMessage("ValueType must be one of: string, int, bool, double, select"));
}
}
public class SetAgentSettingValidator : AbstractValidator<SetAgentSettingRequest>
{
public SetAgentSettingValidator()
{
RuleFor(x => x.Key).NotEmpty().MaximumLength(200);
RuleFor(x => x.Value).NotNull();
}
}