mirror of
https://github.com/Govor-team/Govor.git
synced 2026-09-22 02:39:43 +00:00
Switch to SmartRes Result/Error, upgrade to .NET 10
Migrate codebase to use SmartRes Result<T, Error> (and Unit) across services and interfaces, replacing previous Result usage and updating many method signatures and implementations. Add ResultExtensions to convert SmartRes results to ASP.NET ActionResult and refactor AuthController to use functional Bind/Tap chains for registration/login flows. Upgrade projects to .NET 10 and bump related NuGet packages; add libs/SmartRes.dll and project references. Simplify DbContext registration to use Npgsql only with retry policies and enable detailed logging. Update Swagger/launch settings and other minor fixes (AutoMapper registration change, whitespace/exception handling, and removal of the Govor.ConsoleClient files).
This commit is contained in:
@@ -3,6 +3,7 @@ using Govor.Domain.Common;
|
||||
using Govor.Domain.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SmartRes;
|
||||
|
||||
namespace Govor.Application.Infrastructure.AdminsStuff;
|
||||
|
||||
@@ -25,13 +26,13 @@ public class InvitationGetter : IInvitationGetter
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Result<Invitation>> FindByIdAsync(Guid id)
|
||||
public async Task<Result<Invitation, Error>> FindByIdAsync(Guid id)
|
||||
{
|
||||
var res = await _context.Invitations.AsNoTracking()
|
||||
.FirstOrDefaultAsync(iv => iv.Id == id);
|
||||
|
||||
if (res is null)
|
||||
return Result<Invitation>.Failure(new Error(
|
||||
return Result.Failure<Invitation>(Error.NotFound(
|
||||
nameof(InvalidOperationException),
|
||||
"Invitation not found.")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user