mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Clean up ActivityLog.cs
This commit is contained in:
parent
732ec7a462
commit
b24221b40f
1 changed files with 31 additions and 47 deletions
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue