Files
DS-Cristiano/BlogPlatform/BlogPlatform/Models/User.cs
2025-10-17 08:43:33 +02:00

20 lines
687 B
C#

using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace BlogPlatform.Models;
// Making Email and Username being unique
[Index(nameof(Username), IsUnique = true)]
[Index(nameof(Email), IsUnique = true)]
public class User
{
[Key] public int Id { get; set; }
[Required,Length(3,20)] public string? Username { get; set; }
[Required, Length(3,50)] public string? Email { get; set; }
[Required] public string? Password { get; set; }
[Required,Length(24,24)] public string? Salt { get; set; }
public DateOnly CreatedAt { get; set; }
public List<Comment>? Comments { get; set; }
public List<Post>? Posts { get; set; }
}