DisplayPreferences.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using Jellyfin.Data.Enums;
  6. namespace Jellyfin.Data.Entities
  7. {
  8. /// <summary>
  9. /// An entity representing a user's display preferences.
  10. /// </summary>
  11. public class DisplayPreferences
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  15. /// </summary>
  16. /// <param name="client">The client string.</param>
  17. /// <param name="userId">The user's id.</param>
  18. public DisplayPreferences(string client, Guid userId)
  19. {
  20. RememberIndexing = false;
  21. ShowBackdrop = true;
  22. Client = client;
  23. UserId = userId;
  24. HomeSections = new HashSet<HomeSection>();
  25. }
  26. /// <summary>
  27. /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
  28. /// </summary>
  29. protected DisplayPreferences()
  30. {
  31. }
  32. /// <summary>
  33. /// Gets or sets the Id.
  34. /// </summary>
  35. /// <remarks>
  36. /// Required.
  37. /// </remarks>
  38. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  39. public int Id { get; protected set; }
  40. /// <summary>
  41. /// Gets or sets the user Id.
  42. /// </summary>
  43. /// <remarks>
  44. /// Required.
  45. /// </remarks>
  46. public Guid UserId { get; set; }
  47. /// <summary>
  48. /// Gets or sets the id of the associated item.
  49. /// </summary>
  50. /// <remarks>
  51. /// This is currently unused. In the future, this will allow us to have users set
  52. /// display preferences per item.
  53. /// </remarks>
  54. public Guid? ItemId { get; set; }
  55. /// <summary>
  56. /// Gets or sets the client string.
  57. /// </summary>
  58. /// <remarks>
  59. /// Required. Max Length = 64.
  60. /// </remarks>
  61. [Required]
  62. [MaxLength(64)]
  63. [StringLength(64)]
  64. public string Client { get; set; }
  65. /// <summary>
  66. /// Gets or sets a value indicating whether the indexing should be remembered.
  67. /// </summary>
  68. /// <remarks>
  69. /// Required.
  70. /// </remarks>
  71. public bool RememberIndexing { get; set; }
  72. /// <summary>
  73. /// Gets or sets a value indicating whether the sorting type should be remembered.
  74. /// </summary>
  75. /// <remarks>
  76. /// Required.
  77. /// </remarks>
  78. public bool RememberSorting { get; set; }
  79. /// <summary>
  80. /// Gets or sets the sort order.
  81. /// </summary>
  82. /// <remarks>
  83. /// Required.
  84. /// </remarks>
  85. public SortOrder SortOrder { get; set; }
  86. /// <summary>
  87. /// Gets or sets a value indicating whether to show the sidebar.
  88. /// </summary>
  89. /// <remarks>
  90. /// Required.
  91. /// </remarks>
  92. public bool ShowSidebar { get; set; }
  93. /// <summary>
  94. /// Gets or sets a value indicating whether to show the backdrop.
  95. /// </summary>
  96. /// <remarks>
  97. /// Required.
  98. /// </remarks>
  99. public bool ShowBackdrop { get; set; }
  100. /// <summary>
  101. /// Gets or sets what the view should be sorted by.
  102. /// </summary>
  103. [MaxLength(64)]
  104. [StringLength(64)]
  105. public string SortBy { get; set; }
  106. /// <summary>
  107. /// Gets or sets the view type.
  108. /// </summary>
  109. public ViewType? ViewType { get; set; }
  110. /// <summary>
  111. /// Gets or sets the scroll direction.
  112. /// </summary>
  113. /// <remarks>
  114. /// Required.
  115. /// </remarks>
  116. public ScrollDirection ScrollDirection { get; set; }
  117. /// <summary>
  118. /// Gets or sets what the view should be indexed by.
  119. /// </summary>
  120. public IndexingKind? IndexBy { get; set; }
  121. /// <summary>
  122. /// Gets or sets the home sections.
  123. /// </summary>
  124. public virtual ICollection<HomeSection> HomeSections { get; protected set; }
  125. }
  126. }