aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Data/Entities')
-rw-r--r--Jellyfin.Data/Entities/AccessSchedule.cs91
-rw-r--r--Jellyfin.Data/Entities/Artwork.cs43
-rw-r--r--Jellyfin.Data/Entities/Book.cs3
-rw-r--r--Jellyfin.Data/Entities/BookMetadata.cs34
-rw-r--r--Jellyfin.Data/Entities/Chapter.cs52
-rw-r--r--Jellyfin.Data/Entities/Collection.cs17
-rw-r--r--Jellyfin.Data/Entities/CollectionItem.cs33
-rw-r--r--Jellyfin.Data/Entities/Company.cs42
-rw-r--r--Jellyfin.Data/Entities/CompanyMetadata.cs50
-rw-r--r--Jellyfin.Data/Entities/CustomItem.cs3
-rw-r--r--Jellyfin.Data/Entities/CustomItemMetadata.cs30
-rw-r--r--Jellyfin.Data/Entities/Episode.cs14
-rw-r--r--Jellyfin.Data/Entities/EpisodeMetadata.cs45
-rw-r--r--Jellyfin.Data/Entities/Genre.cs30
-rw-r--r--Jellyfin.Data/Entities/Group.cs103
-rw-r--r--Jellyfin.Data/Entities/ImageInfo.cs30
-rw-r--r--Jellyfin.Data/Entities/Library.cs24
-rw-r--r--Jellyfin.Data/Entities/LibraryItem.cs26
-rw-r--r--Jellyfin.Data/Entities/LibraryRoot.cs37
-rw-r--r--Jellyfin.Data/Entities/MediaFile.cs42
-rw-r--r--Jellyfin.Data/Entities/MediaFileStream.cs26
-rw-r--r--Jellyfin.Data/Entities/Metadata.cs71
-rw-r--r--Jellyfin.Data/Entities/MetadataProvider.cs24
-rw-r--r--Jellyfin.Data/Entities/MetadataProviderId.cs50
-rw-r--r--Jellyfin.Data/Entities/Movie.cs3
-rw-r--r--Jellyfin.Data/Entities/MovieMetadata.cs49
-rw-r--r--Jellyfin.Data/Entities/MusicAlbum.cs3
-rw-r--r--Jellyfin.Data/Entities/MusicAlbumMetadata.cs44
-rw-r--r--Jellyfin.Data/Entities/Permission.cs137
-rw-r--r--Jellyfin.Data/Entities/Person.cs49
-rw-r--r--Jellyfin.Data/Entities/PersonRole.cs32
-rw-r--r--Jellyfin.Data/Entities/Photo.cs3
-rw-r--r--Jellyfin.Data/Entities/PhotoMetadata.cs30
-rw-r--r--Jellyfin.Data/Entities/Preference.cs100
-rw-r--r--Jellyfin.Data/Entities/ProviderMapping.cs32
-rw-r--r--Jellyfin.Data/Entities/Rating.cs31
-rw-r--r--Jellyfin.Data/Entities/RatingSource.cs40
-rw-r--r--Jellyfin.Data/Entities/Release.cs59
-rw-r--r--Jellyfin.Data/Entities/Season.cs14
-rw-r--r--Jellyfin.Data/Entities/SeasonMetadata.cs35
-rw-r--r--Jellyfin.Data/Entities/Series.cs40
-rw-r--r--Jellyfin.Data/Entities/SeriesMetadata.cs49
-rw-r--r--Jellyfin.Data/Entities/Track.cs14
-rw-r--r--Jellyfin.Data/Entities/TrackMetadata.cs30
-rw-r--r--Jellyfin.Data/Entities/User.cs500
45 files changed, 1437 insertions, 777 deletions
diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs
new file mode 100644
index 000000000..7d1b76a3f
--- /dev/null
+++ b/Jellyfin.Data/Entities/AccessSchedule.cs
@@ -0,0 +1,91 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Text.Json.Serialization;
+using System.Xml.Serialization;
+using Jellyfin.Data.Enums;
+
+namespace Jellyfin.Data.Entities
+{
+ /// <summary>
+ /// An entity representing a user's access schedule.
+ /// </summary>
+ public class AccessSchedule
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
+ /// </summary>
+ /// <param name="dayOfWeek">The day of the week.</param>
+ /// <param name="startHour">The start hour.</param>
+ /// <param name="endHour">The end hour.</param>
+ /// <param name="userId">The associated user's id.</param>
+ public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
+ {
+ UserId = userId;
+ DayOfWeek = dayOfWeek;
+ StartHour = startHour;
+ EndHour = endHour;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </summary>
+ protected AccessSchedule()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the id of this instance.
+ /// </summary>
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
+ [XmlIgnore]
+ [Key]
+ [Required]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
+
+ /// <summary>
+ /// Gets or sets the id of the associated user.
+ /// </summary>
+ [XmlIgnore]
+ [Required]
+ public Guid UserId { get; protected set; }
+
+ /// <summary>
+ /// Gets or sets the day of week.
+ /// </summary>
+ /// <value>The day of week.</value>
+ [Required]
+ public DynamicDayOfWeek DayOfWeek { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start hour.
+ /// </summary>
+ /// <value>The start hour.</value>
+ [Required]
+ public double StartHour { get; set; }
+
+ /// <summary>
+ /// Gets or sets the end hour.
+ /// </summary>
+ /// <value>The end hour.</value>
+ [Required]
+ public double EndHour { get; set; }
+
+ /// <summary>
+ /// Static create function (for use in LINQ queries, etc.)
+ /// </summary>
+ /// <param name="dayOfWeek">The day of the week.</param>
+ /// <param name="startHour">The start hour.</param>
+ /// <param name="endHour">The end hour.</param>
+ /// <param name="userId">The associated user's id.</param>
+ /// <returns>The newly created instance.</returns>
+ public static AccessSchedule Create(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
+ {
+ return new AccessSchedule(dayOfWeek, startHour, endHour, userId);
+ }
+ }
+}
diff --git a/Jellyfin.Data/Entities/Artwork.cs b/Jellyfin.Data/Entities/Artwork.cs
index bf3029368..6ed32eac3 100644
--- a/Jellyfin.Data/Entities/Artwork.cs
+++ b/Jellyfin.Data/Entities/Artwork.cs
@@ -24,7 +24,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="path"></param>
/// <param name="kind"></param>
@@ -32,17 +32,28 @@ namespace Jellyfin.Data.Entities
/// <param name="_personrole1"></param>
public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
{
- if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ArgumentNullException(nameof(path));
+ }
+
this.Path = path;
this.Kind = kind;
- if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+ if (_metadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_metadata0));
+ }
+
_metadata0.Artwork.Add(this);
- if (_personrole1 == null) throw new ArgumentNullException(nameof(_personrole1));
- _personrole1.Artwork = this;
+ if (_personrole1 == null)
+ {
+ throw new ArgumentNullException(nameof(_personrole1));
+ }
+ _personrole1.Artwork = this;
Init();
}
@@ -64,7 +75,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -77,7 +88,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -87,8 +98,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -101,7 +113,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Path
+ /// Backing field for Path.
/// </summary>
protected string _Path;
/// <summary>
@@ -125,8 +137,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Path;
GetPath(ref value);
- return (_Path = value);
+ return _Path = value;
}
+
set
{
string oldValue = _Path;
@@ -139,7 +152,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Kind
+ /// Backing field for Kind.
/// </summary>
internal Enums.ArtKind _Kind;
/// <summary>
@@ -152,7 +165,7 @@ namespace Jellyfin.Data.Entities
partial void GetKind(ref Enums.ArtKind result);
/// <summary>
- /// Indexed, Required
+ /// Indexed, Required.
/// </summary>
[Required]
public Enums.ArtKind Kind
@@ -161,8 +174,9 @@ namespace Jellyfin.Data.Entities
{
Enums.ArtKind value = _Kind;
GetKind(ref value);
- return (_Kind = value);
+ return _Kind = value;
}
+
set
{
Enums.ArtKind oldValue = _Kind;
@@ -175,7 +189,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -189,7 +203,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Book.cs b/Jellyfin.Data/Entities/Book.cs
index 42d24e31d..c4d12496e 100644
--- a/Jellyfin.Data/Entities/Book.cs
+++ b/Jellyfin.Data/Entities/Book.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public Book(Guid urlid, DateTime dateadded)
@@ -63,7 +63,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Release_Releases_Id")]
public virtual ICollection<Release> Releases { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/BookMetadata.cs b/Jellyfin.Data/Entities/BookMetadata.cs
index d52fe7605..df43090d3 100644
--- a/Jellyfin.Data/Entities/BookMetadata.cs
+++ b/Jellyfin.Data/Entities/BookMetadata.cs
@@ -27,20 +27,32 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_book0"></param>
public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_book0 == null) throw new ArgumentNullException(nameof(_book0));
+ if (_book0 == null)
+ {
+ throw new ArgumentNullException(nameof(_book0));
+ }
+
_book0.BookMetadata.Add(this);
this.Publishers = new HashSet<Company>();
@@ -51,8 +63,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_book0"></param>
public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
{
@@ -64,7 +76,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for ISBN
+ /// Backing field for ISBN.
/// </summary>
protected long? _ISBN;
/// <summary>
@@ -82,8 +94,9 @@ namespace Jellyfin.Data.Entities
{
long? value = _ISBN;
GetISBN(ref value);
- return (_ISBN = value);
+ return _ISBN = value;
}
+
set
{
long? oldValue = _ISBN;
@@ -101,7 +114,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Company_Publishers_Id")]
public virtual ICollection<Company> Publishers { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Chapter.cs b/Jellyfin.Data/Entities/Chapter.cs
index d48cb9b62..4575cdb4d 100644
--- a/Jellyfin.Data/Entities/Chapter.cs
+++ b/Jellyfin.Data/Entities/Chapter.cs
@@ -25,19 +25,27 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="timestart"></param>
/// <param name="_release0"></param>
public Chapter(string language, long timestart, Release _release0)
{
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
this.TimeStart = timestart;
- if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
+ if (_release0 == null)
+ {
+ throw new ArgumentNullException(nameof(_release0));
+ }
+
_release0.Chapters.Add(this);
@@ -47,7 +55,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="timestart"></param>
/// <param name="_release0"></param>
public static Chapter Create(string language, long timestart, Release _release0)
@@ -60,7 +68,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -73,7 +81,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -84,8 +92,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -98,7 +107,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -121,8 +130,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -135,7 +145,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Language
+ /// Backing field for Language.
/// </summary>
protected string _Language;
/// <summary>
@@ -149,7 +159,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Required, Min length = 3, Max length = 3
- /// ISO-639-3 3-character language codes
+ /// ISO-639-3 3-character language codes.
/// </summary>
[Required]
[MinLength(3)]
@@ -161,8 +171,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Language;
GetLanguage(ref value);
- return (_Language = value);
+ return _Language = value;
}
+
set
{
string oldValue = _Language;
@@ -175,7 +186,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for TimeStart
+ /// Backing field for TimeStart.
/// </summary>
protected long _TimeStart;
/// <summary>
@@ -188,7 +199,7 @@ namespace Jellyfin.Data.Entities
partial void GetTimeStart(ref long result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public long TimeStart
@@ -197,8 +208,9 @@ namespace Jellyfin.Data.Entities
{
long value = _TimeStart;
GetTimeStart(ref value);
- return (_TimeStart = value);
+ return _TimeStart = value;
}
+
set
{
long oldValue = _TimeStart;
@@ -211,7 +223,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for TimeEnd
+ /// Backing field for TimeEnd.
/// </summary>
protected long? _TimeEnd;
/// <summary>
@@ -229,8 +241,9 @@ namespace Jellyfin.Data.Entities
{
long? value = _TimeEnd;
GetTimeEnd(ref value);
- return (_TimeEnd = value);
+ return _TimeEnd = value;
}
+
set
{
long? oldValue = _TimeEnd;
@@ -243,7 +256,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -257,7 +270,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Collection.cs b/Jellyfin.Data/Entities/Collection.cs
index e2fa3a5bd..01836d893 100644
--- a/Jellyfin.Data/Entities/Collection.cs
+++ b/Jellyfin.Data/Entities/Collection.cs
@@ -9,7 +9,7 @@ namespace Jellyfin.Data.Entities
partial void Init();
/// <summary>
- /// Default constructor
+ /// Default constructor.
/// </summary>
public Collection()
{
@@ -23,7 +23,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -36,7 +36,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -47,8 +47,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -61,7 +62,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -84,8 +85,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -98,7 +100,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -114,7 +116,6 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("CollectionItem_CollectionItem_Id")]
public virtual ICollection<CollectionItem> CollectionItem { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/CollectionItem.cs b/Jellyfin.Data/Entities/CollectionItem.cs
index 4a3d06639..d879806ee 100644
--- a/Jellyfin.Data/Entities/CollectionItem.cs
+++ b/Jellyfin.Data/Entities/CollectionItem.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="_collection0"></param>
/// <param name="_collectionitem1"></param>
@@ -38,15 +38,26 @@ namespace Jellyfin.Data.Entities
// NOTE: This class has one-to-one associations with CollectionItem.
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
- if (_collection0 == null) throw new ArgumentNullException(nameof(_collection0));
+ if (_collection0 == null)
+ {
+ throw new ArgumentNullException(nameof(_collection0));
+ }
+
_collection0.CollectionItem.Add(this);
- if (_collectionitem1 == null) throw new ArgumentNullException(nameof(_collectionitem1));
+ if (_collectionitem1 == null)
+ {
+ throw new ArgumentNullException(nameof(_collectionitem1));
+ }
+
_collectionitem1.Next = this;
- if (_collectionitem2 == null) throw new ArgumentNullException(nameof(_collectionitem2));
- _collectionitem2.Previous = this;
+ if (_collectionitem2 == null)
+ {
+ throw new ArgumentNullException(nameof(_collectionitem2));
+ }
+ _collectionitem2.Previous = this;
Init();
}
@@ -67,7 +78,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -80,7 +91,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -91,8 +102,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -105,7 +117,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -121,7 +133,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[ForeignKey("LibraryItem_Id")]
public virtual LibraryItem LibraryItem { get; set; }
@@ -137,7 +149,6 @@ namespace Jellyfin.Data.Entities
/// </remarks>
[ForeignKey("CollectionItem_Previous_Id")]
public virtual CollectionItem Previous { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Company.cs b/Jellyfin.Data/Entities/Company.cs
index 0650271c6..e905a17da 100644
--- a/Jellyfin.Data/Entities/Company.cs
+++ b/Jellyfin.Data/Entities/Company.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="_moviemetadata0"></param>
/// <param name="_seriesmetadata1"></param>
@@ -37,19 +37,39 @@ namespace Jellyfin.Data.Entities
/// <param name="_company4"></param>
public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
{
- if (_moviemetadata0 == null) throw new ArgumentNullException(nameof(_moviemetadata0));
+ if (_moviemetadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_moviemetadata0));
+ }
+
_moviemetadata0.Studios.Add(this);
- if (_seriesmetadata1 == null) throw new ArgumentNullException(nameof(_seriesmetadata1));
+ if (_seriesmetadata1 == null)
+ {
+ throw new ArgumentNullException(nameof(_seriesmetadata1));
+ }
+
_seriesmetadata1.Networks.Add(this);
- if (_musicalbummetadata2 == null) throw new ArgumentNullException(nameof(_musicalbummetadata2));
+ if (_musicalbummetadata2 == null)
+ {
+ throw new ArgumentNullException(nameof(_musicalbummetadata2));
+ }
+
_musicalbummetadata2.Labels.Add(this);
- if (_bookmetadata3 == null) throw new ArgumentNullException(nameof(_bookmetadata3));
+ if (_bookmetadata3 == null)
+ {
+ throw new ArgumentNullException(nameof(_bookmetadata3));
+ }
+
_bookmetadata3.Publishers.Add(this);
- if (_company4 == null) throw new ArgumentNullException(nameof(_company4));
+ if (_company4 == null)
+ {
+ throw new ArgumentNullException(nameof(_company4));
+ }
+
_company4.Parent = this;
this.CompanyMetadata = new HashSet<CompanyMetadata>();
@@ -75,7 +95,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -88,7 +108,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -99,8 +119,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -113,7 +134,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -131,7 +152,6 @@ namespace Jellyfin.Data.Entities
public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
[ForeignKey("Company_Parent_Id")]
public virtual Company Parent { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/CompanyMetadata.cs b/Jellyfin.Data/Entities/CompanyMetadata.cs
index b3ec9c1a7..e75349cf2 100644
--- a/Jellyfin.Data/Entities/CompanyMetadata.cs
+++ b/Jellyfin.Data/Entities/CompanyMetadata.cs
@@ -24,22 +24,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_company0"></param>
public CompanyMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_company0 == null) throw new ArgumentNullException(nameof(_company0));
- _company0.CompanyMetadata.Add(this);
+ if (_company0 == null)
+ {
+ throw new ArgumentNullException(nameof(_company0));
+ }
+ _company0.CompanyMetadata.Add(this);
Init();
}
@@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_company0"></param>
public static CompanyMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
{
@@ -60,7 +71,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Description
+ /// Backing field for Description.
/// </summary>
protected string _Description;
/// <summary>
@@ -83,8 +94,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Description;
GetDescription(ref value);
- return (_Description = value);
+ return _Description = value;
}
+
set
{
string oldValue = _Description;
@@ -97,7 +109,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Headquarters
+ /// Backing field for Headquarters.
/// </summary>
protected string _Headquarters;
/// <summary>
@@ -120,8 +132,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Headquarters;
GetHeadquarters(ref value);
- return (_Headquarters = value);
+ return _Headquarters = value;
}
+
set
{
string oldValue = _Headquarters;
@@ -134,7 +147,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Country
+ /// Backing field for Country.
/// </summary>
protected string _Country;
/// <summary>
@@ -157,8 +170,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Country;
GetCountry(ref value);
- return (_Country = value);
+ return _Country = value;
}
+
set
{
string oldValue = _Country;
@@ -171,7 +185,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Homepage
+ /// Backing field for Homepage.
/// </summary>
protected string _Homepage;
/// <summary>
@@ -194,8 +208,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Homepage;
GetHomepage(ref value);
- return (_Homepage = value);
+ return _Homepage = value;
}
+
set
{
string oldValue = _Homepage;
@@ -210,7 +225,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/CustomItem.cs b/Jellyfin.Data/Entities/CustomItem.cs
index 2006717bf..446391591 100644
--- a/Jellyfin.Data/Entities/CustomItem.cs
+++ b/Jellyfin.Data/Entities/CustomItem.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public CustomItem(Guid urlid, DateTime dateadded)
@@ -62,7 +62,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Release_Releases_Id")]
public virtual ICollection<Release> Releases { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/CustomItemMetadata.cs b/Jellyfin.Data/Entities/CustomItemMetadata.cs
index e09e4467a..965ed731f 100644
--- a/Jellyfin.Data/Entities/CustomItemMetadata.cs
+++ b/Jellyfin.Data/Entities/CustomItemMetadata.cs
@@ -23,22 +23,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_customitem0"></param>
public CustomItemMetadata(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_customitem0 == null) throw new ArgumentNullException(nameof(_customitem0));
- _customitem0.CustomItemMetadata.Add(this);
+ if (_customitem0 == null)
+ {
+ throw new ArgumentNullException(nameof(_customitem0));
+ }
+ _customitem0.CustomItemMetadata.Add(this);
Init();
}
@@ -46,8 +57,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_customitem0"></param>
public static CustomItemMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
{
@@ -61,7 +72,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Episode.cs b/Jellyfin.Data/Entities/Episode.cs
index 6f6baa14d..57fbf894b 100644
--- a/Jellyfin.Data/Entities/Episode.cs
+++ b/Jellyfin.Data/Entities/Episode.cs
@@ -31,7 +31,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
/// <param name="_season0"></param>
@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
this.UrlId = urlid;
- if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
+ if (_season0 == null)
+ {
+ throw new ArgumentNullException(nameof(_season0));
+ }
+
_season0.Episodes.Add(this);
this.Releases = new HashSet<Release>();
@@ -66,7 +70,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for EpisodeNumber
+ /// Backing field for EpisodeNumber.
/// </summary>
protected int? _EpisodeNumber;
/// <summary>
@@ -84,8 +88,9 @@ namespace Jellyfin.Data.Entities
{
int? value = _EpisodeNumber;
GetEpisodeNumber(ref value);
- return (_EpisodeNumber = value);
+ return _EpisodeNumber = value;
}
+
set
{
int? oldValue = _EpisodeNumber;
@@ -104,7 +109,6 @@ namespace Jellyfin.Data.Entities
public virtual ICollection<Release> Releases { get; protected set; }
[ForeignKey("EpisodeMetadata_EpisodeMetadata_Id")]
public virtual ICollection<EpisodeMetadata> EpisodeMetadata { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/EpisodeMetadata.cs b/Jellyfin.Data/Entities/EpisodeMetadata.cs
index e5431bf22..9a21fd50f 100644
--- a/Jellyfin.Data/Entities/EpisodeMetadata.cs
+++ b/Jellyfin.Data/Entities/EpisodeMetadata.cs
@@ -24,22 +24,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_episode0"></param>
public EpisodeMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_episode0 == null) throw new ArgumentNullException(nameof(_episode0));
- _episode0.EpisodeMetadata.Add(this);
+ if (_episode0 == null)
+ {
+ throw new ArgumentNullException(nameof(_episode0));
+ }
+ _episode0.EpisodeMetadata.Add(this);
Init();
}
@@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_episode0"></param>
public static EpisodeMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
{
@@ -60,7 +71,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Outline
+ /// Backing field for Outline.
/// </summary>
protected string _Outline;
/// <summary>
@@ -83,8 +94,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Outline;
GetOutline(ref value);
- return (_Outline = value);
+ return _Outline = value;
}
+
set
{
string oldValue = _Outline;
@@ -97,7 +109,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Plot
+ /// Backing field for Plot.
/// </summary>
protected string _Plot;
/// <summary>
@@ -120,8 +132,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Plot;
GetPlot(ref value);
- return (_Plot = value);
+ return _Plot = value;
}
+
set
{
string oldValue = _Plot;
@@ -134,7 +147,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Tagline
+ /// Backing field for Tagline.
/// </summary>
protected string _Tagline;
/// <summary>
@@ -157,8 +170,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Tagline;
GetTagline(ref value);
- return (_Tagline = value);
+ return _Tagline = value;
}
+
set
{
string oldValue = _Tagline;
@@ -173,7 +187,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Genre.cs b/Jellyfin.Data/Entities/Genre.cs
index 38f289a8e..24e6815d8 100644
--- a/Jellyfin.Data/Entities/Genre.cs
+++ b/Jellyfin.Data/Entities/Genre.cs
@@ -25,18 +25,25 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="name"></param>
/// <param name="_metadata0"></param>
public Genre(string name, Metadata _metadata0)
{
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
this.Name = name;
- if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
- _metadata0.Genres.Add(this);
+ if (_metadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_metadata0));
+ }
+ _metadata0.Genres.Add(this);
Init();
}
@@ -56,7 +63,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -69,7 +76,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -80,8 +87,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -94,7 +102,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
internal string _Name;
/// <summary>
@@ -118,8 +126,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -132,7 +141,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -146,7 +155,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs
index 54f9f4905..47833378e 100644
--- a/Jellyfin.Data/Entities/Group.cs
+++ b/Jellyfin.Data/Entities/Group.cs
@@ -2,19 +2,32 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
- public partial class Group
+ /// <summary>
+ /// An entity representing a group.
+ /// </summary>
+ public partial class Group : IHasPermissions, ISavingChanges
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Group"/> class.
+ /// Public constructor with required data.
/// </summary>
- protected Group()
+ /// <param name="name">The name of the group.</param>
+ public Group(string name)
{
- GroupPermissions = new HashSet<Permission>();
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ Name = name;
+ Id = Guid.NewGuid();
+
+ Permissions = new HashSet<Permission>();
ProviderMappings = new HashSet<ProviderMapping>();
Preferences = new HashSet<Preference>();
@@ -22,66 +35,45 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Group CreateGroupUnsafe()
- {
- return new Group();
- }
-
- /// <summary>
- /// Public constructor with required data
+ /// Initializes a new instance of the <see cref="Group"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
- /// <param name="name"></param>
- /// <param name="_user0"></param>
- public Group(string name, User _user0)
+ protected Group()
{
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
- this.Name = name;
-
- if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
- _user0.Groups.Add(this);
-
- this.GroupPermissions = new HashSet<Permission>();
- this.ProviderMappings = new HashSet<ProviderMapping>();
- this.Preferences = new HashSet<Preference>();
-
Init();
}
- /// <summary>
- /// Static create function (for use in LINQ queries, etc.)
- /// </summary>
- /// <param name="name"></param>
- /// <param name="_user0"></param>
- public static Group Create(string name, User _user0)
- {
- return new Group(name, _user0);
- }
-
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
- /// Identity, Indexed, Required
+ /// Gets or sets the id of this group.
/// </summary>
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
[Key]
[Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; protected set; }
+ public Guid Id { get; protected set; }
/// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the group's name.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 255.
+ /// </remarks>
[Required]
[MaxLength(255)]
[StringLength(255)]
public string Name { get; set; }
/// <summary>
- /// Required, ConcurrenyToken
+ /// Gets or sets the row version.
/// </summary>
+ /// <remarks>
+ /// Required, Concurrency Token.
+ /// </remarks>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
@@ -96,7 +88,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("Permission_GroupPermissions_Id")]
- public virtual ICollection<Permission> GroupPermissions { get; protected set; }
+ public virtual ICollection<Permission> Permissions { get; protected set; }
[ForeignKey("ProviderMapping_ProviderMappings_Id")]
public virtual ICollection<ProviderMapping> ProviderMappings { get; protected set; }
@@ -104,6 +96,27 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Preference_Preferences_Id")]
public virtual ICollection<Preference> Preferences { get; protected set; }
+ /// <summary>
+ /// Static create function (for use in LINQ queries, etc.)
+ /// </summary>
+ /// <param name="name">The name of this group.</param>
+ public static Group Create(string name)
+ {
+ return new Group(name);
+ }
+
+ /// <inheritdoc/>
+ public bool HasPermission(PermissionKind kind)
+ {
+ return Permissions.First(p => p.Kind == kind).Value;
+ }
+
+ /// <inheritdoc/>
+ public void SetPermission(PermissionKind kind, bool value)
+ {
+ Permissions.First(p => p.Kind == kind).Value = value;
+ }
+
+ partial void Init();
}
}
-
diff --git a/Jellyfin.Data/Entities/ImageInfo.cs b/Jellyfin.Data/Entities/ImageInfo.cs
new file mode 100644
index 000000000..64e36a791
--- /dev/null
+++ b/Jellyfin.Data/Entities/ImageInfo.cs
@@ -0,0 +1,30 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Jellyfin.Data.Entities
+{
+ public class ImageInfo
+ {
+ public ImageInfo(string path)
+ {
+ Path = path;
+ LastModified = DateTime.UtcNow;
+ }
+
+ [Key]
+ [Required]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
+
+ public Guid? UserId { get; protected set; }
+
+ [Required]
+ [MaxLength(512)]
+ [StringLength(512)]
+ public string Path { get; set; }
+
+ [Required]
+ public DateTime LastModified { get; set; }
+ }
+}
diff --git a/Jellyfin.Data/Entities/Library.cs b/Jellyfin.Data/Entities/Library.cs
index c11c09e91..d935e43b1 100644
--- a/Jellyfin.Data/Entities/Library.cs
+++ b/Jellyfin.Data/Entities/Library.cs
@@ -25,14 +25,17 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="name"></param>
public Library(string name)
{
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
- this.Name = name;
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ this.Name = name;
Init();
}
@@ -51,7 +54,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -64,7 +67,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -75,8 +78,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -89,7 +93,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -113,8 +117,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -127,7 +132,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -141,7 +146,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/LibraryItem.cs b/Jellyfin.Data/Entities/LibraryItem.cs
index af6c640b9..f41753560 100644
--- a/Jellyfin.Data/Entities/LibraryItem.cs
+++ b/Jellyfin.Data/Entities/LibraryItem.cs
@@ -17,7 +17,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
protected LibraryItem(Guid urlid, DateTime dateadded)
@@ -33,7 +33,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -46,7 +46,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -57,8 +57,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -71,7 +72,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for UrlId
+ /// Backing field for UrlId.
/// </summary>
internal Guid _UrlId;
/// <summary>
@@ -94,8 +95,9 @@ namespace Jellyfin.Data.Entities
{
Guid value = _UrlId;
GetUrlId(ref value);
- return (_UrlId = value);
+ return _UrlId = value;
}
+
set
{
Guid oldValue = _UrlId;
@@ -108,7 +110,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for DateAdded
+ /// Backing field for DateAdded.
/// </summary>
protected DateTime _DateAdded;
/// <summary>
@@ -121,7 +123,7 @@ namespace Jellyfin.Data.Entities
partial void GetDateAdded(ref DateTime result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public DateTime DateAdded
@@ -130,8 +132,9 @@ namespace Jellyfin.Data.Entities
{
DateTime value = _DateAdded;
GetDateAdded(ref value);
- return (_DateAdded = value);
+ return _DateAdded = value;
}
+
internal set
{
DateTime oldValue = _DateAdded;
@@ -144,7 +147,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -160,11 +163,10 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[ForeignKey("LibraryRoot_Id")]
public virtual LibraryRoot LibraryRoot { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/LibraryRoot.cs b/Jellyfin.Data/Entities/LibraryRoot.cs
index bbc23e1c9..9695ed638 100644
--- a/Jellyfin.Data/Entities/LibraryRoot.cs
+++ b/Jellyfin.Data/Entities/LibraryRoot.cs
@@ -25,14 +25,17 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="path">Absolute Path</param>
+ /// <param name="path">Absolute Path.</param>
public LibraryRoot(string path)
{
- if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
- this.Path = path;
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ArgumentNullException(nameof(path));
+ }
+ this.Path = path;
Init();
}
@@ -40,7 +43,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="path">Absolute Path</param>
+ /// <param name="path">Absolute Path.</param>
public static LibraryRoot Create(string path)
{
return new LibraryRoot(path);
@@ -51,7 +54,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -64,7 +67,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -75,8 +78,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -89,7 +93,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Path
+ /// Backing field for Path.
/// </summary>
protected string _Path;
/// <summary>
@@ -103,7 +107,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Required, Max length = 65535
- /// Absolute Path
+ /// Absolute Path.
/// </summary>
[Required]
[MaxLength(65535)]
@@ -114,8 +118,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Path;
GetPath(ref value);
- return (_Path = value);
+ return _Path = value;
}
+
set
{
string oldValue = _Path;
@@ -128,7 +133,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for NetworkPath
+ /// Backing field for NetworkPath.
/// </summary>
protected string _NetworkPath;
/// <summary>
@@ -152,8 +157,9 @@ namespace Jellyfin.Data.Entities
{
string value = _NetworkPath;
GetNetworkPath(ref value);
- return (_NetworkPath = value);
+ return _NetworkPath = value;
}
+
set
{
string oldValue = _NetworkPath;
@@ -166,7 +172,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -182,11 +188,10 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[ForeignKey("Library_Id")]
public virtual Library Library { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MediaFile.cs b/Jellyfin.Data/Entities/MediaFile.cs
index 719539e5c..7382cda95 100644
--- a/Jellyfin.Data/Entities/MediaFile.cs
+++ b/Jellyfin.Data/Entities/MediaFile.cs
@@ -28,19 +28,27 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="path">Relative to the LibraryRoot</param>
+ /// <param name="path">Relative to the LibraryRoot.</param>
/// <param name="kind"></param>
/// <param name="_release0"></param>
public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
{
- if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ArgumentNullException(nameof(path));
+ }
+
this.Path = path;
this.Kind = kind;
- if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
+ if (_release0 == null)
+ {
+ throw new ArgumentNullException(nameof(_release0));
+ }
+
_release0.MediaFiles.Add(this);
this.MediaFileStreams = new HashSet<MediaFileStream>();
@@ -51,7 +59,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="path">Relative to the LibraryRoot</param>
+ /// <param name="path">Relative to the LibraryRoot.</param>
/// <param name="kind"></param>
/// <param name="_release0"></param>
public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0)
@@ -64,7 +72,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -77,7 +85,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -88,8 +96,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -102,7 +111,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Path
+ /// Backing field for Path.
/// </summary>
protected string _Path;
/// <summary>
@@ -116,7 +125,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Required, Max length = 65535
- /// Relative to the LibraryRoot
+ /// Relative to the LibraryRoot.
/// </summary>
[Required]
[MaxLength(65535)]
@@ -127,8 +136,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Path;
GetPath(ref value);
- return (_Path = value);
+ return _Path = value;
}
+
set
{
string oldValue = _Path;
@@ -141,7 +151,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Kind
+ /// Backing field for Kind.
/// </summary>
protected Enums.MediaFileKind _Kind;
/// <summary>
@@ -154,7 +164,7 @@ namespace Jellyfin.Data.Entities
partial void GetKind(ref Enums.MediaFileKind result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public Enums.MediaFileKind Kind
@@ -163,8 +173,9 @@ namespace Jellyfin.Data.Entities
{
Enums.MediaFileKind value = _Kind;
GetKind(ref value);
- return (_Kind = value);
+ return _Kind = value;
}
+
set
{
Enums.MediaFileKind oldValue = _Kind;
@@ -177,7 +188,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -194,7 +205,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("MediaFileStream_MediaFileStreams_Id")]
public virtual ICollection<MediaFileStream> MediaFileStreams { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MediaFileStream.cs b/Jellyfin.Data/Entities/MediaFileStream.cs
index 7b3399731..977fd54e1 100644
--- a/Jellyfin.Data/Entities/MediaFileStream.cs
+++ b/Jellyfin.Data/Entities/MediaFileStream.cs
@@ -25,7 +25,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="streamnumber"></param>
/// <param name="_mediafile0"></param>
@@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
{
this.StreamNumber = streamnumber;
- if (_mediafile0 == null) throw new ArgumentNullException(nameof(_mediafile0));
- _mediafile0.MediaFileStreams.Add(this);
+ if (_mediafile0 == null)
+ {
+ throw new ArgumentNullException(nameof(_mediafile0));
+ }
+ _mediafile0.MediaFileStreams.Add(this);
Init();
}
@@ -55,7 +58,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -68,7 +71,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -79,8 +82,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -93,7 +97,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for StreamNumber
+ /// Backing field for StreamNumber.
/// </summary>
protected int _StreamNumber;
/// <summary>
@@ -106,7 +110,7 @@ namespace Jellyfin.Data.Entities
partial void GetStreamNumber(ref int result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public int StreamNumber
@@ -115,8 +119,9 @@ namespace Jellyfin.Data.Entities
{
int value = _StreamNumber;
GetStreamNumber(ref value);
- return (_StreamNumber = value);
+ return _StreamNumber = value;
}
+
set
{
int oldValue = _StreamNumber;
@@ -129,7 +134,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -143,7 +148,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Metadata.cs b/Jellyfin.Data/Entities/Metadata.cs
index 467ee6822..a4ac6dc54 100644
--- a/Jellyfin.Data/Entities/Metadata.cs
+++ b/Jellyfin.Data/Entities/Metadata.cs
@@ -24,16 +24,24 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
this.PersonRoles = new HashSet<PersonRole>();
@@ -50,7 +58,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -63,7 +71,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -74,8 +82,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -88,7 +97,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Title
+ /// Backing field for Title.
/// </summary>
protected string _Title;
/// <summary>
@@ -102,7 +111,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Required, Max length = 1024
- /// The title or name of the object
+ /// The title or name of the object.
/// </summary>
[Required]
[MaxLength(1024)]
@@ -113,8 +122,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Title;
GetTitle(ref value);
- return (_Title = value);
+ return _Title = value;
}
+
set
{
string oldValue = _Title;
@@ -127,7 +137,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for OriginalTitle
+ /// Backing field for OriginalTitle.
/// </summary>
protected string _OriginalTitle;
/// <summary>
@@ -150,8 +160,9 @@ namespace Jellyfin.Data.Entities
{
string value = _OriginalTitle;
GetOriginalTitle(ref value);
- return (_OriginalTitle = value);
+ return _OriginalTitle = value;
}
+
set
{
string oldValue = _OriginalTitle;
@@ -164,7 +175,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for SortTitle
+ /// Backing field for SortTitle.
/// </summary>
protected string _SortTitle;
/// <summary>
@@ -187,8 +198,9 @@ namespace Jellyfin.Data.Entities
{
string value = _SortTitle;
GetSortTitle(ref value);
- return (_SortTitle = value);
+ return _SortTitle = value;
}
+
set
{
string oldValue = _SortTitle;
@@ -201,7 +213,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Language
+ /// Backing field for Language.
/// </summary>
protected string _Language;
/// <summary>
@@ -215,7 +227,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Required, Min length = 3, Max length = 3
- /// ISO-639-3 3-character language codes
+ /// ISO-639-3 3-character language codes.
/// </summary>
[Required]
[MinLength(3)]
@@ -227,8 +239,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Language;
GetLanguage(ref value);
- return (_Language = value);
+ return _Language = value;
}
+
set
{
string oldValue = _Language;
@@ -241,7 +254,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for ReleaseDate
+ /// Backing field for ReleaseDate.
/// </summary>
protected DateTimeOffset? _ReleaseDate;
/// <summary>
@@ -259,8 +272,9 @@ namespace Jellyfin.Data.Entities
{
DateTimeOffset? value = _ReleaseDate;
GetReleaseDate(ref value);
- return (_ReleaseDate = value);
+ return _ReleaseDate = value;
}
+
set
{
DateTimeOffset? oldValue = _ReleaseDate;
@@ -273,7 +287,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for DateAdded
+ /// Backing field for DateAdded.
/// </summary>
protected DateTime _DateAdded;
/// <summary>
@@ -286,7 +300,7 @@ namespace Jellyfin.Data.Entities
partial void GetDateAdded(ref DateTime result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public DateTime DateAdded
@@ -295,8 +309,9 @@ namespace Jellyfin.Data.Entities
{
DateTime value = _DateAdded;
GetDateAdded(ref value);
- return (_DateAdded = value);
+ return _DateAdded = value;
}
+
internal set
{
DateTime oldValue = _DateAdded;
@@ -309,7 +324,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for DateModified
+ /// Backing field for DateModified.
/// </summary>
protected DateTime _DateModified;
/// <summary>
@@ -322,7 +337,7 @@ namespace Jellyfin.Data.Entities
partial void GetDateModified(ref DateTime result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public DateTime DateModified
@@ -331,8 +346,9 @@ namespace Jellyfin.Data.Entities
{
DateTime value = _DateModified;
GetDateModified(ref value);
- return (_DateModified = value);
+ return _DateModified = value;
}
+
internal set
{
DateTime oldValue = _DateModified;
@@ -345,7 +361,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -374,7 +390,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MetadataProvider.cs b/Jellyfin.Data/Entities/MetadataProvider.cs
index 4e4f107fb..e93ea97d6 100644
--- a/Jellyfin.Data/Entities/MetadataProvider.cs
+++ b/Jellyfin.Data/Entities/MetadataProvider.cs
@@ -25,14 +25,17 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="name"></param>
public MetadataProvider(string name)
{
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
- this.Name = name;
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ this.Name = name;
Init();
}
@@ -51,7 +54,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -64,7 +67,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -75,8 +78,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -89,7 +93,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -113,8 +117,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -127,7 +132,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -141,7 +146,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/MetadataProviderId.cs b/Jellyfin.Data/Entities/MetadataProviderId.cs
index 926f223de..68f139436 100644
--- a/Jellyfin.Data/Entities/MetadataProviderId.cs
+++ b/Jellyfin.Data/Entities/MetadataProviderId.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="providerid"></param>
/// <param name="_metadata0"></param>
@@ -40,21 +40,40 @@ namespace Jellyfin.Data.Entities
// NOTE: This class has one-to-one associations with MetadataProviderId.
// One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
- if (string.IsNullOrEmpty(providerid)) throw new ArgumentNullException(nameof(providerid));
+ if (string.IsNullOrEmpty(providerid))
+ {
+ throw new ArgumentNullException(nameof(providerid));
+ }
+
this.ProviderId = providerid;
- if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+ if (_metadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_metadata0));
+ }
+
_metadata0.Sources.Add(this);
- if (_person1 == null) throw new ArgumentNullException(nameof(_person1));
+ if (_person1 == null)
+ {
+ throw new ArgumentNullException(nameof(_person1));
+ }
+
_person1.Sources.Add(this);
- if (_personrole2 == null) throw new ArgumentNullException(nameof(_personrole2));
+ if (_personrole2 == null)
+ {
+ throw new ArgumentNullException(nameof(_personrole2));
+ }
+
_personrole2.Sources.Add(this);
- if (_ratingsource3 == null) throw new ArgumentNullException(nameof(_ratingsource3));
- _ratingsource3.Source = this;
+ if (_ratingsource3 == null)
+ {
+ throw new ArgumentNullException(nameof(_ratingsource3));
+ }
+ _ratingsource3.Source = this;
Init();
}
@@ -77,7 +96,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -90,7 +109,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -101,8 +120,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -115,7 +135,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for ProviderId
+ /// Backing field for ProviderId.
/// </summary>
protected string _ProviderId;
/// <summary>
@@ -139,8 +159,9 @@ namespace Jellyfin.Data.Entities
{
string value = _ProviderId;
GetProviderId(ref value);
- return (_ProviderId = value);
+ return _ProviderId = value;
}
+
set
{
string oldValue = _ProviderId;
@@ -153,7 +174,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -169,11 +190,10 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[ForeignKey("MetadataProvider_Id")]
public virtual MetadataProvider MetadataProvider { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Movie.cs b/Jellyfin.Data/Entities/Movie.cs
index b359b42fc..64326ca3a 100644
--- a/Jellyfin.Data/Entities/Movie.cs
+++ b/Jellyfin.Data/Entities/Movie.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public Movie(Guid urlid, DateTime dateadded)
@@ -63,7 +63,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("MovieMetadata_MovieMetadata_Id")]
public virtual ICollection<MovieMetadata> MovieMetadata { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MovieMetadata.cs b/Jellyfin.Data/Entities/MovieMetadata.cs
index 319ae94e5..cbcb78e37 100644
--- a/Jellyfin.Data/Entities/MovieMetadata.cs
+++ b/Jellyfin.Data/Entities/MovieMetadata.cs
@@ -28,20 +28,32 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_movie0"></param>
public MovieMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
+ if (_movie0 == null)
+ {
+ throw new ArgumentNullException(nameof(_movie0));
+ }
+
_movie0.MovieMetadata.Add(this);
this.Studios = new HashSet<Company>();
@@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_movie0"></param>
public static MovieMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
{
@@ -65,7 +77,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Outline
+ /// Backing field for Outline.
/// </summary>
protected string _Outline;
/// <summary>
@@ -88,8 +100,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Outline;
GetOutline(ref value);
- return (_Outline = value);
+ return _Outline = value;
}
+
set
{
string oldValue = _Outline;
@@ -102,7 +115,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Plot
+ /// Backing field for Plot.
/// </summary>
protected string _Plot;
/// <summary>
@@ -125,8 +138,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Plot;
GetPlot(ref value);
- return (_Plot = value);
+ return _Plot = value;
}
+
set
{
string oldValue = _Plot;
@@ -139,7 +153,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Tagline
+ /// Backing field for Tagline.
/// </summary>
protected string _Tagline;
/// <summary>
@@ -162,8 +176,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Tagline;
GetTagline(ref value);
- return (_Tagline = value);
+ return _Tagline = value;
}
+
set
{
string oldValue = _Tagline;
@@ -176,7 +191,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Country
+ /// Backing field for Country.
/// </summary>
protected string _Country;
/// <summary>
@@ -199,8 +214,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Country;
GetCountry(ref value);
- return (_Country = value);
+ return _Country = value;
}
+
set
{
string oldValue = _Country;
@@ -217,7 +233,6 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("Company_Studios_Id")]
public virtual ICollection<Company> Studios { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MusicAlbum.cs b/Jellyfin.Data/Entities/MusicAlbum.cs
index 00cb8fe00..9afea1fb6 100644
--- a/Jellyfin.Data/Entities/MusicAlbum.cs
+++ b/Jellyfin.Data/Entities/MusicAlbum.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public MusicAlbum(Guid urlid, DateTime dateadded)
@@ -62,7 +62,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Track_Tracks_Id")]
public virtual ICollection<Track> Tracks { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/MusicAlbumMetadata.cs b/Jellyfin.Data/Entities/MusicAlbumMetadata.cs
index b52ca6564..bfcbebbe8 100644
--- a/Jellyfin.Data/Entities/MusicAlbumMetadata.cs
+++ b/Jellyfin.Data/Entities/MusicAlbumMetadata.cs
@@ -28,20 +28,32 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_musicalbum0"></param>
public MusicAlbumMetadata(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
+ if (_musicalbum0 == null)
+ {
+ throw new ArgumentNullException(nameof(_musicalbum0));
+ }
+
_musicalbum0.MusicAlbumMetadata.Add(this);
this.Labels = new HashSet<Company>();
@@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_musicalbum0"></param>
public static MusicAlbumMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
{
@@ -65,7 +77,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Barcode
+ /// Backing field for Barcode.
/// </summary>
protected string _Barcode;
/// <summary>
@@ -88,8 +100,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Barcode;
GetBarcode(ref value);
- return (_Barcode = value);
+ return _Barcode = value;
}
+
set
{
string oldValue = _Barcode;
@@ -102,7 +115,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for LabelNumber
+ /// Backing field for LabelNumber.
/// </summary>
protected string _LabelNumber;
/// <summary>
@@ -125,8 +138,9 @@ namespace Jellyfin.Data.Entities
{
string value = _LabelNumber;
GetLabelNumber(ref value);
- return (_LabelNumber = value);
+ return _LabelNumber = value;
}
+
set
{
string oldValue = _LabelNumber;
@@ -139,7 +153,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Country
+ /// Backing field for Country.
/// </summary>
protected string _Country;
/// <summary>
@@ -162,8 +176,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Country;
GetCountry(ref value);
- return (_Country = value);
+ return _Country = value;
}
+
set
{
string oldValue = _Country;
@@ -181,7 +196,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Company_Labels_Id")]
public virtual ICollection<Company> Labels { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Permission.cs b/Jellyfin.Data/Entities/Permission.cs
index 0b5b52cbd..b675e911d 100644
--- a/Jellyfin.Data/Entities/Permission.cs
+++ b/Jellyfin.Data/Entities/Permission.cs
@@ -1,64 +1,35 @@
-using System;
-using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Runtime.CompilerServices;
+using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
- public partial class Permission
+ /// <summary>
+ /// An entity representing whether the associated user has a specific permission.
+ /// </summary>
+ public partial class Permission : ISavingChanges
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Permission()
- {
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the <see cref="Permission"/> class.
+ /// Public constructor with required data.
/// </summary>
- public static Permission CreatePermissionUnsafe()
+ /// <param name="kind">The permission kind.</param>
+ /// <param name="value">The value of this permission.</param>
+ public Permission(PermissionKind kind, bool value)
{
- return new Permission();
- }
-
- /// <summary>
- /// Public constructor with required data
- /// </summary>
- /// <param name="kind"></param>
- /// <param name="value"></param>
- /// <param name="_user0"></param>
- /// <param name="_group1"></param>
- public Permission(Enums.PermissionKind kind, bool value, User _user0, Group _group1)
- {
- this.Kind = kind;
-
- this.Value = value;
-
- if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
- _user0.Permissions.Add(this);
-
- if (_group1 == null) throw new ArgumentNullException(nameof(_group1));
- _group1.GroupPermissions.Add(this);
-
+ Kind = kind;
+ Value = value;
Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Permission"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
- /// <param name="kind"></param>
- /// <param name="value"></param>
- /// <param name="_user0"></param>
- /// <param name="_group1"></param>
- public static Permission Create(Enums.PermissionKind kind, bool value, User _user0, Group _group1)
+ protected Permission()
{
- return new Permission(kind, value, _user0, _group1);
+ Init();
}
/*************************************************************************
@@ -66,79 +37,61 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Identity, Indexed, Required
+ /// Gets or sets the id of this permission.
/// </summary>
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
- /// Backing field for Kind
- /// </summary>
- protected Enums.PermissionKind _Kind;
- /// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before setting.
- /// </summary>
- partial void SetKind(Enums.PermissionKind oldValue, ref Enums.PermissionKind newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- /// </summary>
- partial void GetKind(ref Enums.PermissionKind result);
-
- /// <summary>
- /// Required
+ /// Gets or sets the type of this permission.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
- public Enums.PermissionKind Kind
- {
- get
- {
- Enums.PermissionKind value = _Kind;
- GetKind(ref value);
- return (_Kind = value);
- }
- set
- {
- Enums.PermissionKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- OnPropertyChanged();
- }
- }
- }
+ public PermissionKind Kind { get; protected set; }
/// <summary>
- /// Required
+ /// Gets or sets a value indicating whether the associated user has this permission.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
public bool Value { get; set; }
/// <summary>
- /// Required, ConcurrenyToken
+ /// Gets or sets the row version.
/// </summary>
+ /// <remarks>
+ /// Required, ConcurrencyToken.
+ /// </remarks>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
- public void OnSavingChanges()
+ /// <summary>
+ /// Static create function (for use in LINQ queries, etc.)
+ /// </summary>
+ /// <param name="kind">The permission kind.</param>
+ /// <param name="value">The value of this permission.</param>
+ /// <returns>The newly created instance.</returns>
+ public static Permission Create(PermissionKind kind, bool value)
{
- RowVersion++;
+ return new Permission(kind, value);
}
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- public virtual event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ /// <inheritdoc/>
+ public void OnSavingChanges()
{
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ RowVersion++;
}
+ partial void Init();
}
}
-
diff --git a/Jellyfin.Data/Entities/Person.cs b/Jellyfin.Data/Entities/Person.cs
index d893b7e39..b6d91ea86 100644
--- a/Jellyfin.Data/Entities/Person.cs
+++ b/Jellyfin.Data/Entities/Person.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid"></param>
/// <param name="name"></param>
@@ -36,7 +36,11 @@ namespace Jellyfin.Data.Entities
{
this.UrlId = urlid;
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
this.Name = name;
this.Sources = new HashSet<MetadataProviderId>();
@@ -59,7 +63,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -72,7 +76,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -83,8 +87,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -97,7 +102,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for UrlId
+ /// Backing field for UrlId.
/// </summary>
protected Guid _UrlId;
/// <summary>
@@ -110,7 +115,7 @@ namespace Jellyfin.Data.Entities
partial void GetUrlId(ref Guid result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public Guid UrlId
@@ -119,8 +124,9 @@ namespace Jellyfin.Data.Entities
{
Guid value = _UrlId;
GetUrlId(ref value);
- return (_UrlId = value);
+ return _UrlId = value;
}
+
set
{
Guid oldValue = _UrlId;
@@ -133,7 +139,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -157,8 +163,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -171,7 +178,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for SourceId
+ /// Backing field for SourceId.
/// </summary>
protected string _SourceId;
/// <summary>
@@ -194,8 +201,9 @@ namespace Jellyfin.Data.Entities
{
string value = _SourceId;
GetSourceId(ref value);
- return (_SourceId = value);
+ return _SourceId = value;
}
+
set
{
string oldValue = _SourceId;
@@ -208,7 +216,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for DateAdded
+ /// Backing field for DateAdded.
/// </summary>
protected DateTime _DateAdded;
/// <summary>
@@ -221,7 +229,7 @@ namespace Jellyfin.Data.Entities
partial void GetDateAdded(ref DateTime result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public DateTime DateAdded
@@ -230,8 +238,9 @@ namespace Jellyfin.Data.Entities
{
DateTime value = _DateAdded;
GetDateAdded(ref value);
- return (_DateAdded = value);
+ return _DateAdded = value;
}
+
internal set
{
DateTime oldValue = _DateAdded;
@@ -244,7 +253,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for DateModified
+ /// Backing field for DateModified.
/// </summary>
protected DateTime _DateModified;
/// <summary>
@@ -257,7 +266,7 @@ namespace Jellyfin.Data.Entities
partial void GetDateModified(ref DateTime result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public DateTime DateModified
@@ -266,8 +275,9 @@ namespace Jellyfin.Data.Entities
{
DateTime value = _DateModified;
GetDateModified(ref value);
- return (_DateModified = value);
+ return _DateModified = value;
}
+
internal set
{
DateTime oldValue = _DateModified;
@@ -280,7 +290,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -296,7 +306,6 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("MetadataProviderId_Sources_Id")]
public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/PersonRole.cs b/Jellyfin.Data/Entities/PersonRole.cs
index 9bd12c7fb..2dd5f116f 100644
--- a/Jellyfin.Data/Entities/PersonRole.cs
+++ b/Jellyfin.Data/Entities/PersonRole.cs
@@ -31,7 +31,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="type"></param>
/// <param name="_metadata0"></param>
@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
this.Type = type;
- if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
+ if (_metadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_metadata0));
+ }
+
_metadata0.PersonRoles.Add(this);
this.Sources = new HashSet<MetadataProviderId>();
@@ -65,7 +69,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -78,7 +82,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -89,8 +93,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -103,7 +108,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Role
+ /// Backing field for Role.
/// </summary>
protected string _Role;
/// <summary>
@@ -126,8 +131,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Role;
GetRole(ref value);
- return (_Role = value);
+ return _Role = value;
}
+
set
{
string oldValue = _Role;
@@ -140,7 +146,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Type
+ /// Backing field for Type.
/// </summary>
protected Enums.PersonRoleType _Type;
/// <summary>
@@ -153,7 +159,7 @@ namespace Jellyfin.Data.Entities
partial void GetType(ref Enums.PersonRoleType result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public Enums.PersonRoleType Type
@@ -162,8 +168,9 @@ namespace Jellyfin.Data.Entities
{
Enums.PersonRoleType value = _Type;
GetType(ref value);
- return (_Type = value);
+ return _Type = value;
}
+
set
{
Enums.PersonRoleType oldValue = _Type;
@@ -176,7 +183,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -192,7 +199,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[ForeignKey("Person_Id")]
@@ -203,7 +210,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("MetadataProviderId_Sources_Id")]
public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Photo.cs b/Jellyfin.Data/Entities/Photo.cs
index 7abe62891..9da55fe43 100644
--- a/Jellyfin.Data/Entities/Photo.cs
+++ b/Jellyfin.Data/Entities/Photo.cs
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public Photo(Guid urlid, DateTime dateadded)
@@ -62,7 +62,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Release_Releases_Id")]
public virtual ICollection<Release> Releases { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/PhotoMetadata.cs b/Jellyfin.Data/Entities/PhotoMetadata.cs
index c5502f707..b5aec7229 100644
--- a/Jellyfin.Data/Entities/PhotoMetadata.cs
+++ b/Jellyfin.Data/Entities/PhotoMetadata.cs
@@ -24,22 +24,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_photo0"></param>
public PhotoMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_photo0 == null) throw new ArgumentNullException(nameof(_photo0));
- _photo0.PhotoMetadata.Add(this);
+ if (_photo0 == null)
+ {
+ throw new ArgumentNullException(nameof(_photo0));
+ }
+ _photo0.PhotoMetadata.Add(this);
Init();
}
@@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_photo0"></param>
public static PhotoMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
{
@@ -62,7 +73,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Preference.cs b/Jellyfin.Data/Entities/Preference.cs
index 505f52e6b..0ca9d7eff 100644
--- a/Jellyfin.Data/Entities/Preference.cs
+++ b/Jellyfin.Data/Entities/Preference.cs
@@ -1,63 +1,33 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
- public partial class Preference
+ /// <summary>
+ /// An entity representing a preference attached to a user or group.
+ /// </summary>
+ public class Preference : ISavingChanges
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Preference()
- {
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the <see cref="Preference"/> class.
+ /// Public constructor with required data.
/// </summary>
- public static Preference CreatePreferenceUnsafe()
+ /// <param name="kind">The preference kind.</param>
+ /// <param name="value">The value.</param>
+ public Preference(PreferenceKind kind, string value)
{
- return new Preference();
- }
-
- /// <summary>
- /// Public constructor with required data
- /// </summary>
- /// <param name="kind"></param>
- /// <param name="value"></param>
- /// <param name="_user0"></param>
- /// <param name="_group1"></param>
- public Preference(Enums.PreferenceKind kind, string value, User _user0, Group _group1)
- {
- this.Kind = kind;
-
- if (string.IsNullOrEmpty(value)) throw new ArgumentNullException(nameof(value));
- this.Value = value;
-
- if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
- _user0.Preferences.Add(this);
-
- if (_group1 == null) throw new ArgumentNullException(nameof(_group1));
- _group1.Preferences.Add(this);
-
-
- Init();
+ Kind = kind;
+ Value = value ?? throw new ArgumentNullException(nameof(value));
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Preference"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
- /// <param name="kind"></param>
- /// <param name="value"></param>
- /// <param name="_user0"></param>
- /// <param name="_group1"></param>
- public static Preference Create(Enums.PreferenceKind kind, string value, User _user0, Group _group1)
+ protected Preference()
{
- return new Preference(kind, value, _user0, _group1);
}
/*************************************************************************
@@ -65,43 +35,61 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Identity, Indexed, Required
+ /// Gets or sets the id of this preference.
/// </summary>
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
- /// Required
+ /// Gets or sets the type of this preference.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
- public Enums.PreferenceKind Kind { get; set; }
+ public PreferenceKind Kind { get; protected set; }
/// <summary>
- /// Required, Max length = 65535
+ /// Gets or sets the value of this preference.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 65535.
+ /// </remarks>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
public string Value { get; set; }
/// <summary>
- /// Required, ConcurrenyToken
+ /// Gets or sets the row version.
/// </summary>
+ /// <remarks>
+ /// Required, ConcurrencyToken.
+ /// </remarks>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
+ /// <summary>
+ /// Static create function (for use in LINQ queries, etc.)
+ /// </summary>
+ /// <param name="kind">The preference kind.</param>
+ /// <param name="value">The value.</param>
+ /// <returns>The new instance.</returns>
+ public static Preference Create(PreferenceKind kind, string value)
+ {
+ return new Preference(kind, value);
+ }
+
+ /// <inheritdoc/>
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
}
}
-
diff --git a/Jellyfin.Data/Entities/ProviderMapping.cs b/Jellyfin.Data/Entities/ProviderMapping.cs
index 6197bd97b..c53e3bf40 100644
--- a/Jellyfin.Data/Entities/ProviderMapping.cs
+++ b/Jellyfin.Data/Entities/ProviderMapping.cs
@@ -25,7 +25,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="providername"></param>
/// <param name="providersecrets"></param>
@@ -34,21 +34,26 @@ namespace Jellyfin.Data.Entities
/// <param name="_group1"></param>
public ProviderMapping(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
{
- if (string.IsNullOrEmpty(providername)) throw new ArgumentNullException(nameof(providername));
- this.ProviderName = providername;
+ if (string.IsNullOrEmpty(providername))
+ {
+ throw new ArgumentNullException(nameof(providername));
+ }
- if (string.IsNullOrEmpty(providersecrets)) throw new ArgumentNullException(nameof(providersecrets));
- this.ProviderSecrets = providersecrets;
+ this.ProviderName = providername;
- if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata));
- this.ProviderData = providerdata;
+ if (string.IsNullOrEmpty(providersecrets))
+ {
+ throw new ArgumentNullException(nameof(providersecrets));
+ }
- if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
- _user0.ProviderMappings.Add(this);
+ this.ProviderSecrets = providersecrets;
- if (_group1 == null) throw new ArgumentNullException(nameof(_group1));
- _group1.ProviderMappings.Add(this);
+ if (string.IsNullOrEmpty(providerdata))
+ {
+ throw new ArgumentNullException(nameof(providerdata));
+ }
+ this.ProviderData = providerdata;
Init();
}
@@ -71,7 +76,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -103,7 +108,7 @@ namespace Jellyfin.Data.Entities
public string ProviderData { get; set; }
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -117,7 +122,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Rating.cs b/Jellyfin.Data/Entities/Rating.cs
index f70ea8b33..49a0d502d 100644
--- a/Jellyfin.Data/Entities/Rating.cs
+++ b/Jellyfin.Data/Entities/Rating.cs
@@ -25,7 +25,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="value"></param>
/// <param name="_metadata0"></param>
@@ -33,9 +33,12 @@ namespace Jellyfin.Data.Entities
{
this.Value = value;
- if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
- _metadata0.Ratings.Add(this);
+ if (_metadata0 == null)
+ {
+ throw new ArgumentNullException(nameof(_metadata0));
+ }
+ _metadata0.Ratings.Add(this);
Init();
}
@@ -55,7 +58,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -68,7 +71,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -79,8 +82,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -93,7 +97,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Value
+ /// Backing field for Value.
/// </summary>
protected double _Value;
/// <summary>
@@ -106,7 +110,7 @@ namespace Jellyfin.Data.Entities
partial void GetValue(ref double result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public double Value
@@ -115,8 +119,9 @@ namespace Jellyfin.Data.Entities
{
double value = _Value;
GetValue(ref value);
- return (_Value = value);
+ return _Value = value;
}
+
set
{
double oldValue = _Value;
@@ -129,7 +134,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Votes
+ /// Backing field for Votes.
/// </summary>
protected int? _Votes;
/// <summary>
@@ -147,8 +152,9 @@ namespace Jellyfin.Data.Entities
{
int? value = _Votes;
GetVotes(ref value);
- return (_Votes = value);
+ return _Votes = value;
}
+
set
{
int? oldValue = _Votes;
@@ -161,7 +167,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -181,7 +187,6 @@ namespace Jellyfin.Data.Entities
/// </summary>
[ForeignKey("RatingSource_RatingType_Id")]
public virtual RatingSource RatingType { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/RatingSource.cs b/Jellyfin.Data/Entities/RatingSource.cs
index 070f1ae27..b62d8b444 100644
--- a/Jellyfin.Data/Entities/RatingSource.cs
+++ b/Jellyfin.Data/Entities/RatingSource.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
/// <summary>
- /// This is the entity to store review ratings, not age ratings
+ /// This is the entity to store review ratings, not age ratings.
/// </summary>
public partial class RatingSource
{
@@ -28,7 +28,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="maximumvalue"></param>
/// <param name="minimumvalue"></param>
@@ -39,9 +39,12 @@ namespace Jellyfin.Data.Entities
this.MinimumValue = minimumvalue;
- if (_rating0 == null) throw new ArgumentNullException(nameof(_rating0));
- _rating0.RatingType = this;
+ if (_rating0 == null)
+ {
+ throw new ArgumentNullException(nameof(_rating0));
+ }
+ _rating0.RatingType = this;
Init();
}
@@ -62,7 +65,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -75,7 +78,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -86,8 +89,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -100,7 +104,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -123,8 +127,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -137,7 +142,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for MaximumValue
+ /// Backing field for MaximumValue.
/// </summary>
protected double _MaximumValue;
/// <summary>
@@ -150,7 +155,7 @@ namespace Jellyfin.Data.Entities
partial void GetMaximumValue(ref double result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public double MaximumValue
@@ -159,8 +164,9 @@ namespace Jellyfin.Data.Entities
{
double value = _MaximumValue;
GetMaximumValue(ref value);
- return (_MaximumValue = value);
+ return _MaximumValue = value;
}
+
set
{
double oldValue = _MaximumValue;
@@ -173,7 +179,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for MinimumValue
+ /// Backing field for MinimumValue.
/// </summary>
protected double _MinimumValue;
/// <summary>
@@ -186,7 +192,7 @@ namespace Jellyfin.Data.Entities
partial void GetMinimumValue(ref double result);
/// <summary>
- /// Required
+ /// Required.
/// </summary>
[Required]
public double MinimumValue
@@ -195,8 +201,9 @@ namespace Jellyfin.Data.Entities
{
double value = _MinimumValue;
GetMinimumValue(ref value);
- return (_MinimumValue = value);
+ return _MinimumValue = value;
}
+
set
{
double oldValue = _MinimumValue;
@@ -209,7 +216,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -225,7 +232,6 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("MetadataProviderId_Source_Id")]
public virtual MetadataProviderId Source { get; set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Release.cs b/Jellyfin.Data/Entities/Release.cs
index d1928fcf7..1e9faa5a1 100644
--- a/Jellyfin.Data/Entities/Release.cs
+++ b/Jellyfin.Data/Entities/Release.cs
@@ -29,7 +29,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="name"></param>
/// <param name="_movie0"></param>
@@ -40,25 +40,53 @@ namespace Jellyfin.Data.Entities
/// <param name="_photo5"></param>
public Release(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
{
- if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
+ if (string.IsNullOrEmpty(name))
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
this.Name = name;
- if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
+ if (_movie0 == null)
+ {
+ throw new ArgumentNullException(nameof(_movie0));
+ }
+
_movie0.Releases.Add(this);
- if (_episode1 == null) throw new ArgumentNullException(nameof(_episode1));
+ if (_episode1 == null)
+ {
+ throw new ArgumentNullException(nameof(_episode1));
+ }
+
_episode1.Releases.Add(this);
- if (_track2 == null) throw new ArgumentNullException(nameof(_track2));
+ if (_track2 == null)
+ {
+ throw new ArgumentNullException(nameof(_track2));
+ }
+
_track2.Releases.Add(this);
- if (_customitem3 == null) throw new ArgumentNullException(nameof(_customitem3));
+ if (_customitem3 == null)
+ {
+ throw new ArgumentNullException(nameof(_customitem3));
+ }
+
_customitem3.Releases.Add(this);
- if (_book4 == null) throw new ArgumentNullException(nameof(_book4));
+ if (_book4 == null)
+ {
+ throw new ArgumentNullException(nameof(_book4));
+ }
+
_book4.Releases.Add(this);
- if (_photo5 == null) throw new ArgumentNullException(nameof(_photo5));
+ if (_photo5 == null)
+ {
+ throw new ArgumentNullException(nameof(_photo5));
+ }
+
_photo5.Releases.Add(this);
this.MediaFiles = new HashSet<MediaFile>();
@@ -87,7 +115,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Id
+ /// Backing field for Id.
/// </summary>
internal int _Id;
/// <summary>
@@ -100,7 +128,7 @@ namespace Jellyfin.Data.Entities
partial void GetId(ref int result);
/// <summary>
- /// Identity, Indexed, Required
+ /// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
@@ -111,8 +139,9 @@ namespace Jellyfin.Data.Entities
{
int value = _Id;
GetId(ref value);
- return (_Id = value);
+ return _Id = value;
}
+
protected set
{
int oldValue = _Id;
@@ -125,7 +154,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Name
+ /// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
@@ -149,8 +178,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Name;
GetName(ref value);
- return (_Name = value);
+ return _Name = value;
}
+
set
{
string oldValue = _Name;
@@ -163,7 +193,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Required, ConcurrenyToken
+ /// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
@@ -182,7 +212,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Chapter_Chapters_Id")]
public virtual ICollection<Chapter> Chapters { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Season.cs b/Jellyfin.Data/Entities/Season.cs
index 96e89cde0..4b1e78575 100644
--- a/Jellyfin.Data/Entities/Season.cs
+++ b/Jellyfin.Data/Entities/Season.cs
@@ -31,7 +31,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
/// <param name="_series0"></param>
@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
this.UrlId = urlid;
- if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
+ if (_series0 == null)
+ {
+ throw new ArgumentNullException(nameof(_series0));
+ }
+
_series0.Seasons.Add(this);
this.SeasonMetadata = new HashSet<SeasonMetadata>();
@@ -66,7 +70,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for SeasonNumber
+ /// Backing field for SeasonNumber.
/// </summary>
protected int? _SeasonNumber;
/// <summary>
@@ -84,8 +88,9 @@ namespace Jellyfin.Data.Entities
{
int? value = _SeasonNumber;
GetSeasonNumber(ref value);
- return (_SeasonNumber = value);
+ return _SeasonNumber = value;
}
+
set
{
int? oldValue = _SeasonNumber;
@@ -105,7 +110,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Episode_Episodes_Id")]
public virtual ICollection<Episode> Episodes { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/SeasonMetadata.cs b/Jellyfin.Data/Entities/SeasonMetadata.cs
index 64ecbfbfa..10d19875e 100644
--- a/Jellyfin.Data/Entities/SeasonMetadata.cs
+++ b/Jellyfin.Data/Entities/SeasonMetadata.cs
@@ -25,22 +25,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_season0"></param>
public SeasonMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_season0 == null) throw new ArgumentNullException(nameof(_season0));
- _season0.SeasonMetadata.Add(this);
+ if (_season0 == null)
+ {
+ throw new ArgumentNullException(nameof(_season0));
+ }
+ _season0.SeasonMetadata.Add(this);
Init();
}
@@ -48,8 +59,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_season0"></param>
public static SeasonMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
{
@@ -61,7 +72,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Outline
+ /// Backing field for Outline.
/// </summary>
protected string _Outline;
/// <summary>
@@ -84,8 +95,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Outline;
GetOutline(ref value);
- return (_Outline = value);
+ return _Outline = value;
}
+
set
{
string oldValue = _Outline;
@@ -100,7 +112,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/Series.cs b/Jellyfin.Data/Entities/Series.cs
index 097b9958e..bede14acf 100644
--- a/Jellyfin.Data/Entities/Series.cs
+++ b/Jellyfin.Data/Entities/Series.cs
@@ -20,15 +20,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Series CreateSeriesUnsafe()
- {
- return new Series();
- }
-
- /// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
public Series(Guid urlid, DateTime dateadded)
@@ -55,29 +47,30 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for AirsDayOfWeek
+ /// Backing field for AirsDayOfWeek.
/// </summary>
- protected Enums.Weekday? _AirsDayOfWeek;
+ protected DayOfWeek? _AirsDayOfWeek;
/// <summary>
/// When provided in a partial class, allows value of AirsDayOfWeek to be changed before setting.
/// </summary>
- partial void SetAirsDayOfWeek(Enums.Weekday? oldValue, ref Enums.Weekday? newValue);
+ partial void SetAirsDayOfWeek(DayOfWeek? oldValue, ref DayOfWeek? newValue);
/// <summary>
/// When provided in a partial class, allows value of AirsDayOfWeek to be changed before returning.
/// </summary>
- partial void GetAirsDayOfWeek(ref Enums.Weekday? result);
+ partial void GetAirsDayOfWeek(ref DayOfWeek? result);
- public Enums.Weekday? AirsDayOfWeek
+ public DayOfWeek? AirsDayOfWeek
{
get
{
- Enums.Weekday? value = _AirsDayOfWeek;
+ DayOfWeek? value = _AirsDayOfWeek;
GetAirsDayOfWeek(ref value);
- return (_AirsDayOfWeek = value);
+ return _AirsDayOfWeek = value;
}
+
set
{
- Enums.Weekday? oldValue = _AirsDayOfWeek;
+ DayOfWeek? oldValue = _AirsDayOfWeek;
SetAirsDayOfWeek(oldValue, ref value);
if (oldValue != value)
{
@@ -87,7 +80,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for AirsTime
+ /// Backing field for AirsTime.
/// </summary>
protected DateTimeOffset? _AirsTime;
/// <summary>
@@ -100,7 +93,7 @@ namespace Jellyfin.Data.Entities
partial void GetAirsTime(ref DateTimeOffset? result);
/// <summary>
- /// The time the show airs, ignore the date portion
+ /// The time the show airs, ignore the date portion.
/// </summary>
public DateTimeOffset? AirsTime
{
@@ -108,8 +101,9 @@ namespace Jellyfin.Data.Entities
{
DateTimeOffset? value = _AirsTime;
GetAirsTime(ref value);
- return (_AirsTime = value);
+ return _AirsTime = value;
}
+
set
{
DateTimeOffset? oldValue = _AirsTime;
@@ -122,7 +116,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for FirstAired
+ /// Backing field for FirstAired.
/// </summary>
protected DateTimeOffset? _FirstAired;
/// <summary>
@@ -140,8 +134,9 @@ namespace Jellyfin.Data.Entities
{
DateTimeOffset? value = _FirstAired;
GetFirstAired(ref value);
- return (_FirstAired = value);
+ return _FirstAired = value;
}
+
set
{
DateTimeOffset? oldValue = _FirstAired;
@@ -161,7 +156,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Season_Seasons_Id")]
public virtual ICollection<Season> Seasons { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/SeriesMetadata.cs b/Jellyfin.Data/Entities/SeriesMetadata.cs
index 52691783f..16eb59315 100644
--- a/Jellyfin.Data/Entities/SeriesMetadata.cs
+++ b/Jellyfin.Data/Entities/SeriesMetadata.cs
@@ -28,20 +28,32 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_series0"></param>
public SeriesMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_series0 == null) throw new ArgumentNullException(nameof(_series0));
+ if (_series0 == null)
+ {
+ throw new ArgumentNullException(nameof(_series0));
+ }
+
_series0.SeriesMetadata.Add(this);
this.Networks = new HashSet<Company>();
@@ -52,8 +64,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_series0"></param>
public static SeriesMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
{
@@ -65,7 +77,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for Outline
+ /// Backing field for Outline.
/// </summary>
protected string _Outline;
/// <summary>
@@ -88,8 +100,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Outline;
GetOutline(ref value);
- return (_Outline = value);
+ return _Outline = value;
}
+
set
{
string oldValue = _Outline;
@@ -102,7 +115,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Plot
+ /// Backing field for Plot.
/// </summary>
protected string _Plot;
/// <summary>
@@ -125,8 +138,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Plot;
GetPlot(ref value);
- return (_Plot = value);
+ return _Plot = value;
}
+
set
{
string oldValue = _Plot;
@@ -139,7 +153,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Tagline
+ /// Backing field for Tagline.
/// </summary>
protected string _Tagline;
/// <summary>
@@ -162,8 +176,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Tagline;
GetTagline(ref value);
- return (_Tagline = value);
+ return _Tagline = value;
}
+
set
{
string oldValue = _Tagline;
@@ -176,7 +191,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Backing field for Country
+ /// Backing field for Country.
/// </summary>
protected string _Country;
/// <summary>
@@ -199,8 +214,9 @@ namespace Jellyfin.Data.Entities
{
string value = _Country;
GetCountry(ref value);
- return (_Country = value);
+ return _Country = value;
}
+
set
{
string oldValue = _Country;
@@ -217,7 +233,6 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
[ForeignKey("Company_Networks_Id")]
public virtual ICollection<Company> Networks { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/Track.cs b/Jellyfin.Data/Entities/Track.cs
index 079d73d2b..b7d7b5873 100644
--- a/Jellyfin.Data/Entities/Track.cs
+++ b/Jellyfin.Data/Entities/Track.cs
@@ -31,7 +31,7 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
/// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
/// <param name="_musicalbum0"></param>
@@ -42,7 +42,11 @@ namespace Jellyfin.Data.Entities
this.UrlId = urlid;
- if (_musicalbum0 == null) throw new ArgumentNullException(nameof(_musicalbum0));
+ if (_musicalbum0 == null)
+ {
+ throw new ArgumentNullException(nameof(_musicalbum0));
+ }
+
_musicalbum0.Tracks.Add(this);
this.Releases = new HashSet<Release>();
@@ -66,7 +70,7 @@ namespace Jellyfin.Data.Entities
*************************************************************************/
/// <summary>
- /// Backing field for TrackNumber
+ /// Backing field for TrackNumber.
/// </summary>
protected int? _TrackNumber;
/// <summary>
@@ -84,8 +88,9 @@ namespace Jellyfin.Data.Entities
{
int? value = _TrackNumber;
GetTrackNumber(ref value);
- return (_TrackNumber = value);
+ return _TrackNumber = value;
}
+
set
{
int? oldValue = _TrackNumber;
@@ -106,7 +111,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("TrackMetadata_TrackMetadata_Id")]
public virtual ICollection<TrackMetadata> TrackMetadata { get; protected set; }
-
}
}
diff --git a/Jellyfin.Data/Entities/TrackMetadata.cs b/Jellyfin.Data/Entities/TrackMetadata.cs
index 86c9161f6..23e1219aa 100644
--- a/Jellyfin.Data/Entities/TrackMetadata.cs
+++ b/Jellyfin.Data/Entities/TrackMetadata.cs
@@ -24,22 +24,33 @@ namespace Jellyfin.Data.Entities
}
/// <summary>
- /// Public constructor with required data
+ /// Public constructor with required data.
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_track0"></param>
public TrackMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
{
- if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title));
+ if (string.IsNullOrEmpty(title))
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+
this.Title = title;
- if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language));
+ if (string.IsNullOrEmpty(language))
+ {
+ throw new ArgumentNullException(nameof(language));
+ }
+
this.Language = language;
- if (_track0 == null) throw new ArgumentNullException(nameof(_track0));
- _track0.TrackMetadata.Add(this);
+ if (_track0 == null)
+ {
+ throw new ArgumentNullException(nameof(_track0));
+ }
+ _track0.TrackMetadata.Add(this);
Init();
}
@@ -47,8 +58,8 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
- /// <param name="title">The title or name of the object</param>
- /// <param name="language">ISO-639-3 3-character language codes</param>
+ /// <param name="title">The title or name of the object.</param>
+ /// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="_track0"></param>
public static TrackMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
{
@@ -62,7 +73,6 @@ namespace Jellyfin.Data.Entities
/*************************************************************************
* Navigation properties
*************************************************************************/
-
}
}
diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs
index a81d5215b..b89b0a8f4 100644
--- a/Jellyfin.Data/Entities/User.cs
+++ b/Jellyfin.Data/Entities/User.cs
@@ -2,234 +2,506 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using System.Globalization;
+using System.Linq;
+using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
- public partial class User
+ /// <summary>
+ /// An entity representing a user.
+ /// </summary>
+ public partial class User : IHasPermissions, ISavingChanges
{
- partial void Init();
+ /// <summary>
+ /// The values being delimited here are Guids, so commas work as they do not appear in Guids.
+ /// </summary>
+ private const char Delimiter = ',';
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="User"/> class.
+ /// Public constructor with required data.
/// </summary>
- protected User()
+ /// <param name="username">The username for the new user.</param>
+ /// <param name="authenticationProviderId">The Id of the user's authentication provider.</param>
+ /// <param name="passwordResetProviderId">The Id of the user's password reset provider.</param>
+ public User(string username, string authenticationProviderId, string passwordResetProviderId)
{
- Groups = new HashSet<Group>();
+ if (string.IsNullOrEmpty(username))
+ {
+ throw new ArgumentNullException(nameof(username));
+ }
+
+ if (string.IsNullOrEmpty(authenticationProviderId))
+ {
+ throw new ArgumentNullException(nameof(authenticationProviderId));
+ }
+
+ if (string.IsNullOrEmpty(passwordResetProviderId))
+ {
+ throw new ArgumentNullException(nameof(passwordResetProviderId));
+ }
+
+ Username = username;
+ AuthenticationProviderId = authenticationProviderId;
+ PasswordResetProviderId = passwordResetProviderId;
+
+ AccessSchedules = new HashSet<AccessSchedule>();
+ // Groups = new HashSet<Group>();
Permissions = new HashSet<Permission>();
- ProviderMappings = new HashSet<ProviderMapping>();
Preferences = new HashSet<Preference>();
-
+ // ProviderMappings = new HashSet<ProviderMapping>();
+
+ // Set default values
+ Id = Guid.NewGuid();
+ InvalidLoginAttemptCount = 0;
+ EnableUserPreferenceAccess = true;
+ MustUpdatePassword = false;
+ DisplayMissingEpisodes = false;
+ DisplayCollectionsView = false;
+ HidePlayedInLatest = true;
+ RememberAudioSelections = true;
+ RememberSubtitleSelections = true;
+ EnableNextEpisodeAutoPlay = true;
+ EnableAutoLogin = false;
+ PlayDefaultAudioTrack = true;
+ SubtitleMode = SubtitlePlaybackMode.Default;
+ SyncPlayAccess = SyncPlayAccess.CreateAndJoinGroups;
+
+ AddDefaultPermissions();
+ AddDefaultPreferences();
Init();
}
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static User CreateUserUnsafe()
- {
- return new User();
- }
-
- /// <summary>
- /// Public constructor with required data
+ /// Initializes a new instance of the <see cref="User"/> class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
- /// <param name="username"></param>
- /// <param name="mustupdatepassword"></param>
- /// <param name="audiolanguagepreference"></param>
- /// <param name="authenticationproviderid"></param>
- /// <param name="invalidloginattemptcount"></param>
- /// <param name="subtitlemode"></param>
- /// <param name="playdefaultaudiotrack"></param>
- public User(string username, bool mustupdatepassword, string audiolanguagepreference, string authenticationproviderid, int invalidloginattemptcount, string subtitlemode, bool playdefaultaudiotrack)
+ protected User()
{
- if (string.IsNullOrEmpty(username)) throw new ArgumentNullException(nameof(username));
- this.Username = username;
-
- this.MustUpdatePassword = mustupdatepassword;
-
- if (string.IsNullOrEmpty(audiolanguagepreference)) throw new ArgumentNullException(nameof(audiolanguagepreference));
- this.AudioLanguagePreference = audiolanguagepreference;
-
- if (string.IsNullOrEmpty(authenticationproviderid)) throw new ArgumentNullException(nameof(authenticationproviderid));
- this.AuthenticationProviderId = authenticationproviderid;
-
- this.InvalidLoginAttemptCount = invalidloginattemptcount;
-
- if (string.IsNullOrEmpty(subtitlemode)) throw new ArgumentNullException(nameof(subtitlemode));
- this.SubtitleMode = subtitlemode;
-
- this.PlayDefaultAudioTrack = playdefaultaudiotrack;
-
- this.Groups = new HashSet<Group>();
- this.Permissions = new HashSet<Permission>();
- this.ProviderMappings = new HashSet<ProviderMapping>();
- this.Preferences = new HashSet<Preference>();
-
Init();
}
- /// <summary>
- /// Static create function (for use in LINQ queries, etc.)
- /// </summary>
- /// <param name="username"></param>
- /// <param name="mustupdatepassword"></param>
- /// <param name="audiolanguagepreference"></param>
- /// <param name="authenticationproviderid"></param>
- /// <param name="invalidloginattemptcount"></param>
- /// <param name="subtitlemode"></param>
- /// <param name="playdefaultaudiotrack"></param>
- public static User Create(string username, bool mustupdatepassword, string audiolanguagepreference, string authenticationproviderid, int invalidloginattemptcount, string subtitlemode, bool playdefaultaudiotrack)
- {
- return new User(username, mustupdatepassword, audiolanguagepreference, authenticationproviderid, invalidloginattemptcount, subtitlemode, playdefaultaudiotrack);
- }
-
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
- /// Identity, Indexed, Required
+ /// Gets or sets the Id of the user.
/// </summary>
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
[Key]
[Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; protected set; }
+ [JsonIgnore]
+ public Guid Id { get; set; }
/// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the user's name.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 255.
+ /// </remarks>
[Required]
[MaxLength(255)]
[StringLength(255)]
public string Username { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the user's password, or <c>null</c> if none is set.
/// </summary>
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
public string Password { get; set; }
/// <summary>
- /// Required
+ /// Gets or sets the user's easy password, or <c>null</c> if none is set.
+ /// </summary>
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
+ [MaxLength(65535)]
+ [StringLength(65535)]
+ public string EasyPassword { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the user must update their password.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
public bool MustUpdatePassword { get; set; }
/// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the audio language preference.
/// </summary>
- [Required]
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
[MaxLength(255)]
[StringLength(255)]
public string AudioLanguagePreference { get; set; }
/// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the authentication provider id.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 255.
+ /// </remarks>
[Required]
[MaxLength(255)]
[StringLength(255)]
public string AuthenticationProviderId { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the password reset provider id.
/// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string GroupedFolders { get; set; }
+ /// <remarks>
+ /// Required, Max length = 255.
+ /// </remarks>
+ [Required]
+ [MaxLength(255)]
+ [StringLength(255)]
+ public string PasswordResetProviderId { get; set; }
/// <summary>
- /// Required
+ /// Gets or sets the invalid login attempt count.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
public int InvalidLoginAttemptCount { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the last activity date.
/// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string LatestItemExcludes { get; set; }
-
- public int? LoginAttemptsBeforeLockout { get; set; }
+ public DateTime? LastActivityDate { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the last login date.
/// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string MyMediaExcludes { get; set; }
+ public DateTime? LastLoginDate { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the number of login attempts the user can make before they are locked out.
/// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string OrderedViews { get; set; }
+ public int? LoginAttemptsBeforeLockout { get; set; }
/// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the subtitle mode.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
- [MaxLength(255)]
- [StringLength(255)]
- public string SubtitleMode { get; set; }
+ public SubtitlePlaybackMode SubtitleMode { get; set; }
/// <summary>
- /// Required
+ /// Gets or sets a value indicating whether the default audio track should be played.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
public bool PlayDefaultAudioTrack { get; set; }
/// <summary>
- /// Max length = 255
+ /// Gets or sets the subtitle language preference.
/// </summary>
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string SubtitleLanguagePrefernce { get; set; }
+ public string SubtitleLanguagePreference { get; set; }
- public bool? DisplayMissingEpisodes { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether missing episodes should be displayed.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool DisplayMissingEpisodes { get; set; }
- public bool? DisplayCollectionsView { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether to display the collections view.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool DisplayCollectionsView { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the user has a local password.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool EnableLocalPassword { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the server should hide played content in "Latest".
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool HidePlayedInLatest { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to remember audio selections on played content.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool RememberAudioSelections { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to remember subtitle selections on played content.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool RememberSubtitleSelections { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable auto-play for the next episode.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool EnableNextEpisodeAutoPlay { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the user should auto-login.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool EnableAutoLogin { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the user can change their preferences.
+ /// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ [Required]
+ public bool EnableUserPreferenceAccess { get; set; }
- public bool? HidePlayedInLatest { get; set; }
+ /// <summary>
+ /// Gets or sets the maximum parental age rating.
+ /// </summary>
+ public int? MaxParentalAgeRating { get; set; }
- public bool? RememberAudioSelections { get; set; }
+ /// <summary>
+ /// Gets or sets the remote client bitrate limit.
+ /// </summary>
+ public int? RemoteClientBitrateLimit { get; set; }
- public bool? RememberSubtitleSelections { get; set; }
+ /// <summary>
+ /// Gets or sets the internal id.
+ /// This is a temporary stopgap for until the library db is migrated.
+ /// This corresponds to the value of the index of this user in the library db.
+ /// </summary>
+ [Required]
+ public long InternalId { get; set; }
- public bool? EnableNextEpisodeAutoPlay { get; set; }
+ /// <summary>
+ /// Gets or sets the user's profile image. Can be <c>null</c>.
+ /// </summary>
+ // [ForeignKey("UserId")]
+ public virtual ImageInfo ProfileImage { get; set; }
- public bool? EnableUserPreferenceAccess { get; set; }
+ [Required]
+ public SyncPlayAccess SyncPlayAccess { get; set; }
/// <summary>
- /// Required, ConcurrenyToken
+ /// Gets or sets the row version.
/// </summary>
+ /// <remarks>
+ /// Required, Concurrency Token.
+ /// </remarks>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
- public void OnSavingChanges()
- {
- RowVersion++;
- }
-
/*************************************************************************
* Navigation properties
*************************************************************************/
- [ForeignKey("Group_Groups_Id")]
+
+ /// <summary>
+ /// Gets or sets the list of access schedules this user has.
+ /// </summary>
+ public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; }
+
+ /*
+ /// <summary>
+ /// Gets or sets the list of groups this user is a member of.
+ /// </summary>
+ [ForeignKey("Group_Groups_Guid")]
public virtual ICollection<Group> Groups { get; protected set; }
+ */
- [ForeignKey("Permission_Permissions_Id")]
+ /// <summary>
+ /// Gets or sets the list of permissions this user has.
+ /// </summary>
+ [ForeignKey("Permission_Permissions_Guid")]
public virtual ICollection<Permission> Permissions { get; protected set; }
+ /*
+ /// <summary>
+ /// Gets or sets the list of provider mappings this user has.
+ /// </summary>
[ForeignKey("ProviderMapping_ProviderMappings_Id")]
public virtual ICollection<ProviderMapping> ProviderMappings { get; protected set; }
+ */
- [ForeignKey("Preference_Preferences_Id")]
+ /// <summary>
+ /// Gets or sets the list of preferences this user has.
+ /// </summary>
+ [ForeignKey("Preference_Preferences_Guid")]
public virtual ICollection<Preference> Preferences { get; protected set; }
+ /// <summary>
+ /// Static create function (for use in LINQ queries, etc.)
+ /// </summary>
+ /// <param name="username">The username for the created user.</param>
+ /// <param name="authenticationProviderId">The Id of the user's authentication provider.</param>
+ /// <param name="passwordResetProviderId">The Id of the user's password reset provider.</param>
+ /// <returns>The created instance.</returns>
+ public static User Create(string username, string authenticationProviderId, string passwordResetProviderId)
+ {
+ return new User(username, authenticationProviderId, passwordResetProviderId);
+ }
+
+ /// <inheritdoc/>
+ public void OnSavingChanges()
+ {
+ RowVersion++;
+ }
+
+ /// <summary>
+ /// Checks whether the user has the specified permission.
+ /// </summary>
+ /// <param name="kind">The permission kind.</param>
+ /// <returns><c>True</c> if the user has the specified permission.</returns>
+ public bool HasPermission(PermissionKind kind)
+ {
+ return Permissions.First(p => p.Kind == kind).Value;
+ }
+
+ /// <summary>
+ /// Sets the given permission kind to the provided value.
+ /// </summary>
+ /// <param name="kind">The permission kind.</param>
+ /// <param name="value">The value to set.</param>
+ public void SetPermission(PermissionKind kind, bool value)
+ {
+ Permissions.First(p => p.Kind == kind).Value = value;
+ }
+
+ /// <summary>
+ /// Gets the user's preferences for the given preference kind.
+ /// </summary>
+ /// <param name="preference">The preference kind.</param>
+ /// <returns>A string array containing the user's preferences.</returns>
+ public string[] GetPreference(PreferenceKind preference)
+ {
+ var val = Preferences.First(p => p.Kind == preference).Value;
+
+ return Equals(val, string.Empty) ? Array.Empty<string>() : val.Split(Delimiter);
+ }
+
+ /// <summary>
+ /// Sets the specified preference to the given value.
+ /// </summary>
+ /// <param name="preference">The preference kind.</param>
+ /// <param name="values">The values.</param>
+ public void SetPreference(PreferenceKind preference, string[] values)
+ {
+ Preferences.First(p => p.Kind == preference).Value
+ = string.Join(Delimiter.ToString(CultureInfo.InvariantCulture), values);
+ }
+
+ /// <summary>
+ /// Checks whether this user is currently allowed to use the server.
+ /// </summary>
+ /// <returns><c>True</c> if the current time is within an access schedule, or there are no access schedules.</returns>
+ public bool IsParentalScheduleAllowed()
+ {
+ return AccessSchedules.Count == 0
+ || AccessSchedules.Any(i => IsParentalScheduleAllowed(i, DateTime.UtcNow));
+ }
+
+ /// <summary>
+ /// Checks whether the provided folder is in this user's grouped folders.
+ /// </summary>
+ /// <param name="id">The Guid of the folder.</param>
+ /// <returns><c>True</c> if the folder is in the user's grouped folders.</returns>
+ public bool IsFolderGrouped(Guid id)
+ {
+ return GetPreference(PreferenceKind.GroupedFolders).Any(i => new Guid(i) == id);
+ }
+
+ private static bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)
+ {
+ var localTime = date.ToLocalTime();
+ var hour = localTime.TimeOfDay.TotalHours;
+
+ return DayOfWeekHelper.GetDaysOfWeek(schedule.DayOfWeek).Contains(localTime.DayOfWeek)
+ && hour >= schedule.StartHour
+ && hour <= schedule.EndHour;
+ }
+
+ // TODO: make these user configurable?
+ private void AddDefaultPermissions()
+ {
+ Permissions.Add(new Permission(PermissionKind.IsAdministrator, false));
+ Permissions.Add(new Permission(PermissionKind.IsDisabled, false));
+ Permissions.Add(new Permission(PermissionKind.IsHidden, true));
+ Permissions.Add(new Permission(PermissionKind.EnableAllChannels, true));
+ Permissions.Add(new Permission(PermissionKind.EnableAllDevices, true));
+ Permissions.Add(new Permission(PermissionKind.EnableAllFolders, true));
+ Permissions.Add(new Permission(PermissionKind.EnableContentDeletion, false));
+ Permissions.Add(new Permission(PermissionKind.EnableContentDownloading, true));
+ Permissions.Add(new Permission(PermissionKind.EnableMediaConversion, true));
+ Permissions.Add(new Permission(PermissionKind.EnableMediaPlayback, true));
+ Permissions.Add(new Permission(PermissionKind.EnablePlaybackRemuxing, true));
+ Permissions.Add(new Permission(PermissionKind.EnablePublicSharing, true));
+ Permissions.Add(new Permission(PermissionKind.EnableRemoteAccess, true));
+ Permissions.Add(new Permission(PermissionKind.EnableSyncTranscoding, true));
+ Permissions.Add(new Permission(PermissionKind.EnableAudioPlaybackTranscoding, true));
+ Permissions.Add(new Permission(PermissionKind.EnableLiveTvAccess, true));
+ Permissions.Add(new Permission(PermissionKind.EnableLiveTvManagement, true));
+ Permissions.Add(new Permission(PermissionKind.EnableSharedDeviceControl, true));
+ Permissions.Add(new Permission(PermissionKind.EnableVideoPlaybackTranscoding, true));
+ Permissions.Add(new Permission(PermissionKind.ForceRemoteSourceTranscoding, false));
+ Permissions.Add(new Permission(PermissionKind.EnableRemoteControlOfOtherUsers, false));
+ }
+
+ private void AddDefaultPreferences()
+ {
+ foreach (var val in Enum.GetValues(typeof(PreferenceKind)).Cast<PreferenceKind>())
+ {
+ Preferences.Add(new Preference(val, string.Empty));
+ }
+ }
+
+ partial void Init();
}
}
-