Files
chapter-organizer/Core/Entities/EventDefinition.cs
T
poprhythm 06b2db0b4c Add Related Careers functionality to EventDefinition entity and update related components
Introduced a many-to-many relationship between EventDefinition and Career entities, allowing for the association of multiple careers with an event. Updated the AppDbContext to include a DbSet for Careers and modified the EventDefinitionConfiguration to handle the new relationship. Enhanced the Create, Edit, and Details components to support input and display of related careers, including normalization and processing logic for career names. Updated the database schema to reflect these changes.
2025-12-28 15:22:03 -05:00

98 lines
3.2 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace Core.Entities;
public class EventDefinition
{
public int Id { get; set; }
[Required]
[StringLength(100, MinimumLength = 2)]
[Display(Name = "Event Name")]
public string Name { get; set; } = null!;
[Required]
[StringLength(40, MinimumLength = 2)]
[Display(Name = "Event Short Name")]
public string? ShortName { get; set; }
[Required]
public EventFormat EventFormat { get; set; }
[Range(1, 6)]
public int MinTeamSize { get; set; }
[Range(1, 6)]
public int MaxTeamSize { get; set; }
public string TeamSize =>
MinTeamSize == MaxTeamSize
? MinTeamSize.ToString()
: $"{MinTeamSize.ToString()}-{MaxTeamSize.ToString()}";
[StringLength(100, MinimumLength = 3)]
public string? SemifinalistActivity { get; set; }
public bool InterviewOrPresentation
=> SemifinalistActivity != null && (SemifinalistActivity.Contains("Interview") || SemifinalistActivity.Contains("Presentation"));
public bool OnSiteActivity { get; set; }
//=> SemifinalistActivity != null
// && (SemifinalistActivity.Contains("Challenge")
// || SemifinalistActivity.Contains("Race")
// || SemifinalistActivity.Contains("Speech")
// || SemifinalistActivity.Contains("Test")
// || SemifinalistActivity.Contains("Flight")
// || Name.Contains("Leadership")
// || Name.Contains("Forensic")
// || Name.Contains("Flight")
// || Name.Contains("Coding")
// || SemifinalistActivity.Contains("Debate")
// || SemifinalistActivity.Contains("Photography")
// || SemifinalistActivity.Contains("Build")
// || Name.Contains("Chapter")
// || Name.Contains("Podcast"));
[StringLength(1024, MinimumLength = 3)]
public string? Notes { get; set; }
[Range(0, 3)]
public int ChapterEligibilityCountRegionals { get; set; }
[Range(1, 3)]
public int ChapterEligibilityCountState { get; set; }
public bool RegionalEvent => ChapterEligibilityCountRegionals > 0;
public bool Presubmission { get; set; }
[StringLength(64)]
public string? Documentation { get; set; }
[Required]
[StringLength(256)]
public string Eligibility { get; set; } = null!;
[StringLength(4096)]
public string? Theme { get; set; }
[StringLength(1024)]
public string? Description { get; set; }
public int? LevelOfEffort { get; set; }
public ICollection<Career> RelatedCareers { get; set; } = new List<Career>();
[System.ComponentModel.DataAnnotations.Schema.NotMapped]
public string? RelatedCareersText { get; set; }
public override string ToString()
{
return Name;
}
public static readonly EventDefinition GeneralSchedule = new(){Name = "General Schedule"};
public static readonly EventDefinition MeetTheCandidates = new(){Name = "Meet the Candidates"};
public static readonly EventDefinition ChapterOfficerMeeting = new(){Name = "Chapter Officer Meeting"};
public static readonly EventDefinition VotingDelegateMeeting = new(){Name = "Voting Delegate Meeting"};
public static readonly EventDefinition SocialGathering = new(){Name = "Social Gathering"};
}