feat(api): validate account institution is connected and allow adding new account

This commit is contained in:
Stevan Freeborn
2026-02-13 12:33:37 -06:00
parent 9255bd2fc3
commit 14d8d4dd9e
3 changed files with 173 additions and 6 deletions
+7
View File
@@ -5,6 +5,7 @@ public record Request : IValidatableObject
{
public string PlaidInstitutionId { get; init; } = string.Empty;
public string PlaidAccountId { get; init; } = string.Empty;
public string PlaidAccountName { get; init; } = string.Empty;
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
@@ -19,5 +20,11 @@ public record Request : IValidatableObject
var fieldName = nameof(PlaidAccountId);
yield return new($"The {fieldName} field is required.", [fieldName]);
}
if (string.IsNullOrWhiteSpace(PlaidAccountName))
{
var fieldName = nameof(PlaidAccountName);
yield return new($"The {fieldName} field is required.", [fieldName]);
}
}
}