| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 3 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 4 | | |
| | | 5 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// An entity representing a rating for an entity. |
| | | 9 | | /// </summary> |
| | | 10 | | public class Rating : IHasConcurrencyToken |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Initializes a new instance of the <see cref="Rating"/> class. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="value">The value.</param> |
| | | 16 | | public Rating(double value) |
| | | 17 | | { |
| | 0 | 18 | | Value = value; |
| | 0 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets the id. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <remarks> |
| | | 25 | | /// Identity, Indexed, Required. |
| | | 26 | | /// </remarks> |
| | | 27 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 28 | | public int Id { get; private set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets or sets the value. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <remarks> |
| | | 34 | | /// Required. |
| | | 35 | | /// </remarks> |
| | | 36 | | public double Value { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets or sets the number of votes. |
| | | 40 | | /// </summary> |
| | | 41 | | public int? Votes { get; set; } |
| | | 42 | | |
| | | 43 | | /// <inheritdoc /> |
| | | 44 | | [ConcurrencyCheck] |
| | | 45 | | public uint RowVersion { get; private set; } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Gets or sets the rating type. |
| | | 49 | | /// If this is <c>null</c> it's the internal user rating. |
| | | 50 | | /// </summary> |
| | | 51 | | public virtual RatingSource? RatingType { get; set; } |
| | | 52 | | |
| | | 53 | | /// <inheritdoc /> |
| | | 54 | | public void OnSavingChanges() |
| | | 55 | | { |
| | 0 | 56 | | RowVersion++; |
| | 0 | 57 | | } |
| | | 58 | | } |
| | | 59 | | } |