many fixes and improvements - rework for modules/ and common/
feat(emailer): add Postmark and Resend providers
This commit is contained in:
49
backend/Modules/Identity/Models/Result.cs
Normal file
49
backend/Modules/Identity/Models/Result.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace Hutopy.Modules.Identity.Models;
|
||||
|
||||
public class Result(
|
||||
bool succeeded,
|
||||
IEnumerable<string> errors)
|
||||
{
|
||||
public bool Succeeded { get; init; } = succeeded;
|
||||
public string[] Errors { get; init; } = errors.ToArray();
|
||||
|
||||
public static Result Success()
|
||||
{
|
||||
return new Result(true, Array.Empty<string>());
|
||||
}
|
||||
|
||||
public static Result Failure(IEnumerable<string> errors)
|
||||
{
|
||||
return new Result(false, errors);
|
||||
}
|
||||
}
|
||||
|
||||
public class Result<T>(
|
||||
T? value,
|
||||
bool succeeded,
|
||||
IEnumerable<string> errors)
|
||||
{
|
||||
public bool Succeeded { get; init; } = succeeded;
|
||||
public string[] Errors { get; init; } = errors.ToArray();
|
||||
public T? Value { get; set; } = value;
|
||||
|
||||
public T GetValueOrDefault()
|
||||
{
|
||||
return Value ?? default(T)!;
|
||||
}
|
||||
|
||||
public string GetErrorsAsString()
|
||||
{
|
||||
return Errors.Length == 0 ? string.Empty : string.Join(", ", Errors);
|
||||
}
|
||||
|
||||
public static Result<T> Success(T value)
|
||||
{
|
||||
return new Result<T>(value, true, Array.Empty<string>());
|
||||
}
|
||||
|
||||
public static Result<T> Failure(T value, IEnumerable<string> errors)
|
||||
{
|
||||
return new Result<T>(value, false, errors);
|
||||
}
|
||||
}
|
||||
7
backend/Modules/Identity/Models/RoleModel.cs
Normal file
7
backend/Modules/Identity/Models/RoleModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Hutopy.Modules.Identity.Models;
|
||||
|
||||
public class RoleModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
16
backend/Modules/Identity/Models/UserDto.cs
Normal file
16
backend/Modules/Identity/Models/UserDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Hutopy.Modules.Identity.Models;
|
||||
|
||||
public class UserDto
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public IList<string> UserRoles { get; init; } = [];
|
||||
public string Username { get; init; } = null!;
|
||||
public string? Alias { get; init; }
|
||||
public string? PortraitUrl { get; init; }
|
||||
public string? Firstname { get; init; }
|
||||
public string? Lastname { get; init; }
|
||||
public string? Email { get; init; }
|
||||
public string? PhoneNumber { get; init; }
|
||||
public DateTime? BirthDate { get; init; }
|
||||
public string? Address { get; init; }
|
||||
}
|
||||
15
backend/Modules/Identity/Models/UserModel.cs
Normal file
15
backend/Modules/Identity/Models/UserModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Hutopy.Modules.Identity.Models;
|
||||
|
||||
public class UserModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Username { get; init; } = null!;
|
||||
public string? Alias { get; init; }
|
||||
public string? PortraitUrl { get; init; }
|
||||
public string? Firstname { get; init; }
|
||||
public string? Lastname { get; init; }
|
||||
public string? Email { get; init; }
|
||||
public string? PhoneNumber { get; init; }
|
||||
public DateTime? BirthDate { get; init; }
|
||||
public string? Address { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user