Add Events, Registrations, and Payments controllers with DTOs
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using RacePlannerApi.Models;
|
||||
|
||||
namespace RacePlannerApi.DTOs;
|
||||
|
||||
public class CreateEventRequest
|
||||
{
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public DateTime EventDate { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(500)]
|
||||
public string Location { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; } = new();
|
||||
|
||||
public int? MaxParticipants { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateEventRequest
|
||||
{
|
||||
[MaxLength(200)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[MaxLength(2000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public DateTime? EventDate { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Location { get; set; }
|
||||
|
||||
public EventStatus? Status { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
public List<string>? Tags { get; set; }
|
||||
|
||||
public int? MaxParticipants { get; set; }
|
||||
}
|
||||
|
||||
public class EventDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public string Location { get; set; } = string.Empty;
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public string? Category { get; set; }
|
||||
public List<string> Tags { get; set; } = new();
|
||||
public int? MaxParticipants { get; set; }
|
||||
public int CurrentRegistrations { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public UserSummaryDto Organizer { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class EventFilterRequest
|
||||
{
|
||||
public string? Category { get; set; }
|
||||
public List<string>? Tags { get; set; }
|
||||
public DateTime? FromDate { get; set; }
|
||||
public DateTime? ToDate { get; set; }
|
||||
public string? Status { get; set; }
|
||||
public Guid? OrganizerId { get; set; }
|
||||
}
|
||||
|
||||
public class UserSummaryDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using RacePlannerApi.Models;
|
||||
|
||||
namespace RacePlannerApi.DTOs;
|
||||
|
||||
public class CreatePaymentRequest
|
||||
{
|
||||
[Required]
|
||||
public Guid RegistrationId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(0.01, double.MaxValue)]
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
[Required]
|
||||
public PaymentMethod Method { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? TransactionId { get; set; }
|
||||
|
||||
[MaxLength(500)]
|
||||
public string? Notes { get; set; }
|
||||
|
||||
public DateTime? PaymentDate { get; set; }
|
||||
}
|
||||
|
||||
public class PaymentDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid RegistrationId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public string Method { get; set; } = string.Empty;
|
||||
public string? TransactionId { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public DateTime PaymentDate { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
public class PaymentReportDto
|
||||
{
|
||||
public Guid EventId { get; set; }
|
||||
public string EventName { get; set; } = string.Empty;
|
||||
public decimal TotalCollected { get; set; }
|
||||
public decimal TotalPending { get; set; }
|
||||
public decimal TotalOutstanding { get; set; }
|
||||
public int TotalRegistrations { get; set; }
|
||||
public int PaidRegistrations { get; set; }
|
||||
public int PartialRegistrations { get; set; }
|
||||
public int UnpaidRegistrations { get; set; }
|
||||
public List<RegistrationPaymentDto> Registrations { get; set; } = new();
|
||||
}
|
||||
|
||||
public class RegistrationPaymentDto
|
||||
{
|
||||
public Guid RegistrationId { get; set; }
|
||||
public string ParticipantName { get; set; } = string.Empty;
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public decimal TotalPaid { get; set; }
|
||||
public decimal AmountDue { get; set; }
|
||||
public string PaymentStatus { get; set; } = string.Empty;
|
||||
public List<PaymentDto> Payments { get; set; } = new();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using RacePlannerApi.Models;
|
||||
|
||||
namespace RacePlannerApi.DTOs;
|
||||
|
||||
public class CreateRegistrationRequest
|
||||
{
|
||||
[Required]
|
||||
public Guid EventId { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
[MaxLength(200)]
|
||||
public string? EmergencyContact { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateRegistrationRequest
|
||||
{
|
||||
public RegistrationStatus? Status { get; set; }
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
[MaxLength(200)]
|
||||
public string? EmergencyContact { get; set; }
|
||||
}
|
||||
|
||||
public class RegistrationDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid EventId { get; set; }
|
||||
public string EventName { get; set; } = string.Empty;
|
||||
public DateTime EventDate { get; set; }
|
||||
public Guid ParticipantId { get; set; }
|
||||
public string ParticipantName { get; set; } = string.Empty;
|
||||
public string ParticipantEmail { get; set; } = string.Empty;
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public string? Category { get; set; }
|
||||
public string? EmergencyContact { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public decimal TotalPaid { get; set; }
|
||||
public decimal AmountDue { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user