Add Announcements and Dashboard controllers with all DTOs
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace RacePlannerApi.DTOs;
|
||||
|
||||
public class CreateAnnouncementRequest
|
||||
{
|
||||
[Required]
|
||||
public Guid EventId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(5000)]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class UpdateAnnouncementRequest
|
||||
{
|
||||
[MaxLength(200)]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[MaxLength(5000)]
|
||||
public string? Content { get; set; }
|
||||
|
||||
public bool? IsPublished { get; set; }
|
||||
}
|
||||
|
||||
public class AnnouncementDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid EventId { get; set; }
|
||||
public string EventName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public Guid AuthorId { get; set; }
|
||||
public string AuthorName { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public bool IsPublished { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace RacePlannerApi.DTOs;
|
||||
|
||||
public class OrganizerDashboardDto
|
||||
{
|
||||
public int TotalEvents { get; set; }
|
||||
public int PublishedEvents { get; set; }
|
||||
public int DraftEvents { get; set; }
|
||||
public int TotalRegistrations { get; set; }
|
||||
public int PendingRegistrations { get; set; }
|
||||
public int ConfirmedRegistrations { get; set; }
|
||||
public int CancelledRegistrations { get; set; }
|
||||
public decimal TotalRevenue { get; set; }
|
||||
public List<EventSummaryDto> UpcomingEvents { get; set; } = new();
|
||||
public List<EventCapacityDto> EventsNearCapacity { get; set; } = new();
|
||||
}
|
||||
|
||||
public class EventSummaryDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Location { get; set; } = string.Empty;
|
||||
public int RegistrationCount { get; set; }
|
||||
public int? MaxParticipants { get; set; }
|
||||
}
|
||||
|
||||
public class EventCapacityDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public int RegistrationCount { get; set; }
|
||||
public int? MaxParticipants { get; set; }
|
||||
public double CapacityPercentage => MaxParticipants.HasValue && MaxParticipants.Value > 0
|
||||
? (double)RegistrationCount / MaxParticipants.Value * 100
|
||||
: 0;
|
||||
}
|
||||
|
||||
public class ParticipantDashboardDto
|
||||
{
|
||||
public int TotalRegistrations { get; set; }
|
||||
public int UpcomingEvents { get; set; }
|
||||
public int CompletedEvents { get; set; }
|
||||
public int CancelledRegistrations { get; set; }
|
||||
public List<RegistrationSummaryDto> MyRegistrations { get; set; } = new();
|
||||
public List<UpcomingEventDto> UpcomingEventList { get; set; } = new();
|
||||
}
|
||||
|
||||
public class RegistrationSummaryDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid EventId { get; set; }
|
||||
public string EventName { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public DateTime RegisteredAt { get; set; }
|
||||
}
|
||||
|
||||
public class UpcomingEventDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Location { get; set; } = string.Empty;
|
||||
public int DaysUntil => (EventDate - DateTime.UtcNow).Days;
|
||||
}
|
||||
Reference in New Issue
Block a user