Auto-set CreatedAt/UpdatedAt via EF interceptor; standardize timestamp names across entities
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
namespace Musify.Domain.Abstractions
|
||||
{
|
||||
public interface IAuditable
|
||||
{
|
||||
DateTime CreatedAt { get; set; }
|
||||
|
||||
DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using Musify.Domain.Abstractions;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
#pragma warning disable CS8618
|
||||
[Table("PlayLists")]
|
||||
public class PlayList
|
||||
public class PlayList : IAuditable
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
@@ -47,10 +48,10 @@ namespace Musify.Domain.Entities
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
|
||||
[Required]
|
||||
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[Required]
|
||||
public DateTime UpdatedDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(UserId)) ]
|
||||
public User User { get; set; }
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using Musify.Domain.Abstractions;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
#pragma warning disable CS8618
|
||||
public class Track
|
||||
public class Track : IAuditable
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
@@ -55,10 +56,10 @@ namespace Musify.Domain.Entities
|
||||
public DateTime? LastRetryAt { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime CreatedDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[Required]
|
||||
public DateTime UpdatedDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.Abstractions;
|
||||
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Table("User")]
|
||||
public class User
|
||||
public class User : IAuditable
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
|
||||
Reference in New Issue
Block a user