RatingSource.cs 2.0 KB

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