wip
This commit is contained in:
parent
0dc41337da
commit
14fd359ea8
28 changed files with 156 additions and 52 deletions
|
@ -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")]
|
||||
|
|
3
Femto.Api/Controllers/Auth/RegisterRequest.cs
Normal file
3
Femto.Api/Controllers/Auth/RegisterRequest.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace Femto.Api.Controllers.Auth;
|
||||
|
||||
public record RegisterRequest(string Username, string Password, string SignupCode, string? Email);
|
3
Femto.Api/Controllers/Auth/RegisterResponse.cs
Normal file
3
Femto.Api/Controllers/Auth/RegisterResponse.cs
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace Femto.Api.Controllers.Auth;
|
||||
|
||||
public record RegisterResponse(Guid UserId, string Username);
|
|
@ -1,3 +0,0 @@
|
|||
namespace Femto.Api.Controllers.Auth;
|
||||
|
||||
public record SignupRequest(string Username, string Password, string SignupCode, string? Email);
|
|
@ -1,3 +0,0 @@
|
|||
namespace Femto.Api.Controllers.Auth;
|
||||
|
||||
public record SignupResponse(Guid UserId, string Username);
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue