Merge pull request #4034 from barronpm/jellyfin-data-warnings

Fix all warnings in Jellyfin.Data
pull/4062/head
Bond-009 4 years ago committed by GitHub
commit e6c22a9707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@ -11,7 +9,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// An entity referencing an activity log entry.
/// </summary>
public partial class ActivityLog : IHasConcurrencyToken
public class ActivityLog : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLog"/> class.
@ -32,13 +30,11 @@ namespace Jellyfin.Data.Entities
throw new ArgumentNullException(nameof(type));
}
this.Name = name;
this.Type = type;
this.UserId = userId;
this.DateCreated = DateTime.UtcNow;
this.LogSeverity = LogLevel.Trace;
Init();
Name = name;
Type = type;
UserId = userId;
DateCreated = DateTime.UtcNow;
LogSeverity = LogLevel.Trace;
}
/// <summary>
@ -47,38 +43,21 @@ namespace Jellyfin.Data.Entities
/// </summary>
protected ActivityLog()
{
Init();
}
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
/// <param name="name">The name.</param>
/// <param name="type">The type.</param>
/// <param name="userId">The user's id.</param>
/// <returns>The new <see cref="ActivityLog"/> instance.</returns>
public static ActivityLog Create(string name, string type, Guid userId)
{
return new ActivityLog(name, type, userId);
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Gets or sets the identity of this instance.
/// This is the key in the backing database.
/// </summary>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
/// Gets or sets the name.
/// Required, Max length = 512.
/// </summary>
/// <remarks>
/// Required, Max length = 512.
/// </remarks>
[Required]
[MaxLength(512)]
[StringLength(512)]
@ -86,24 +65,30 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Gets or sets the overview.
/// Max length = 512.
/// </summary>
/// <remarks>
/// Max length = 512.
/// </remarks>
[MaxLength(512)]
[StringLength(512)]
public string Overview { get; set; }
/// <summary>
/// Gets or sets the short overview.
/// Max length = 512.
/// </summary>
/// <remarks>
/// Max length = 512.
/// </remarks>
[MaxLength(512)]
[StringLength(512)]
public string ShortOverview { get; set; }
/// <summary>
/// Gets or sets the type.
/// Required, Max length = 256.
/// </summary>
/// <remarks>
/// Required, Max length = 256.
/// </remarks>
[Required]
[MaxLength(256)]
[StringLength(256)]
@ -111,43 +96,42 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// Gets or sets the user id.
/// Required.
/// </summary>
[Required]
/// <remarks>
/// Required.
/// </remarks>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the item id.
/// Max length = 256.
/// </summary>
/// <remarks>
/// Max length = 256.
/// </remarks>
[MaxLength(256)]
[StringLength(256)]
public string ItemId { get; set; }
/// <summary>
/// Gets or sets the date created. This should be in UTC.
/// Required.
/// </summary>
[Required]
/// <remarks>
/// Required.
/// </remarks>
public DateTime DateCreated { get; set; }
/// <summary>
/// Gets or sets the log severity. Default is <see cref="LogLevel.Trace"/>.
/// Required.
/// </summary>
[Required]
/// <remarks>
/// Required.
/// </remarks>
public LogLevel LogSeverity { get; set; }
/// <summary>
/// Gets or sets the row version.
/// Required, ConcurrencyToken.
/// </summary>
/// <inheritdoc />
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
partial void Init();
/// <inheritdoc />
public void OnSavingChanges()
{

@ -1,4 +1,6 @@
using System;
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

@ -1,9 +1,8 @@
#pragma warning disable CS1591
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Jellyfin.Data.Enums;
using Jellyfin.Data.Interfaces;
@ -13,11 +12,10 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// An entity representing a group.
/// </summary>
public partial class Group : IHasPermissions, IHasConcurrencyToken
public class Group : IHasPermissions, IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Group"/> class.
/// Public constructor with required data.
/// </summary>
/// <param name="name">The name of the group.</param>
public Group(string name)
@ -31,33 +29,25 @@ namespace Jellyfin.Data.Entities
Id = Guid.NewGuid();
Permissions = new HashSet<Permission>();
ProviderMappings = new HashSet<ProviderMapping>();
Preferences = new HashSet<Preference>();
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="Group"/> class.
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected Group()
{
Init();
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Gets or sets the id of this group.
/// </summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </remarks>
[Key]
[Required]
public Guid Id { get; protected set; }
/// <summary>
@ -71,42 +61,19 @@ namespace Jellyfin.Data.Entities
[StringLength(255)]
public string Name { get; set; }
/// <summary>
/// Gets or sets the row version.
/// </summary>
/// <remarks>
/// Required, Concurrency Token.
/// </remarks>
/// <inheritdoc />
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
public void OnSavingChanges()
{
RowVersion++;
}
/*************************************************************************
* Navigation properties
*************************************************************************/
[ForeignKey("Permission_GroupPermissions_Id")]
/// <summary>
/// Gets or sets a collection containing the group's permissions.
/// </summary>
public virtual ICollection<Permission> Permissions { get; protected set; }
[ForeignKey("ProviderMapping_ProviderMappings_Id")]
public virtual ICollection<ProviderMapping> ProviderMappings { get; protected set; }
[ForeignKey("Preference_Preferences_Id")]
public virtual ICollection<Preference> Preferences { get; protected set; }
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// Gets or sets a collection containing the group's preferences.
/// </summary>
/// <param name="name">The name of this group.</param>
public static Group Create(string name)
{
return new Group(name);
}
public virtual ICollection<Preference> Preferences { get; protected set; }
/// <inheritdoc/>
public bool HasPermission(PermissionKind kind)
@ -120,6 +87,10 @@ namespace Jellyfin.Data.Entities
Permissions.First(p => p.Kind == kind).Value = value;
}
partial void Init();
/// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
}
}

@ -1,32 +1,65 @@
#pragma warning disable CS1591
using System;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity representing an image.
/// </summary>
public class ImageInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="ImageInfo"/> class.
/// </summary>
/// <param name="path">The path.</param>
public ImageInfo(string path)
{
Path = path;
LastModified = DateTime.UtcNow;
}
[Key]
[Required]
/// <summary>
/// Initializes a new instance of the <see cref="ImageInfo"/> class.
/// </summary>
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected ImageInfo()
{
}
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
/// Gets or sets the user id.
/// </summary>
public Guid? UserId { get; protected set; }
/// <summary>
/// Gets or sets the path of the image.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
[Required]
[MaxLength(512)]
[StringLength(512)]
public string Path { get; set; }
[Required]
/// <summary>
/// Gets or sets the date last modified.
/// </summary>
/// <remarks>
/// Required.
/// </remarks>
public DateTime LastModified { get; set; }
}
}

@ -1,12 +1,13 @@
#pragma warning disable CS1591
using System;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity that represents a user's display preferences for a specific item.
/// </summary>
public class ItemDisplayPreferences
{
/// <summary>

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
@ -8,7 +10,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity containing metadata for a book.
/// </summary>
public class BookMetadata : Metadata, IHasCompanies
public class BookMetadata : ItemMetadata, IHasCompanies
{
/// <summary>
/// Initializes a new instance of the <see cref="BookMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

@ -73,7 +73,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// Gets or sets the next item in the collection.
/// </summary>
/// <remarks>
/// TODO check if this properly updated dependant and has the proper principal relationship
/// TODO check if this properly updated dependant and has the proper principal relationship.
/// </remarks>
public virtual CollectionItem Next { get; set; }
@ -81,7 +81,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// Gets or sets the previous item in the collection.
/// </summary>
/// <remarks>
/// TODO check if this properly updated dependant and has the proper principal relationship
/// TODO check if this properly updated dependant and has the proper principal relationship.
/// </remarks>
public virtual CollectionItem Previous { get; set; }

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

@ -6,7 +6,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity holding metadata for a <see cref="Company"/>.
/// </summary>
public class CompanyMetadata : Metadata
public class CompanyMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="CompanyMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -5,7 +5,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity containing metadata for a custom item.
/// </summary>
public class CustomItemMetadata : Metadata
public class CustomItemMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -6,7 +6,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity containing metadata for an <see cref="Episode"/>.
/// </summary>
public class EpisodeMetadata : Metadata
public class EpisodeMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.

@ -14,8 +14,8 @@ namespace Jellyfin.Data.Entities.Libraries
/// Initializes a new instance of the <see cref="Genre"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="metadata">The metadata.</param>
public Genre(string name, Metadata metadata)
/// <param name="itemMetadata">The metadata.</param>
public Genre(string name, ItemMetadata itemMetadata)
{
if (string.IsNullOrEmpty(name))
{
@ -24,12 +24,12 @@ namespace Jellyfin.Data.Entities.Libraries
Name = name;
if (metadata == null)
if (itemMetadata == null)
{
throw new ArgumentNullException(nameof(metadata));
throw new ArgumentNullException(nameof(itemMetadata));
}
metadata.Genres.Add(this);
itemMetadata.Genres.Add(this);
}
/// <summary>

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -9,14 +11,14 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An abstract class that holds metadata.
/// </summary>
public abstract class Metadata : IHasArtwork, IHasConcurrencyToken
public abstract class ItemMetadata : IHasArtwork, IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Metadata"/> class.
/// Initializes a new instance of the <see cref="ItemMetadata"/> class.
/// </summary>
/// <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)
protected ItemMetadata(string title, string language)
{
if (string.IsNullOrEmpty(title))
{
@ -41,12 +43,12 @@ namespace Jellyfin.Data.Entities.Libraries
}
/// <summary>
/// Initializes a new instance of the <see cref="Metadata"/> class.
/// Initializes a new instance of the <see cref="ItemMetadata"/> class.
/// </summary>
/// <remarks>
/// Default constructor. Protected due to being abstract.
/// </remarks>
protected Metadata()
protected ItemMetadata()
{
}

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

@ -14,8 +14,8 @@ namespace Jellyfin.Data.Entities.Libraries
/// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
/// </summary>
/// <param name="providerId">The provider id.</param>
/// <param name="metadata">The metadata entity.</param>
public MetadataProviderId(string providerId, Metadata metadata)
/// <param name="itemMetadata">The metadata entity.</param>
public MetadataProviderId(string providerId, ItemMetadata itemMetadata)
{
if (string.IsNullOrEmpty(providerId))
{
@ -24,12 +24,12 @@ namespace Jellyfin.Data.Entities.Libraries
ProviderId = providerId;
if (metadata == null)
if (itemMetadata == null)
{
throw new ArgumentNullException(nameof(metadata));
throw new ArgumentNullException(nameof(itemMetadata));
}
metadata.Sources.Add(this);
itemMetadata.Sources.Add(this);
}
/// <summary>

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@ -8,7 +10,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity holding the metadata for a movie.
/// </summary>
public class MovieMetadata : Metadata, IHasCompanies
public class MovieMetadata : ItemMetadata, IHasCompanies
{
/// <summary>
/// Initializes a new instance of the <see cref="MovieMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
namespace Jellyfin.Data.Entities.Libraries

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -6,7 +8,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity holding the metadata for a music album.
/// </summary>
public class MusicAlbumMetadata : Metadata
public class MusicAlbumMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="MusicAlbumMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -16,17 +18,17 @@ namespace Jellyfin.Data.Entities.Libraries
/// Initializes a new instance of the <see cref="PersonRole"/> class.
/// </summary>
/// <param name="type">The role type.</param>
/// <param name="metadata">The metadata.</param>
public PersonRole(PersonRoleType type, Metadata metadata)
/// <param name="itemMetadata">The metadata.</param>
public PersonRole(PersonRoleType type, ItemMetadata itemMetadata)
{
Type = type;
if (metadata == null)
if (itemMetadata == null)
{
throw new ArgumentNullException(nameof(metadata));
throw new ArgumentNullException(nameof(itemMetadata));
}
metadata.PersonRoles.Add(this);
itemMetadata.PersonRoles.Add(this);
Sources = new HashSet<MetadataProviderId>();
}

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -5,7 +5,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity that holds metadata for a photo.
/// </summary>
public class PhotoMetadata : Metadata
public class PhotoMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="PhotoMetadata"/> class.

@ -14,17 +14,17 @@ namespace Jellyfin.Data.Entities.Libraries
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="metadata">The metadata.</param>
public Rating(double value, Metadata metadata)
/// <param name="itemMetadata">The metadata.</param>
public Rating(double value, ItemMetadata itemMetadata)
{
Value = value;
if (metadata == null)
if (itemMetadata == null)
{
throw new ArgumentNullException(nameof(metadata));
throw new ArgumentNullException(nameof(itemMetadata));
}
metadata.Ratings.Add(this);
itemMetadata.Ratings.Add(this);
}
/// <summary>

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;

@ -6,7 +6,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity that holds metadata for seasons.
/// </summary>
public class SeasonMetadata : Metadata
public class SeasonMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="SeasonMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -9,7 +11,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity representing series metadata.
/// </summary>
public class SeriesMetadata : Metadata, IHasCompanies
public class SeriesMetadata : ItemMetadata, IHasCompanies
{
/// <summary>
/// Initializes a new instance of the <see cref="SeriesMetadata"/> class.

@ -1,3 +1,5 @@
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;

@ -5,7 +5,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// An entity holding metadata for a track.
/// </summary>
public class TrackMetadata : Metadata
public class TrackMetadata : ItemMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="TrackMetadata"/> class.

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
@ -10,7 +8,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// An entity representing whether the associated user has a specific permission.
/// </summary>
public partial class Permission : IHasConcurrencyToken
public class Permission : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Permission"/> class.
@ -22,8 +20,6 @@ namespace Jellyfin.Data.Entities
{
Kind = kind;
Value = value;
Init();
}
/// <summary>
@ -32,21 +28,14 @@ namespace Jellyfin.Data.Entities
/// </summary>
protected Permission()
{
Init();
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// 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; }
@ -56,7 +45,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public PermissionKind Kind { get; protected set; }
/// <summary>
@ -65,36 +53,16 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool Value { get; set; }
/// <summary>
/// Gets or sets the row version.
/// </summary>
/// <remarks>
/// Required, ConcurrencyToken.
/// </remarks>
/// <inheritdoc />
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
/// <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)
{
return new Permission(kind, value);
}
/// <inheritdoc/>
public void OnSavingChanges()
{
RowVersion++;
}
partial void Init();
}
}

@ -31,18 +31,12 @@ namespace Jellyfin.Data.Entities
{
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// 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; }
@ -52,7 +46,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public PreferenceKind Kind { get; protected set; }
/// <summary>
@ -66,27 +59,10 @@ namespace Jellyfin.Data.Entities
[StringLength(65535)]
public string Value { get; set; }
/// <summary>
/// Gets or sets the row version.
/// </summary>
/// <remarks>
/// Required, ConcurrencyToken.
/// </remarks>
/// <inheritdoc/>
[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()
{

@ -1,129 +0,0 @@
#pragma warning disable CS1591
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
public partial class ProviderMapping
{
partial void Init();
/// <summary>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
protected ProviderMapping()
{
Init();
}
/// <summary>
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
/// </summary>
public static ProviderMapping CreateProviderMappingUnsafe()
{
return new ProviderMapping();
}
/// <summary>
/// Public constructor with required data.
/// </summary>
/// <param name="providername"></param>
/// <param name="providersecrets"></param>
/// <param name="providerdata"></param>
/// <param name="_user0"></param>
/// <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(providersecrets))
{
throw new ArgumentNullException(nameof(providersecrets));
}
this.ProviderSecrets = providersecrets;
if (string.IsNullOrEmpty(providerdata))
{
throw new ArgumentNullException(nameof(providerdata));
}
this.ProviderData = providerdata;
Init();
}
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
/// <param name="providername"></param>
/// <param name="providersecrets"></param>
/// <param name="providerdata"></param>
/// <param name="_user0"></param>
/// <param name="_group1"></param>
public static ProviderMapping Create(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
{
return new ProviderMapping(providername, providersecrets, providerdata, _user0, _group1);
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
/// Required, Max length = 255
/// </summary>
[Required]
[MaxLength(255)]
[StringLength(255)]
public string ProviderName { get; set; }
/// <summary>
/// Required, Max length = 65535
/// </summary>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
public string ProviderSecrets { get; set; }
/// <summary>
/// Required, Max length = 65535
/// </summary>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
public string ProviderData { get; set; }
/// <summary>
/// Required, ConcurrenyToken.
/// </summary>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
public void OnSavingChanges()
{
RowVersion++;
}
/*************************************************************************
* Navigation properties
*************************************************************************/
}
}

@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
@ -15,7 +15,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// An entity representing a user.
/// </summary>
public partial class User : IHasPermissions, IHasConcurrencyToken
public class User : IHasPermissions, IHasConcurrencyToken
{
/// <summary>
/// The values being delimited here are Guids, so commas work as they do not appear in Guids.
@ -75,7 +75,6 @@ namespace Jellyfin.Data.Entities
AddDefaultPermissions();
AddDefaultPreferences();
Init();
}
/// <summary>
@ -84,21 +83,14 @@ namespace Jellyfin.Data.Entities
/// </summary>
protected User()
{
Init();
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Gets or sets the Id of the user.
/// </summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </remarks>
[Key]
[Required]
[JsonIgnore]
public Guid Id { get; set; }
@ -139,7 +131,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool MustUpdatePassword { get; set; }
/// <summary>
@ -180,7 +171,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public int InvalidLoginAttemptCount { get; set; }
/// <summary>
@ -204,7 +194,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public SubtitlePlaybackMode SubtitleMode { get; set; }
/// <summary>
@ -213,7 +202,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool PlayDefaultAudioTrack { get; set; }
/// <summary>
@ -232,7 +220,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool DisplayMissingEpisodes { get; set; }
/// <summary>
@ -241,7 +228,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool DisplayCollectionsView { get; set; }
/// <summary>
@ -250,7 +236,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool EnableLocalPassword { get; set; }
/// <summary>
@ -259,7 +244,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool HidePlayedInLatest { get; set; }
/// <summary>
@ -268,7 +252,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool RememberAudioSelections { get; set; }
/// <summary>
@ -277,7 +260,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool RememberSubtitleSelections { get; set; }
/// <summary>
@ -286,7 +268,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool EnableNextEpisodeAutoPlay { get; set; }
/// <summary>
@ -295,7 +276,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool EnableAutoLogin { get; set; }
/// <summary>
@ -304,7 +284,6 @@ namespace Jellyfin.Data.Entities
/// <remarks>
/// Required.
/// </remarks>
[Required]
public bool EnableUserPreferenceAccess { get; set; }
/// <summary>
@ -322,7 +301,6 @@ namespace Jellyfin.Data.Entities
/// 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; }
/// <summary>
@ -340,7 +318,9 @@ namespace Jellyfin.Data.Entities
[Required]
public virtual DisplayPreferences DisplayPreferences { get; set; }
[Required]
/// <summary>
/// Gets or sets the level of sync play permissions this user has.
/// </summary>
public SyncPlayAccess SyncPlayAccess { get; set; }
/// <summary>
@ -350,13 +330,8 @@ namespace Jellyfin.Data.Entities
/// Required, Concurrency Token.
/// </remarks>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
/*************************************************************************
* Navigation properties
*************************************************************************/
/// <summary>
/// Gets or sets the list of access schedules this user has.
/// </summary>
@ -395,18 +370,6 @@ namespace Jellyfin.Data.Entities
[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()
{
@ -519,7 +482,5 @@ namespace Jellyfin.Data.Entities
Preferences.Add(new Preference(val, string.Empty));
}
}
partial void Init();
}
}

@ -1,13 +1,33 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing types of art.
/// </summary>
public enum ArtKind
{
Other,
Poster,
Banner,
Thumbnail,
Logo
/// <summary>
/// Another type of art, not covered by the other members.
/// </summary>
Other = 0,
/// <summary>
/// A poster.
/// </summary>
Poster = 1,
/// <summary>
/// A banner.
/// </summary>
Banner = 2,
/// <summary>
/// A thumbnail.
/// </summary>
Thumbnail = 3,
/// <summary>
/// A logo.
/// </summary>
Logo = 4
}
}

@ -1,18 +1,58 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum that represents a day of the week, weekdays, weekends, or all days.
/// </summary>
public enum DynamicDayOfWeek
{
/// <summary>
/// Sunday.
/// </summary>
Sunday = 0,
/// <summary>
/// Monday.
/// </summary>
Monday = 1,
/// <summary>
/// Tuesday.
/// </summary>
Tuesday = 2,
/// <summary>
/// Wednesday.
/// </summary>
Wednesday = 3,
/// <summary>
/// Thursday.
/// </summary>
Thursday = 4,
/// <summary>
/// Friday.
/// </summary>
Friday = 5,
/// <summary>
/// Saturday.
/// </summary>
Saturday = 6,
/// <summary>
/// All days of the week.
/// </summary>
Everyday = 7,
/// <summary>
/// A week day, or Monday-Friday.
/// </summary>
Weekday = 8,
/// <summary>
/// Saturday and Sunday.
/// </summary>
Weekend = 9
}
}

@ -1,7 +1,8 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing a type of indexing in a user's display preferences.
/// </summary>
public enum IndexingKind
{
/// <summary>

@ -1,13 +1,33 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing the type of media file.
/// </summary>
public enum MediaFileKind
{
Main,
Sidecar,
AdditionalPart,
AlternativeFormat,
AdditionalStream
/// <summary>
/// The main file.
/// </summary>
Main = 0,
/// <summary>
/// A sidecar file.
/// </summary>
Sidecar = 1,
/// <summary>
/// An additional part to the main file.
/// </summary>
AdditionalPart = 2,
/// <summary>
/// An alternative format to the main file.
/// </summary>
AlternativeFormat = 3,
/// <summary>
/// An additional stream for the main file.
/// </summary>
AdditionalStream = 4
}
}

@ -1,20 +1,68 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing a person's role in a specific media item.
/// </summary>
public enum PersonRoleType
{
Other,
Director,
Artist,
OriginalArtist,
Actor,
VoiceActor,
Producer,
Remixer,
Conductor,
Composer,
Author,
Editor
/// <summary>
/// Another role, not covered by the other types.
/// </summary>
Other = 0,
/// <summary>
/// The director of the media.
/// </summary>
Director = 1,
/// <summary>
/// An artist.
/// </summary>
Artist = 2,
/// <summary>
/// The original artist.
/// </summary>
OriginalArtist = 3,
/// <summary>
/// An actor.
/// </summary>
Actor = 4,
/// <summary>
/// A voice actor.
/// </summary>
VoiceActor = 5,
/// <summary>
/// A producer.
/// </summary>
Producer = 6,
/// <summary>
/// A remixer.
/// </summary>
Remixer = 7,
/// <summary>
/// A conductor.
/// </summary>
Conductor = 8,
/// <summary>
/// A composer.
/// </summary>
Composer = 9,
/// <summary>
/// An author.
/// </summary>
Author = 10,
/// <summary>
/// An editor.
/// </summary>
Editor = 11
}
}

@ -1,13 +1,33 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing a subtitle playback mode.
/// </summary>
public enum SubtitlePlaybackMode
{
/// <summary>
/// The default subtitle playback mode.
/// </summary>
Default = 0,
/// <summary>
/// Always show subtitles.
/// </summary>
Always = 1,
/// <summary>
/// Only show forced subtitles.
/// </summary>
OnlyForced = 2,
/// <summary>
/// Don't show subtitles.
/// </summary>
None = 3,
/// <summary>
/// Only show subtitles when the current audio stream is in a different language.
/// </summary>
Smart = 4
}
}

@ -1,17 +1,53 @@
#pragma warning disable CS1591
namespace Jellyfin.Data.Enums
{
/// <summary>
/// An enum representing an unrated item.
/// </summary>
public enum UnratedItem
{
Movie,
Trailer,
Series,
Music,
Book,
LiveTvChannel,
LiveTvProgram,
ChannelContent,
Other
/// <summary>
/// A movie.
/// </summary>
Movie = 0,
/// <summary>
/// A trailer.
/// </summary>
Trailer = 1,
/// <summary>
/// A series.
/// </summary>
Series = 2,
/// <summary>
/// Music.
/// </summary>
Music = 3,
/// <summary>
/// A book.
/// </summary>
Book = 4,
/// <summary>
/// A live TV channel
/// </summary>
LiveTvChannel = 5,
/// <summary>
/// A live TV program.
/// </summary>
LiveTvProgram = 6,
/// <summary>
/// Channel content.
/// </summary>
ChannelContent = 7,
/// <summary>
/// Another type, not covered by the other fields.
/// </summary>
Other = 8
}
}

@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' ">true</TreatWarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
@ -45,4 +45,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedVersion.cs" />
</ItemGroup>
</Project>

Loading…
Cancel
Save