This commit is contained in:
@@ -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
|
||||
|
||||
37
BlazorApp/Models/SkillCatalog.cs
Normal file
37
BlazorApp/Models/SkillCatalog.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace SilverLabs.Website.Models;
|
||||
|
||||
public static class SkillCatalog
|
||||
{
|
||||
public static readonly string[] ExperienceRanges =
|
||||
{
|
||||
"< 1 year",
|
||||
"1-3 years",
|
||||
"3-5 years",
|
||||
"5-10 years",
|
||||
"10+ years"
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string[]> SkillCategories = new()
|
||||
{
|
||||
["Languages"] = new[]
|
||||
{
|
||||
"C#", "Python", "JavaScript", "TypeScript", "Go", "Rust",
|
||||
"Java", "C/C++", "PHP", "Ruby", "Swift", "Kotlin"
|
||||
},
|
||||
["Frameworks"] = new[]
|
||||
{
|
||||
".NET/Blazor", "React", "Angular", "Vue", "Django",
|
||||
"Node.js", "Next.js", "Svelte", "Spring Boot", "Flask"
|
||||
},
|
||||
["Infrastructure"] = new[]
|
||||
{
|
||||
"Docker", "Kubernetes", "Linux", "Nginx", "Terraform",
|
||||
"CI/CD", "AWS", "Azure", "Proxmox"
|
||||
},
|
||||
["Databases"] = new[]
|
||||
{
|
||||
"PostgreSQL", "MySQL", "SQLite", "MongoDB", "Redis",
|
||||
"SQL Server", "Elasticsearch"
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user