mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2025-12-31 04:00:03 +01:00
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace MaksIT.Models.LetsEncryptServer.Account.Requests {
|
|
public class PostAccountRequest : IValidatableObject {
|
|
public required string Description { get; set; }
|
|
public required string[] Contacts { get; set; }
|
|
public required string[] Hostnames { get; set; }
|
|
|
|
public required string ChallengeType { get; set; }
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
|
|
if (string.IsNullOrWhiteSpace(Description))
|
|
yield return new ValidationResult("Description is required", new[] { nameof(Description) });
|
|
|
|
if (Contacts == null || Contacts.Length == 0)
|
|
yield return new ValidationResult("Contacts is required", new[] { nameof(Contacts) });
|
|
|
|
if (Hostnames == null || Hostnames.Length == 0)
|
|
yield return new ValidationResult("Hostnames is required", new[] { nameof(Hostnames) });
|
|
|
|
if (string.IsNullOrWhiteSpace(ChallengeType) && ChallengeType != "http-01")
|
|
yield return new ValidationResult("ChallengeType is required", new[] { nameof(ChallengeType) });
|
|
}
|
|
}
|
|
}
|