From aa811eb1e3c78bdf8f4a751311c1bb6d639e851e Mon Sep 17 00:00:00 2001 From: JPVenson Date: Sun, 26 Jan 2025 20:45:28 +0000 Subject: Prepared Seperation of Database components for future multi provider support --- .../Entities/Libraries/Library.cs | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Library.cs (limited to 'Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Library.cs') diff --git a/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Library.cs b/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Library.cs new file mode 100644 index 000000000..0db42a1c7 --- /dev/null +++ b/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/Library.cs @@ -0,0 +1,60 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Jellyfin.Data.Interfaces; + +namespace Jellyfin.Data.Entities.Libraries +{ + /// + /// An entity representing a library. + /// + public class Library : IHasConcurrencyToken + { + /// + /// Initializes a new instance of the class. + /// + /// The name of the library. + /// The path of the library. + public Library(string name, string path) + { + Name = name; + Path = path; + } + + /// + /// Gets the id. + /// + /// + /// Identity, Indexed, Required. + /// + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; private set; } + + /// + /// Gets or sets the name. + /// + /// + /// Required, Max length = 128. + /// + [MaxLength(128)] + [StringLength(128)] + public string Name { get; set; } + + /// + /// Gets or sets the root path of the library. + /// + /// + /// Required. + /// + public string Path { get; set; } + + /// + [ConcurrencyCheck] + public uint RowVersion { get; private set; } + + /// + public void OnSavingChanges() + { + RowVersion++; + } + } +} -- cgit v1.2.3