:drunk: No idea what did AI did

This commit is contained in:
2025-07-06 19:46:59 +08:00
parent 14b79f16f4
commit 3391c08c04
40 changed files with 2484 additions and 112 deletions

View File

@ -0,0 +1,40 @@
using System;
using System.ComponentModel.DataAnnotations;
using NodaTime;
namespace DysonNetwork.Pass.Models;
public abstract class ModelBase
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public Instant CreatedAt { get; set; } = SystemClock.Instance.GetCurrentInstant();
public Instant? UpdatedAt { get; set; }
public Instant? DeletedAt { get; set; }
public bool IsDeleted => DeletedAt != null;
public void MarkAsUpdated()
{
UpdatedAt = SystemClock.Instance.GetCurrentInstant();
}
public void MarkAsDeleted()
{
if (DeletedAt == null)
{
DeletedAt = SystemClock.Instance.GetCurrentInstant();
MarkAsUpdated();
}
}
public void Restore()
{
if (DeletedAt != null)
{
DeletedAt = null;
MarkAsUpdated();
}
}
}