| | | 1 | | using System; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 4 | | using Jellyfin.Database.Implementations.Enums; |
| | | 5 | | |
| | | 6 | | namespace Jellyfin.Database.Implementations.Entities |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// An entity that represents a user's display preferences for a specific item. |
| | | 10 | | /// </summary> |
| | | 11 | | public class ItemDisplayPreferences |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="ItemDisplayPreferences"/> class. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="userId">The user id.</param> |
| | | 17 | | /// <param name="itemId">The item id.</param> |
| | | 18 | | /// <param name="client">The client.</param> |
| | | 19 | | public ItemDisplayPreferences(Guid userId, Guid itemId, string client) |
| | | 20 | | { |
| | 0 | 21 | | UserId = userId; |
| | 0 | 22 | | ItemId = itemId; |
| | 0 | 23 | | Client = client; |
| | | 24 | | |
| | 0 | 25 | | SortBy = "SortName"; |
| | 0 | 26 | | SortOrder = SortOrder.Ascending; |
| | 0 | 27 | | RememberSorting = false; |
| | 0 | 28 | | RememberIndexing = false; |
| | 0 | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Gets the id. |
| | | 33 | | /// </summary> |
| | | 34 | | /// <remarks> |
| | | 35 | | /// Required. |
| | | 36 | | /// </remarks> |
| | | 37 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 38 | | public int Id { get; private set; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets or sets the user Id. |
| | | 42 | | /// </summary> |
| | | 43 | | /// <remarks> |
| | | 44 | | /// Required. |
| | | 45 | | /// </remarks> |
| | | 46 | | public Guid UserId { get; set; } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Gets or sets the id of the associated item. |
| | | 50 | | /// </summary> |
| | | 51 | | /// <remarks> |
| | | 52 | | /// Required. |
| | | 53 | | /// </remarks> |
| | | 54 | | public Guid ItemId { get; set; } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Gets or sets the client string. |
| | | 58 | | /// </summary> |
| | | 59 | | /// <remarks> |
| | | 60 | | /// Required. Max Length = 32. |
| | | 61 | | /// </remarks> |
| | | 62 | | [MaxLength(32)] |
| | | 63 | | [StringLength(32)] |
| | | 64 | | public string Client { get; set; } |
| | | 65 | | |
| | | 66 | | /// <summary> |
| | | 67 | | /// Gets or sets the view type. |
| | | 68 | | /// </summary> |
| | | 69 | | /// <remarks> |
| | | 70 | | /// Required. |
| | | 71 | | /// </remarks> |
| | | 72 | | public ViewType ViewType { get; set; } |
| | | 73 | | |
| | | 74 | | /// <summary> |
| | | 75 | | /// Gets or sets a value indicating whether the indexing should be remembered. |
| | | 76 | | /// </summary> |
| | | 77 | | /// <remarks> |
| | | 78 | | /// Required. |
| | | 79 | | /// </remarks> |
| | | 80 | | public bool RememberIndexing { get; set; } |
| | | 81 | | |
| | | 82 | | /// <summary> |
| | | 83 | | /// Gets or sets what the view should be indexed by. |
| | | 84 | | /// </summary> |
| | | 85 | | public IndexingKind? IndexBy { get; set; } |
| | | 86 | | |
| | | 87 | | /// <summary> |
| | | 88 | | /// Gets or sets a value indicating whether the sorting type should be remembered. |
| | | 89 | | /// </summary> |
| | | 90 | | /// <remarks> |
| | | 91 | | /// Required. |
| | | 92 | | /// </remarks> |
| | | 93 | | public bool RememberSorting { get; set; } |
| | | 94 | | |
| | | 95 | | /// <summary> |
| | | 96 | | /// Gets or sets what the view should be sorted by. |
| | | 97 | | /// </summary> |
| | | 98 | | /// <remarks> |
| | | 99 | | /// Required. |
| | | 100 | | /// </remarks> |
| | | 101 | | [MaxLength(64)] |
| | | 102 | | [StringLength(64)] |
| | | 103 | | public string SortBy { get; set; } |
| | | 104 | | |
| | | 105 | | /// <summary> |
| | | 106 | | /// Gets or sets the sort order. |
| | | 107 | | /// </summary> |
| | | 108 | | /// <remarks> |
| | | 109 | | /// Required. |
| | | 110 | | /// </remarks> |
| | | 111 | | public SortOrder SortOrder { get; set; } |
| | | 112 | | } |
| | | 113 | | } |