diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2020-12-04 20:05:04 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-04 20:05:04 -0500 |
| commit | 4e6584c345a45c3ac46ac3aa95d39472eb6fbcbf (patch) | |
| tree | b40c4f5fc23e6a818ed8c48ac4088dff77cddb35 /Jellyfin.Data | |
| parent | 3980b5ce9f6a6cbd3c0eed5316f9f0758e0fa542 (diff) | |
| parent | 76250a88959fa54646b45bbbb412dfeda30d556d (diff) | |
Merge pull request #4652 from crobibero/display-preferences
Add support for custom item display preferences
Diffstat (limited to 'Jellyfin.Data')
| -rw-r--r-- | Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs | 90 | ||||
| -rw-r--r-- | Jellyfin.Data/Entities/DisplayPreferences.cs | 12 | ||||
| -rw-r--r-- | Jellyfin.Data/Jellyfin.Data.csproj | 2 |
3 files changed, 102 insertions, 2 deletions
diff --git a/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs b/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs new file mode 100644 index 0000000000..511e3b281a --- /dev/null +++ b/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs @@ -0,0 +1,90 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Jellyfin.Data.Entities +{ + /// <summary> + /// An entity that represents a user's custom display preferences for a specific item. + /// </summary> + public class CustomItemDisplayPreferences + { + /// <summary> + /// Initializes a new instance of the <see cref="CustomItemDisplayPreferences"/> class. + /// </summary> + /// <param name="userId">The user id.</param> + /// <param name="itemId">The item id.</param> + /// <param name="client">The client.</param> + /// <param name="preferenceKey">The preference key.</param> + /// <param name="preferenceValue">The preference value.</param> + public CustomItemDisplayPreferences(Guid userId, Guid itemId, string client, string preferenceKey, string preferenceValue) + { + UserId = userId; + ItemId = itemId; + Client = client; + Key = preferenceKey; + Value = preferenceValue; + } + + /// <summary> + /// Initializes a new instance of the <see cref="CustomItemDisplayPreferences"/> class. + /// </summary> + protected CustomItemDisplayPreferences() + { + } + + /// <summary> + /// Gets or sets the Id. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; protected set; } + + /// <summary> + /// Gets or sets the user Id. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets the id of the associated item. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + public Guid ItemId { get; set; } + + /// <summary> + /// Gets or sets the client string. + /// </summary> + /// <remarks> + /// Required. Max Length = 32. + /// </remarks> + [Required] + [MaxLength(32)] + [StringLength(32)] + public string Client { get; set; } + + /// <summary> + /// Gets or sets the preference key. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + [Required] + public string Key { get; set; } + + /// <summary> + /// Gets or sets the preference value. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + [Required] + public string Value { get; set; } + } +} diff --git a/Jellyfin.Data/Entities/DisplayPreferences.cs b/Jellyfin.Data/Entities/DisplayPreferences.cs index 701e4df004..1a8ca1da37 100644 --- a/Jellyfin.Data/Entities/DisplayPreferences.cs +++ b/Jellyfin.Data/Entities/DisplayPreferences.cs @@ -17,10 +17,12 @@ namespace Jellyfin.Data.Entities /// Initializes a new instance of the <see cref="DisplayPreferences"/> class. /// </summary> /// <param name="userId">The user's id.</param> + /// <param name="itemId">The item id.</param> /// <param name="client">The client string.</param> - public DisplayPreferences(Guid userId, string client) + public DisplayPreferences(Guid userId, Guid itemId, string client) { UserId = userId; + ItemId = itemId; Client = client; ShowSidebar = false; ShowBackdrop = true; @@ -59,6 +61,14 @@ namespace Jellyfin.Data.Entities public Guid UserId { get; set; } /// <summary> + /// Gets or sets the id of the associated item. + /// </summary> + /// <remarks> + /// Required. + /// </remarks> + public Guid ItemId { get; set; } + + /// <summary> /// Gets or sets the client string. /// </summary> /// <remarks> diff --git a/Jellyfin.Data/Jellyfin.Data.csproj b/Jellyfin.Data/Jellyfin.Data.csproj index 9ae129d072..89d6f4d9b7 100644 --- a/Jellyfin.Data/Jellyfin.Data.csproj +++ b/Jellyfin.Data/Jellyfin.Data.csproj @@ -29,7 +29,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> + <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> </ItemGroup> <!-- Code analysers--> |
