diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs
index 711e94dd18..4248a34c9c 100644
--- a/Jellyfin.Data/Entities/AccessSchedule.cs
+++ b/Jellyfin.Data/Entities/AccessSchedule.cs
@@ -6,22 +6,18 @@ using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
+ ///
+ /// An entity representing a user's access schedule.
+ ///
public class AccessSchedule
{
- ///
- /// Initializes a new instance of the class.
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- ///
- protected AccessSchedule()
- {
- }
-
///
/// Initializes a new instance of the class.
///
/// The day of the week.
/// The start hour.
/// The end hour.
+ /// The associated user's id.
public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
{
UserId = userId;
@@ -31,26 +27,31 @@ namespace Jellyfin.Data.Entities
}
///
- /// Factory method
+ /// Initializes a new instance of the class.
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
///
- /// The day of the week.
- /// The start hour.
- /// The end hour.
- /// The newly created instance.
- public static AccessSchedule CreateInstance(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
+ protected AccessSchedule()
{
- return new AccessSchedule(dayOfWeek, startHour, endHour, userId);
}
+ ///
+ /// Gets or sets the id of this instance.
+ ///
+ ///
+ /// Identity, Indexed, Required.
+ ///
[JsonIgnore]
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id { get; set; }
+ public int Id { get; protected set; }
+ ///
+ /// Gets or sets the id of the associated user.
+ ///
[Required]
[ForeignKey("Id")]
- public Guid UserId { get; set; }
+ public Guid UserId { get; protected set; }
///
/// Gets or sets the day of week.
@@ -72,5 +73,18 @@ namespace Jellyfin.Data.Entities
/// The end hour.
[Required]
public double EndHour { get; set; }
+
+ ///
+ /// Static create function (for use in LINQ queries, etc.)
+ ///
+ /// The day of the week.
+ /// The start hour.
+ /// The end hour.
+ /// The associated user's id.
+ /// The newly created instance.
+ 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/Permission.cs b/Jellyfin.Data/Entities/Permission.cs
index 7061280283..b675e911d9 100644
--- a/Jellyfin.Data/Entities/Permission.cs
+++ b/Jellyfin.Data/Entities/Permission.cs
@@ -1,23 +1,20 @@
-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
{
+ ///
+ /// An entity representing whether the associated user has a specific permission.
+ ///
public partial class Permission : ISavingChanges
{
- partial void Init();
-
///
/// Initializes a new instance of the class.
- /// Public constructor with required data
+ /// Public constructor with required data.
///
- ///
- ///
- ///
+ /// The permission kind.
+ /// The value of this permission.
public Permission(PermissionKind kind, bool value)
{
Kind = kind;
@@ -35,95 +32,66 @@ namespace Jellyfin.Data.Entities
Init();
}
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- ///
- public static Permission Create(PermissionKind kind, bool value)
- {
- return new Permission(kind, value);
- }
-
/*************************************************************************
* Properties
*************************************************************************/
///
- /// Identity, Indexed, Required
+ /// Gets or sets the id of this permission.
///
+ ///
+ /// Identity, Indexed, Required.
+ ///
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
- /// Backing field for Kind
- ///
- protected PermissionKind _Kind;
- ///
- /// When provided in a partial class, allows value of Kind to be changed before setting.
- ///
- partial void SetKind(PermissionKind oldValue, ref PermissionKind newValue);
- ///
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- ///
- partial void GetKind(ref PermissionKind result);
-
- ///
- /// Required
+ /// Gets or sets the type of this permission.
///
+ ///
+ /// Required.
+ ///
[Required]
- public PermissionKind Kind
- {
- get
- {
- PermissionKind value = _Kind;
- GetKind(ref value);
- return _Kind = value;
- }
-
- set
- {
- PermissionKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- OnPropertyChanged();
- }
- }
- }
+ public PermissionKind Kind { get; protected set; }
///
- /// Required
+ /// Gets or sets a value indicating whether the associated user has this permission.
///
+ ///
+ /// Required.
+ ///
[Required]
public bool Value { get; set; }
///
- /// Required, ConcurrencyToken.
+ /// Gets or sets the row version.
///
+ ///
+ /// Required, ConcurrencyToken.
+ ///
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
+ ///
+ /// Static create function (for use in LINQ queries, etc.)
+ ///
+ /// The permission kind.
+ /// The value of this permission.
+ /// The newly created instance.
+ public static Permission Create(PermissionKind kind, bool value)
+ {
+ return new Permission(kind, value);
+ }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- public virtual event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
+ partial void Init();
}
}
-
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs
index 7e10d81dca..89fd371f8f 100644
--- a/Jellyfin.Server.Implementations/JellyfinDb.cs
+++ b/Jellyfin.Server.Implementations/JellyfinDb.cs
@@ -1,9 +1,4 @@
#pragma warning disable CS1591
-#pragma warning disable SA1201 // Constuctors should not follow properties
-#pragma warning disable SA1516 // Elements should be followed by a blank line
-#pragma warning disable SA1623 // Property's documentation should begin with gets or sets
-#pragma warning disable SA1629 // Documentation should end with a period
-#pragma warning disable SA1648 // Inheritdoc should be used with inheriting class
using System.Linq;
using Jellyfin.Data;
@@ -15,6 +10,19 @@ namespace Jellyfin.Server.Implementations
///
public partial class JellyfinDb : DbContext
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The database context options.
+ public JellyfinDb(DbContextOptions options) : base(options)
+ {
+ }
+
+ ///
+ /// Gets or sets the default connection string.
+ ///
+ public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
+
public virtual DbSet ActivityLogs { get; set; }
public virtual DbSet Groups { get; set; }
@@ -69,17 +77,18 @@ namespace Jellyfin.Server.Implementations
public virtual DbSet