feature: Site & Gateway Registry + Clinical Sync Contracts

This commit is contained in:
voltsrage
2026-06-23 04:31:15 +08:00
parent c9994b1ba2
commit efe5419da4
24 changed files with 547 additions and 19 deletions
@@ -0,0 +1,12 @@
using FluentValidation;
public class CreateSiteRequestValidator : AbstractValidator<CreateSiteRequest>
{
public CreateSiteRequestValidator()
{
RuleFor(x => x.SiteCode).NotEmpty().MaximumLength(32)
.Matches("^[A-Z0-9-]+$").WithMessage("SiteCode must be uppercase alphanumeric with hyphens.");
RuleFor(x => x.Name).NotEmpty().MaximumLength(200);
RuleFor(x => x.Address).MaximumLength(500);
}
}
@@ -0,0 +1,16 @@
using FluentValidation;
using VigilCare.ClinicalContracts.Sync;
public class GatewayHeartbeatRequestValidator : AbstractValidator<GatewayHeartbeatRequest>
{
private static readonly string[] AllowedStatuses = ["ONLINE", "DEGRADED", "OFFLINE"];
public GatewayHeartbeatRequestValidator()
{
RuleFor(x => x.Status).NotEmpty()
.Must(s => AllowedStatuses.Contains(s.ToUpperInvariant()))
.WithMessage("Status must be ONLINE, DEGRADED, or OFFLINE.");
RuleFor(x => x.BufferDepth).GreaterThanOrEqualTo(0);
RuleFor(x => x.ReportedAtUtc).NotEmpty();
}
}
@@ -0,0 +1,10 @@
using FluentValidation;
public class RegisterGatewayRequestValidator : AbstractValidator<RegisterGatewayRequest>
{
public RegisterGatewayRequestValidator()
{
RuleFor(x => x.GatewayCode).NotEmpty().MaximumLength(64);
RuleFor(x => x.Department).NotEmpty().MaximumLength(100);
}
}