Refactor: migrate Core -> Domain and reorganize projects

Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
This commit is contained in:
Artemy
2026-07-16 19:27:45 +07:00
parent 1d35356c8c
commit 6d1c53beeb
371 changed files with 2729 additions and 6694 deletions
+49
View File
@@ -0,0 +1,49 @@
namespace Govor.Domain.Common;
public class Result
{
protected Result(bool isSuccess, Error error)
{
if (isSuccess && error != Error.None || !isSuccess && error == Error.None)
{
throw new ArgumentException("Invalid error state", nameof(error));
}
IsSuccess = isSuccess;
Error = error;
}
public bool IsSuccess { get; }
public bool IsFailure => !IsSuccess;
public Error Error { get; }
public static Result Success() => new(true, Error.None);
public static Result Failure(Error error) => new(false, error);
public static Result Failure(Exception ex) => new(false, new Error(ex.GetType().Name, ex.Message));
public static implicit operator Result(Error error) => Failure(error);
}
public class Result<T> : Result
{
private readonly T? _value;
private Result(T? value, bool isSuccess, Error error) : base(isSuccess, error)
{
_value = value;
}
public T Value => IsSuccess
? _value!
: throw new InvalidOperationException("The value of a failure result cannot be accessed.");
public static Result<T> Success(T value) => new(value, true, Error.None);
public static new Result<T> Failure(Error error) => new(default, false, error);
public static new Result<T> Failure(Exception ex) => new(default, false, new Error(ex.GetType().Name, ex.Message));
public static implicit operator Result<T>(T value) => Success(value);
public static implicit operator Result<T>(Error error) => Failure(error);
public static implicit operator T(Result<T> result) => result.Value;
}