stuff
This commit is contained in:
parent
14fd359ea8
commit
a4ef2b4a20
26 changed files with 331 additions and 78 deletions
|
@ -8,7 +8,7 @@ namespace Femto.Api.Controllers.Auth;
|
|||
|
||||
[ApiController]
|
||||
[Route("auth")]
|
||||
public class AuthController(IAuthenticationModule authModule) : ControllerBase
|
||||
public class AuthController(IAuthModule authModule) : ControllerBase
|
||||
{
|
||||
[HttpPost("login")]
|
||||
public async Task<ActionResult<LoginResponse>> Login([FromBody] LoginRequest request)
|
||||
|
@ -34,10 +34,10 @@ public class AuthController(IAuthenticationModule authModule) : ControllerBase
|
|||
return new RegisterResponse(result.UserId, result.Username);
|
||||
}
|
||||
|
||||
[HttpPost("delete-session")]
|
||||
public async Task<ActionResult> DeleteSession([FromBody] DeleteSessionRequest request)
|
||||
[HttpDelete("session")]
|
||||
public async Task<ActionResult> DeleteSession()
|
||||
{
|
||||
// TODO
|
||||
HttpContext.Response.Cookies.Delete("session");
|
||||
return Ok(new { });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using Femto.Modules.Media.Contracts;
|
|||
using Femto.Modules.Media.Contracts.LoadFile;
|
||||
using Femto.Modules.Media.Contracts.SaveFile;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Femto.Api.Controllers.Media;
|
||||
|
@ -13,6 +14,7 @@ namespace Femto.Api.Controllers.Media;
|
|||
public class MediaController(IMediaModule mediaModule) : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<ActionResult<UploadMediaResponse>> UploadMedia(
|
||||
IFormFile file,
|
||||
CancellationToken cancellationToken
|
||||
|
@ -29,6 +31,7 @@ public class MediaController(IMediaModule mediaModule) : ControllerBase
|
|||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
[Authorize]
|
||||
public async Task GetMedia(Guid id, CancellationToken cancellationToken)
|
||||
{
|
||||
var res = await mediaModule.PostQuery(new LoadFileQuery(id), cancellationToken);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using Femto.Api.Controllers.Posts.Dto;
|
||||
using Femto.Modules.Blog;
|
||||
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;
|
||||
|
||||
|
@ -44,6 +42,7 @@ public class PostsController(IBlogModule blogModule) : ControllerBase
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<ActionResult<CreatePostResponse>> Post(
|
||||
[FromBody] CreatePostRequest req,
|
||||
CancellationToken cancellationToken
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue