< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.ActivityLog
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/ActivityLog.cs
Line coverage
80%
Covered lines: 8
Uncovered lines: 2
Coverable lines: 10
Total lines: 123
Line coverage: 80%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/ActivityLog.cs

#LineLine coverage
 1using System;
 2using System.ComponentModel.DataAnnotations;
 3using System.ComponentModel.DataAnnotations.Schema;
 4using Jellyfin.Data.Interfaces;
 5using Microsoft.Extensions.Logging;
 6
 7namespace Jellyfin.Data.Entities
 8{
 9    /// <summary>
 10    /// An entity referencing an activity log entry.
 11    /// </summary>
 12    public class ActivityLog : IHasConcurrencyToken
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="ActivityLog"/> class.
 16        /// Public constructor with required data.
 17        /// </summary>
 18        /// <param name="name">The name.</param>
 19        /// <param name="type">The type.</param>
 20        /// <param name="userId">The user id.</param>
 21        public ActivityLog(string name, string type, Guid userId)
 22        {
 3623            ArgumentException.ThrowIfNullOrEmpty(name);
 3624            ArgumentException.ThrowIfNullOrEmpty(type);
 25
 3626            Name = name;
 3627            Type = type;
 3628            UserId = userId;
 3629            DateCreated = DateTime.UtcNow;
 3630            LogSeverity = LogLevel.Information;
 3631        }
 32
 33        /// <summary>
 34        /// Gets the identity of this instance.
 35        /// </summary>
 36        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 37        public int Id { get; private set; }
 38
 39        /// <summary>
 40        /// Gets or sets the name.
 41        /// </summary>
 42        /// <remarks>
 43        /// Required, Max length = 512.
 44        /// </remarks>
 45        [MaxLength(512)]
 46        [StringLength(512)]
 47        public string Name { get; set; }
 48
 49        /// <summary>
 50        /// Gets or sets the overview.
 51        /// </summary>
 52        /// <remarks>
 53        /// Max length = 512.
 54        /// </remarks>
 55        [MaxLength(512)]
 56        [StringLength(512)]
 57        public string? Overview { get; set; }
 58
 59        /// <summary>
 60        /// Gets or sets the short overview.
 61        /// </summary>
 62        /// <remarks>
 63        /// Max length = 512.
 64        /// </remarks>
 65        [MaxLength(512)]
 66        [StringLength(512)]
 67        public string? ShortOverview { get; set; }
 68
 69        /// <summary>
 70        /// Gets or sets the type.
 71        /// </summary>
 72        /// <remarks>
 73        /// Required, Max length = 256.
 74        /// </remarks>
 75        [MaxLength(256)]
 76        [StringLength(256)]
 77        public string Type { get; set; }
 78
 79        /// <summary>
 80        /// Gets or sets the user id.
 81        /// </summary>
 82        /// <remarks>
 83        /// Required.
 84        /// </remarks>
 85        public Guid UserId { get; set; }
 86
 87        /// <summary>
 88        /// Gets or sets the item id.
 89        /// </summary>
 90        /// <remarks>
 91        /// Max length = 256.
 92        /// </remarks>
 93        [MaxLength(256)]
 94        [StringLength(256)]
 95        public string? ItemId { get; set; }
 96
 97        /// <summary>
 98        /// Gets or sets the date created. This should be in UTC.
 99        /// </summary>
 100        /// <remarks>
 101        /// Required.
 102        /// </remarks>
 103        public DateTime DateCreated { get; set; }
 104
 105        /// <summary>
 106        /// Gets or sets the log severity. Default is <see cref="LogLevel.Trace"/>.
 107        /// </summary>
 108        /// <remarks>
 109        /// Required.
 110        /// </remarks>
 111        public LogLevel LogSeverity { get; set; }
 112
 113        /// <inheritdoc />
 114        [ConcurrencyCheck]
 115        public uint RowVersion { get; private set; }
 116
 117        /// <inheritdoc />
 118        public void OnSavingChanges()
 119        {
 0120            RowVersion++;
 0121        }
 122    }
 123}