From ccfb377e79afa79a1af54bd0635d406bb6593527 Mon Sep 17 00:00:00 2001 From: Veljko Tosic Date: Sat, 14 Feb 2026 18:49:44 +0100 Subject: [PATCH] Updated controller with new endpoints --- .../AipsWebApi/Controllers/UserController.cs | 34 ++++++++++++++++--- dotnet/AipsWebApi/Program.cs | 1 + 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/dotnet/AipsWebApi/Controllers/UserController.cs b/dotnet/AipsWebApi/Controllers/UserController.cs index 746887f..e4105f7 100644 --- a/dotnet/AipsWebApi/Controllers/UserController.cs +++ b/dotnet/AipsWebApi/Controllers/UserController.cs @@ -1,8 +1,10 @@ using AipsCore.Application.Abstract; -using AipsCore.Application.Common.Authentication; +using AipsCore.Application.Common.Authentication.Dtos; using AipsCore.Application.Models.User.Command.LogIn; +using AipsCore.Application.Models.User.Command.LogOut; +using AipsCore.Application.Models.User.Command.LogOutAll; +using AipsCore.Application.Models.User.Command.RefreshLogIn; using AipsCore.Application.Models.User.Command.SignUp; -using AipsCore.Application.Models.User.Query.GetUser; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -29,9 +31,33 @@ public class UserController : ControllerBase [AllowAnonymous] [HttpPost("login")] - public async Task> LogIn(LogInUserCommand command, CancellationToken cancellationToken) + public async Task> LogIn(LogInUserCommand command, CancellationToken cancellationToken) { var result = await _dispatcher.Execute(command, cancellationToken); - return Ok(result.Value); + return Ok(result); + } + + [AllowAnonymous] + [HttpPost("refresh-login")] + public async Task> RefreshLogIn(RefreshLogInCommand command, CancellationToken cancellationToken) + { + var result = await _dispatcher.Execute(command, cancellationToken); + return Ok(result); + } + + [Authorize] + [HttpDelete("logout")] + public async Task LogOut(LogOutCommand command, CancellationToken cancellationToken) + { + await _dispatcher.Execute(command, cancellationToken); + return Ok(); + } + + [Authorize] + [HttpDelete("logout-all")] + public async Task LogOutAll(LogOutAllCommand command, CancellationToken cancellationToken) + { + await _dispatcher.Execute(command, cancellationToken); + return Ok(); } } \ No newline at end of file diff --git a/dotnet/AipsWebApi/Program.cs b/dotnet/AipsWebApi/Program.cs index f6187c1..25377d7 100644 --- a/dotnet/AipsWebApi/Program.cs +++ b/dotnet/AipsWebApi/Program.cs @@ -1,4 +1,5 @@ using AipsCore.Infrastructure.DI; +using AipsCore.Infrastructure.Persistence.Db; using AipsWebApi.Middleware; using DotNetEnv;