WIP: Project setup with .NET backend and Next.js frontend
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace RacePlannerApi.Models;
|
||||
|
||||
public class Announcement
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(5000)]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public Guid EventId { get; set; }
|
||||
|
||||
[ForeignKey("EventId")]
|
||||
public Event Event { get; set; } = null!;
|
||||
|
||||
[Required]
|
||||
public Guid AuthorId { get; set; }
|
||||
|
||||
[ForeignKey("AuthorId")]
|
||||
public User Author { get; set; } = null!;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
public bool IsPublished { get; set; } = true;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace RacePlannerApi.Models;
|
||||
|
||||
public class Event
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[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;
|
||||
|
||||
public EventStatus Status { get; set; } = EventStatus.Draft;
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; } = new List<string>();
|
||||
|
||||
public int? MaxParticipants { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Foreign keys
|
||||
[Required]
|
||||
public Guid OrganizerId { get; set; }
|
||||
|
||||
[ForeignKey("OrganizerId")]
|
||||
public User Organizer { get; set; } = null!;
|
||||
|
||||
// Navigation properties
|
||||
public ICollection<Registration> Registrations { get; set; } = new List<Registration>();
|
||||
public ICollection<Announcement> Announcements { get; set; } = new List<Announcement>();
|
||||
}
|
||||
|
||||
public enum EventStatus
|
||||
{
|
||||
Draft,
|
||||
Published,
|
||||
Cancelled,
|
||||
Completed
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace RacePlannerApi.Models;
|
||||
|
||||
public class Payment
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
public Guid RegistrationId { get; set; }
|
||||
|
||||
[ForeignKey("RegistrationId")]
|
||||
public Registration Registration { get; set; } = null!;
|
||||
|
||||
[Required]
|
||||
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; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public enum PaymentMethod
|
||||
{
|
||||
Cash,
|
||||
Online,
|
||||
Transfer
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace RacePlannerApi.Models;
|
||||
|
||||
public class Registration
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
public Guid EventId { get; set; }
|
||||
|
||||
[ForeignKey("EventId")]
|
||||
public Event Event { get; set; } = null!;
|
||||
|
||||
[Required]
|
||||
public Guid ParticipantId { get; set; }
|
||||
|
||||
[ForeignKey("ParticipantId")]
|
||||
public User Participant { get; set; } = null!;
|
||||
|
||||
public RegistrationStatus Status { get; set; } = RegistrationStatus.Pending;
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? Category { get; set; }
|
||||
|
||||
[MaxLength(200)]
|
||||
public string? EmergencyContact { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
public ICollection<Payment> Payments { get; set; } = new List<Payment>();
|
||||
}
|
||||
|
||||
public enum RegistrationStatus
|
||||
{
|
||||
Pending,
|
||||
Confirmed,
|
||||
Cancelled,
|
||||
Completed
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace RacePlannerApi.Models;
|
||||
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string PasswordHash { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public UserRole Role { get; set; } = UserRole.Participant;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation properties
|
||||
public ICollection<Event> OrganizedEvents { get; set; } = new List<Event>();
|
||||
public ICollection<Registration> Registrations { get; set; } = new List<Registration>();
|
||||
}
|
||||
|
||||
public enum UserRole
|
||||
{
|
||||
Participant,
|
||||
Organizer
|
||||
}
|
||||
Reference in New Issue
Block a user