This commit is contained in:
john 2025-05-15 17:47:20 +02:00
parent 0dc41337da
commit 14fd359ea8
28 changed files with 156 additions and 52 deletions

View file

@ -0,0 +1,7 @@
namespace Femto.Common.Domain;
public class DomainError : Exception
{
public DomainError(string message, Exception innerException) : base(message, innerException) {}
public DomainError(string message) : base(message) {}
}

View file

@ -1,7 +0,0 @@
namespace Femto.Common.Domain;
public class DomainException : Exception
{
public DomainException(string message, Exception innerException) : base(message, innerException) {}
public DomainException(string message) : base(message) {}
}

View file

@ -16,6 +16,6 @@ public abstract class Entity
protected void CheckRule(IRule rule)
{
if (!rule.Check())
throw new RuleBrokenException(rule.Message);
throw new RuleBrokenError(rule.Message);
}
}

View file

@ -0,0 +1,3 @@
namespace Femto.Common.Domain;
public class RuleBrokenError(string message) : DomainError(message);

View file

@ -1,3 +0,0 @@
namespace Femto.Common.Domain;
public class RuleBrokenException(string message) : DomainException(message);

View file

@ -0,0 +1,8 @@
namespace Femto.Common;
public interface ICurrentUserContext
{
CurrentUser? CurrentUser { get; }
}
public record CurrentUser(Guid Id, string Username);