app update
All checks were successful
Build and Deploy / deploy (push) Successful in 42s

This commit is contained in:
2026-02-24 14:48:02 +00:00
parent cd2994d7eb
commit 502d48da99
5 changed files with 361 additions and 33 deletions

View File

@@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace SilverLabs.Website.Models;
public class DeveloperApplication
public class DeveloperApplication : IValidatableObject
{
[Required(ErrorMessage = "Full name is required")]
[StringLength(100, MinimumLength = 2)]
@@ -25,8 +25,6 @@ public class DeveloperApplication
[MinLength(1, ErrorMessage = "Please select at least one platform")]
public List<string> Platforms { get; set; } = new();
public string? Skills { get; set; }
[Required(ErrorMessage = "Password is required")]
[StringLength(100, MinimumLength = 8, ErrorMessage = "Password must be at least 8 characters")]
public string Password { get; set; } = string.Empty;
@@ -35,9 +33,36 @@ public class DeveloperApplication
[Compare("Password", ErrorMessage = "Passwords do not match")]
public string ConfirmPassword { get; set; } = string.Empty;
[Required(ErrorMessage = "Please tell us how you'll contribute")]
[StringLength(2000, MinimumLength = 20, ErrorMessage = "Please write at least 20 characters")]
public string Motivation { get; set; } = string.Empty;
// Tester-specific
public int? InternetUnderstanding { get; set; }
public int? EnjoysTesting { get; set; }
// Developer-specific
public string? ExperienceRange { get; set; }
public List<string> SelectedSkills { get; set; } = new();
// Shared optional
public string? AdditionalNotes { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (Role == ApplicationRole.Tester)
{
if (!InternetUnderstanding.HasValue || InternetUnderstanding < 1 || InternetUnderstanding > 5)
yield return new ValidationResult("Please rate your internet understanding", new[] { nameof(InternetUnderstanding) });
if (!EnjoysTesting.HasValue || EnjoysTesting < 1 || EnjoysTesting > 5)
yield return new ValidationResult("Please rate your enthusiasm for testing", new[] { nameof(EnjoysTesting) });
}
else if (Role == ApplicationRole.Developer)
{
if (string.IsNullOrWhiteSpace(ExperienceRange))
yield return new ValidationResult("Please select your experience level", new[] { nameof(ExperienceRange) });
if (SelectedSkills.Count == 0)
yield return new ValidationResult("Please select at least one skill", new[] { nameof(SelectedSkills) });
}
}
}
public enum ApplicationRole