diff options
| author | Patrick Barron <barronpm@gmail.com> | 2021-08-13 20:35:31 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2021-08-13 20:35:31 -0400 |
| commit | 15baf04bd2bfc2850c4f516253f1925b40a02f5e (patch) | |
| tree | cb34b2283900369581a6c1568ba43195cd93d884 /Jellyfin.Data | |
| parent | 60ce0c9fa9a3df50a8a7a08629bcedbe3724aee3 (diff) | |
Add IAuditableEntity
Diffstat (limited to 'Jellyfin.Data')
| -rw-r--r-- | Jellyfin.Data/Entities/Security/Device.cs | 11 | ||||
| -rw-r--r-- | Jellyfin.Data/Interfaces/IAuditableEntity.cs | 20 |
2 files changed, 27 insertions, 4 deletions
diff --git a/Jellyfin.Data/Entities/Security/Device.cs b/Jellyfin.Data/Entities/Security/Device.cs index 3d0269229..9490323b1 100644 --- a/Jellyfin.Data/Entities/Security/Device.cs +++ b/Jellyfin.Data/Entities/Security/Device.cs @@ -2,13 +2,14 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Globalization; +using Jellyfin.Data.Interfaces; namespace Jellyfin.Data.Entities.Security { /// <summary> /// An entity representing a device. /// </summary> - public class Device + public class Device : IAuditableEntity { /// <summary> /// Initializes a new instance of the <see cref="Device"/> class. @@ -28,6 +29,7 @@ namespace Jellyfin.Data.Entities.Security AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); DateCreated = DateTime.UtcNow; + DateModified = DateCreated; DateLastActivity = DateCreated; // Non-nullable for EF Core, as this is a required relationship. @@ -83,11 +85,12 @@ namespace Jellyfin.Data.Entities.Security /// </summary> public bool IsActive { get; set; } - /// <summary> - /// Gets or sets the date this device was created. - /// </summary> + /// <inheritdoc /> public DateTime DateCreated { get; set; } + /// <inheritdoc /> + public DateTime DateModified { get; set; } + /// <summary> /// Gets or sets the date of last activity. /// </summary> diff --git a/Jellyfin.Data/Interfaces/IAuditableEntity.cs b/Jellyfin.Data/Interfaces/IAuditableEntity.cs new file mode 100644 index 000000000..4420446ae --- /dev/null +++ b/Jellyfin.Data/Interfaces/IAuditableEntity.cs @@ -0,0 +1,20 @@ +using System; + +namespace Jellyfin.Data.Interfaces +{ + /// <summary> + /// An interface representing an entity that has creation/modification dates. + /// </summary> + public interface IAuditableEntity + { + /// <summary> + /// Gets the date this entity was created. + /// </summary> + public DateTime DateCreated { get; } + + /// <summary> + /// Gets or sets the date this entity was modified. + /// </summary> + public DateTime DateModified { get; set; } + } +} |
