This commit is contained in:
john 2025-05-15 17:47:20 +02:00
parent 0dc41337da
commit 14fd359ea8
28 changed files with 156 additions and 52 deletions

View file

@ -22,8 +22,8 @@ public class AuthController(IAuthenticationModule authModule) : ControllerBase
return new LoginResponse(result.UserId, result.Username);
}
[HttpPost("signup")]
public async Task<ActionResult<SignupResponse>> Signup([FromBody] SignupRequest request)
[HttpPost("register")]
public async Task<ActionResult<RegisterResponse>> Register([FromBody] RegisterRequest request)
{
var result = await authModule.PostCommand(
new RegisterCommand(request.Username, request.Password)
@ -31,7 +31,7 @@ public class AuthController(IAuthenticationModule authModule) : ControllerBase
HttpContext.SetSession(result.Session);
return new SignupResponse(result.UserId, result.Username);
return new RegisterResponse(result.UserId, result.Username);
}
[HttpPost("delete-session")]

View file

@ -0,0 +1,3 @@
namespace Femto.Api.Controllers.Auth;
public record RegisterRequest(string Username, string Password, string SignupCode, string? Email);

View file

@ -0,0 +1,3 @@
namespace Femto.Api.Controllers.Auth;
public record RegisterResponse(Guid UserId, string Username);

View file

@ -1,3 +0,0 @@
namespace Femto.Api.Controllers.Auth;
public record SignupRequest(string Username, string Password, string SignupCode, string? Email);

View file

@ -1,3 +0,0 @@
namespace Femto.Api.Controllers.Auth;
public record SignupResponse(Guid UserId, string Username);

View file

@ -4,6 +4,7 @@ using Femto.Modules.Blog.Application;
using Femto.Modules.Blog.Application.Commands.CreatePost;
using Femto.Modules.Blog.Application.Queries.GetPosts;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Femto.Api.Controllers.Posts;
@ -13,6 +14,7 @@ namespace Femto.Api.Controllers.Posts;
public class PostsController(IBlogModule blogModule) : ControllerBase
{
[HttpGet]
[Authorize]
public async Task<ActionResult<GetAllPublicPostsResponse>> GetAllPublicPosts(
[FromQuery] GetPublicPostsSearchParams searchParams,
CancellationToken cancellationToken