First pass at cleaning entity classes.

- Documents all library entities
- Fixes styling warnings for library entities
- Updates library entities to inherit from interfaces
- Makes library entites no longer partial.
This commit is contained in:
Patrick Barron
2020-08-30 18:50:54 -04:00
parent 414bedbde4
commit acb213e4b8
50 changed files with 1335 additions and 5213 deletions

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities.Libraries;
namespace Jellyfin.Data.Interfaces
{
/// <summary>
/// An interface abstracting an entity that has artwork.
/// </summary>
public interface IHasArtwork
{
/// <summary>
/// Gets a collection containing this entity's artwork.
/// </summary>
ICollection<Artwork> Artwork { get; }
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities.Libraries;
namespace Jellyfin.Data.Interfaces
{
/// <summary>
/// An abstraction representing an entity that has companies.
/// </summary>
public interface IHasCompanies
{
/// <summary>
/// Gets a collection containing this entity's companies.
/// </summary>
ICollection<Company> Companies { get; }
}
}

View File

@@ -0,0 +1,18 @@
namespace Jellyfin.Data.Interfaces
{
/// <summary>
/// An interface abstracting an entity that has a concurrency token.
/// </summary>
public interface IHasConcurrencyToken
{
/// <summary>
/// Gets the version of this row. Acts as a concurrency token.
/// </summary>
uint RowVersion { get; }
/// <summary>
/// Called when saving changes to this entity.
/// </summary>
void OnSavingChanges();
}
}

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
namespace Jellyfin.Data
{
/// <summary>
/// An abstraction representing an entity that has permissions.
/// </summary>
public interface IHasPermissions
{
/// <summary>
/// Gets a collection containing this entity's permissions.
/// </summary>
ICollection<Permission> Permissions { get; }
/// <summary>
/// Checks whether this entity has the specified permission kind.
/// </summary>
/// <param name="kind">The kind of permission.</param>
/// <returns><c>true</c> if this entity has the specified permission, <c>false</c> otherwise.</returns>
bool HasPermission(PermissionKind kind);
/// <summary>
/// Sets the specified permission to the provided value.
/// </summary>
/// <param name="kind">The kind of permission.</param>
/// <param name="value">The value to set.</param>
void SetPermission(PermissionKind kind, bool value);
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using Jellyfin.Data.Entities.Libraries;
namespace Jellyfin.Data.Interfaces
{
/// <summary>
/// An abstraction representing an entity that has releases.
/// </summary>
public interface IHasReleases
{
/// <summary>
/// Gets a collection containing this entity's releases.
/// </summary>
ICollection<Release> Releases { get; }
}
}