Files
Nexus.Reader/src/NexusReader.Domain/Entities/Ebook.cs
T

41 lines
968 B
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace NexusReader.Domain.Entities;
/// <summary>
/// Represents an E-book uploaded or owned by a user.
/// </summary>
public class Ebook
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
[MaxLength(255)]
public string Title { get; set; } = string.Empty;
[MaxLength(255)]
public string Author { get; set; } = "Unknown";
[Required]
public string FilePath { get; set; } = string.Empty;
public string? CoverUrl { get; set; }
[Required]
[MaxLength(128)]
public string TenantId { get; set; } = "global";
public DateTime AddedDate { get; set; } = DateTime.UtcNow;
public DateTime? LastReadDate { get; set; }
// Relationship to NexusUser
[Required]
public string UserId { get; set; } = string.Empty;
[ForeignKey(nameof(UserId))]
public NexusUser? User { get; set; }
}