Files
raceplanner/backend/Models/User.cs
T
2026-04-03 20:55:58 +02:00

35 lines
822 B
C#

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
}