diff --git a/Femto.Api/Controllers/Posts/PostsController.cs b/Femto.Api/Controllers/Posts/PostsController.cs index ce2d75f..2b1e830 100644 --- a/Femto.Api/Controllers/Posts/PostsController.cs +++ b/Femto.Api/Controllers/Posts/PostsController.cs @@ -76,6 +76,6 @@ public class PostsController(IBlogModule blogModule, ICurrentUserContext current [Authorize] public async Task DeletePost(Guid postId, CancellationToken cancellationToken) { - await blogModule.Command(new DeletePostCommand(postId, currentUserContext.CurrentUser.Id), cancellationToken); + await blogModule.Command(new DeletePostCommand(postId, currentUserContext.CurrentUser!.Id), cancellationToken); } } diff --git a/Femto.Api/CurrentUserContext.cs b/Femto.Api/CurrentUserContext.cs index 01d0d5c..1164eb0 100644 --- a/Femto.Api/CurrentUserContext.cs +++ b/Femto.Api/CurrentUserContext.cs @@ -6,7 +6,7 @@ internal class CurrentUserContext : ICurrentUserContext { private CurrentUser? _currentUser; - public CurrentUser? tryGetUserCurrentUser() => this._currentUser; + public CurrentUser? TryGetUserCurrentUser() => this._currentUser; public bool HasUser => this._currentUser is not null; diff --git a/Femto.Common/ICurrentUserContext.cs b/Femto.Common/ICurrentUserContext.cs index 0cb0207..f09e417 100644 --- a/Femto.Common/ICurrentUserContext.cs +++ b/Femto.Common/ICurrentUserContext.cs @@ -2,10 +2,8 @@ namespace Femto.Common; public interface ICurrentUserContext { - CurrentUser? tryGetUserCurrentUser(); - bool HasUser { get; } - CurrentUser CurrentUser { get; } + CurrentUser? CurrentUser { get; } } public record CurrentUser(Guid Id, string Username, string SessionId);