| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 3 | | using Jellyfin.Data.Interfaces; |
| | | 4 | | |
| | | 5 | | namespace Jellyfin.Data.Entities.Libraries |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// This is the entity to store review ratings, not age ratings. |
| | | 9 | | /// </summary> |
| | | 10 | | public class RatingSource : IHasConcurrencyToken |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Initializes a new instance of the <see cref="RatingSource"/> class. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="minimumValue">The minimum value.</param> |
| | | 16 | | /// <param name="maximumValue">The maximum value.</param> |
| | | 17 | | public RatingSource(double minimumValue, double maximumValue) |
| | | 18 | | { |
| | 0 | 19 | | MinimumValue = minimumValue; |
| | 0 | 20 | | MaximumValue = maximumValue; |
| | 0 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the id. |
| | | 25 | | /// </summary> |
| | | 26 | | /// <remarks> |
| | | 27 | | /// Identity, Indexed, Required. |
| | | 28 | | /// </remarks> |
| | | 29 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 30 | | public int Id { get; private set; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets or sets the name. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <remarks> |
| | | 36 | | /// Max length = 1024. |
| | | 37 | | /// </remarks> |
| | | 38 | | [MaxLength(1024)] |
| | | 39 | | [StringLength(1024)] |
| | | 40 | | public string? Name { get; set; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Gets or sets the minimum value. |
| | | 44 | | /// </summary> |
| | | 45 | | /// <remarks> |
| | | 46 | | /// Required. |
| | | 47 | | /// </remarks> |
| | | 48 | | public double MinimumValue { get; set; } |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// Gets or sets the maximum value. |
| | | 52 | | /// </summary> |
| | | 53 | | /// <remarks> |
| | | 54 | | /// Required. |
| | | 55 | | /// </remarks> |
| | | 56 | | public double MaximumValue { get; set; } |
| | | 57 | | |
| | | 58 | | /// <inheritdoc /> |
| | | 59 | | [ConcurrencyCheck] |
| | | 60 | | public uint RowVersion { get; private set; } |
| | | 61 | | |
| | | 62 | | /// <summary> |
| | | 63 | | /// Gets or sets the metadata source. |
| | | 64 | | /// </summary> |
| | | 65 | | public virtual MetadataProviderId? Source { get; set; } |
| | | 66 | | |
| | | 67 | | /// <inheritdoc /> |
| | | 68 | | public void OnSavingChanges() |
| | | 69 | | { |
| | 0 | 70 | | RowVersion++; |
| | 0 | 71 | | } |
| | | 72 | | } |
| | | 73 | | } |