Warnings cleanup
This commit is contained in:
parent
42177d1739
commit
56212e8101
|
@ -6,22 +6,18 @@ using Jellyfin.Data.Enums;
|
||||||
|
|
||||||
namespace Jellyfin.Data.Entities
|
namespace Jellyfin.Data.Entities
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An entity representing a user's access schedule.
|
||||||
|
/// </summary>
|
||||||
public class AccessSchedule
|
public class AccessSchedule
|
||||||
{
|
{
|
||||||
/// <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>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="AccessSchedule"/> class.
|
/// Initializes a new instance of the <see cref="AccessSchedule"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dayOfWeek">The day of the week.</param>
|
/// <param name="dayOfWeek">The day of the week.</param>
|
||||||
/// <param name="startHour">The start hour.</param>
|
/// <param name="startHour">The start hour.</param>
|
||||||
/// <param name="endHour">The end 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)
|
public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
|
||||||
{
|
{
|
||||||
UserId = userId;
|
UserId = userId;
|
||||||
|
@ -31,26 +27,31 @@ namespace Jellyfin.Data.Entities
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Factory method
|
/// Initializes a new instance of the <see cref="AccessSchedule"/> class.
|
||||||
|
/// Default constructor. Protected due to required properties, but present because EF needs it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dayOfWeek">The day of the week.</param>
|
protected AccessSchedule()
|
||||||
/// <param name="startHour">The start hour.</param>
|
|
||||||
/// <param name="endHour">The end hour.</param>
|
|
||||||
/// <returns>The newly created instance.</returns>
|
|
||||||
public static AccessSchedule CreateInstance(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
|
|
||||||
{
|
{
|
||||||
return new AccessSchedule(dayOfWeek, startHour, endHour, userId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the id of this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Identity, Indexed, Required.
|
||||||
|
/// </remarks>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[Key]
|
[Key]
|
||||||
[Required]
|
[Required]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; set; }
|
public int Id { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the id of the associated user.
|
||||||
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
[ForeignKey("Id")]
|
[ForeignKey("Id")]
|
||||||
public Guid UserId { get; set; }
|
public Guid UserId { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the day of week.
|
/// Gets or sets the day of week.
|
||||||
|
@ -72,5 +73,18 @@ namespace Jellyfin.Data.Entities
|
||||||
/// <value>The end hour.</value>
|
/// <value>The end hour.</value>
|
||||||
[Required]
|
[Required]
|
||||||
public double EndHour { get; set; }
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
|
|
||||||
namespace Jellyfin.Data.Entities
|
namespace Jellyfin.Data.Entities
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An entity representing whether the associated user has a specific permission.
|
||||||
|
/// </summary>
|
||||||
public partial class Permission : ISavingChanges
|
public partial class Permission : ISavingChanges
|
||||||
{
|
{
|
||||||
partial void Init();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Permission"/> class.
|
/// Initializes a new instance of the <see cref="Permission"/> class.
|
||||||
/// Public constructor with required data
|
/// Public constructor with required data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kind"></param>
|
/// <param name="kind">The permission kind.</param>
|
||||||
/// <param name="value"></param>
|
/// <param name="value">The value of this permission.</param>
|
||||||
/// <param name="holderId"></param>
|
|
||||||
public Permission(PermissionKind kind, bool value)
|
public Permission(PermissionKind kind, bool value)
|
||||||
{
|
{
|
||||||
Kind = kind;
|
Kind = kind;
|
||||||
|
@ -35,95 +32,66 @@ namespace Jellyfin.Data.Entities
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Static create function (for use in LINQ queries, etc.)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="kind"></param>
|
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <param name="holderId"></param>
|
|
||||||
public static Permission Create(PermissionKind kind, bool value)
|
|
||||||
{
|
|
||||||
return new Permission(kind, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Properties
|
* Properties
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identity, Indexed, Required
|
/// Gets or sets the id of this permission.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Identity, Indexed, Required.
|
||||||
|
/// </remarks>
|
||||||
[Key]
|
[Key]
|
||||||
[Required]
|
[Required]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; protected set; }
|
public int Id { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Backing field for Kind
|
/// Gets or sets the type of this permission.
|
||||||
/// </summary>
|
|
||||||
protected PermissionKind _Kind;
|
|
||||||
/// <summary>
|
|
||||||
/// When provided in a partial class, allows value of Kind to be changed before setting.
|
|
||||||
/// </summary>
|
|
||||||
partial void SetKind(PermissionKind oldValue, ref PermissionKind newValue);
|
|
||||||
/// <summary>
|
|
||||||
/// When provided in a partial class, allows value of Kind to be changed before returning.
|
|
||||||
/// </summary>
|
|
||||||
partial void GetKind(ref PermissionKind result);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Required.
|
||||||
|
/// </remarks>
|
||||||
[Required]
|
[Required]
|
||||||
public PermissionKind Kind
|
public PermissionKind Kind { get; protected set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
PermissionKind value = _Kind;
|
|
||||||
GetKind(ref value);
|
|
||||||
return _Kind = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
PermissionKind oldValue = _Kind;
|
|
||||||
SetKind(oldValue, ref value);
|
|
||||||
if (oldValue != value)
|
|
||||||
{
|
|
||||||
_Kind = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required
|
/// Gets or sets a value indicating whether the associated user has this permission.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Required.
|
||||||
|
/// </remarks>
|
||||||
[Required]
|
[Required]
|
||||||
public bool Value { get; set; }
|
public bool Value { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required, ConcurrencyToken.
|
/// Gets or sets the row version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Required, ConcurrencyToken.
|
||||||
|
/// </remarks>
|
||||||
[ConcurrencyCheck]
|
[ConcurrencyCheck]
|
||||||
[Required]
|
[Required]
|
||||||
public uint RowVersion { get; set; }
|
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()
|
public void OnSavingChanges()
|
||||||
{
|
{
|
||||||
RowVersion++;
|
RowVersion++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
partial void Init();
|
||||||
* Navigation properties
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
public virtual event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
|
|
||||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
||||||
{
|
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#pragma warning disable CS1591
|
#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 System.Linq;
|
||||||
using Jellyfin.Data;
|
using Jellyfin.Data;
|
||||||
|
@ -15,6 +10,19 @@ namespace Jellyfin.Server.Implementations
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public partial class JellyfinDb : DbContext
|
public partial class JellyfinDb : DbContext
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="JellyfinDb"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="options">The database context options.</param>
|
||||||
|
public JellyfinDb(DbContextOptions<JellyfinDb> options) : base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the default connection string.
|
||||||
|
/// </summary>
|
||||||
|
public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
|
||||||
|
|
||||||
public virtual DbSet<ActivityLog> ActivityLogs { get; set; }
|
public virtual DbSet<ActivityLog> ActivityLogs { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Group> Groups { get; set; }
|
public virtual DbSet<Group> Groups { get; set; }
|
||||||
|
@ -69,17 +77,18 @@ namespace Jellyfin.Server.Implementations
|
||||||
public virtual DbSet<Track> Tracks { get; set; }
|
public virtual DbSet<Track> Tracks { get; set; }
|
||||||
public virtual DbSet<TrackMetadata> TrackMetadata { get; set; }*/
|
public virtual DbSet<TrackMetadata> TrackMetadata { get; set; }*/
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Gets or sets the default connection string.
|
public override int SaveChanges()
|
||||||
/// </summary>
|
|
||||||
public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public JellyfinDb(DbContextOptions<JellyfinDb> options) : base(options)
|
|
||||||
{
|
{
|
||||||
}
|
foreach (var saveEntity in ChangeTracker.Entries()
|
||||||
|
.Where(e => e.State == EntityState.Modified)
|
||||||
|
.OfType<ISavingChanges>())
|
||||||
|
{
|
||||||
|
saveEntity.OnSavingChanges();
|
||||||
|
}
|
||||||
|
|
||||||
partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
|
return base.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
@ -87,9 +96,6 @@ namespace Jellyfin.Server.Implementations
|
||||||
CustomInit(optionsBuilder);
|
CustomInit(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
|
|
||||||
partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
@ -109,16 +115,10 @@ namespace Jellyfin.Server.Implementations
|
||||||
OnModelCreatedImpl(modelBuilder);
|
OnModelCreatedImpl(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int SaveChanges()
|
partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
|
||||||
{
|
|
||||||
foreach (var saveEntity in ChangeTracker.Entries()
|
|
||||||
.Where(e => e.State == EntityState.Modified)
|
|
||||||
.OfType<ISavingChanges>())
|
|
||||||
{
|
|
||||||
saveEntity.OnSavingChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.SaveChanges();
|
partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
|
||||||
}
|
|
||||||
|
partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using User = Jellyfin.Data.Entities.User;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Drawing
|
namespace MediaBrowser.Controller.Drawing
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user