Removed possibly invalid endpoints, will be refactored to use auth and user context when needed again
This commit is contained in:
@@ -16,25 +16,4 @@ public class ShapeController : ControllerBase
|
|||||||
{
|
{
|
||||||
_dispatcher = dispatcher;
|
_dispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("arrow")]
|
|
||||||
public async Task<IActionResult> CreateArrow(CreateArrowCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("textShape")]
|
|
||||||
public async Task<IActionResult> CreateTextShape(CreateTextShapeCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost("line")]
|
|
||||||
public async Task<IActionResult> CreateLine(CreateLineCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using AipsCore.Application.Abstract;
|
using AipsCore.Application.Abstract;
|
||||||
using AipsCore.Application.Models.User.Command.CreateUser;
|
using AipsCore.Application.Authentication;
|
||||||
|
using AipsCore.Application.Models.User.Command.LogIn;
|
||||||
|
using AipsCore.Application.Models.User.Command.SignUp;
|
||||||
using AipsCore.Application.Models.User.Query.GetUser;
|
using AipsCore.Application.Models.User.Query.GetUser;
|
||||||
using AipsCore.Domain.Common.Validation;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using AipsCore.Domain.Models.User.ValueObjects;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace AipsWebApi.Controllers;
|
namespace AipsWebApi.Controllers;
|
||||||
@@ -18,18 +19,19 @@ public class UserController : ControllerBase
|
|||||||
_dispatcher = dispatcher;
|
_dispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{userId}")]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> GetUser([FromRoute] string userId, CancellationToken cancellationToken)
|
[HttpPost("signup")]
|
||||||
|
public async Task<IActionResult> SignUp(SignUpUserCommand command, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var query = new GetUserQuery(userId);
|
var result = await _dispatcher.Execute(command, cancellationToken);
|
||||||
var result = await _dispatcher.Execute(query, cancellationToken);
|
return Ok(result.IdValue);
|
||||||
return Ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[AllowAnonymous]
|
||||||
public async Task<ActionResult<int>> CreateUser(CreateUserCommand command, CancellationToken cancellationToken)
|
[HttpPost("login")]
|
||||||
|
public async Task<ActionResult<string>> LogIn(LogInUserCommand command, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var userId = await _dispatcher.Execute(command, cancellationToken);
|
var result = await _dispatcher.Execute(command, cancellationToken);
|
||||||
return Ok(userId.IdValue);
|
return Ok(result.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ using AipsCore.Application.Models.Whiteboard.Command.KickUserFromWhiteboard;
|
|||||||
using AipsCore.Application.Models.Whiteboard.Command.UnbanUserFromWhiteboard;
|
using AipsCore.Application.Models.Whiteboard.Command.UnbanUserFromWhiteboard;
|
||||||
using AipsCore.Application.Models.Whiteboard.Query.GetRecentWhiteboards;
|
using AipsCore.Application.Models.Whiteboard.Query.GetRecentWhiteboards;
|
||||||
using AipsCore.Domain.Models.Whiteboard;
|
using AipsCore.Domain.Models.Whiteboard;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace AipsWebApi.Controllers;
|
namespace AipsWebApi.Controllers;
|
||||||
@@ -21,47 +22,11 @@ public class WhiteboardController : ControllerBase
|
|||||||
_dispatcher = dispatcher;
|
_dispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult<int>> CreateWhiteboard(CreateWhiteboardCommand command, CancellationToken cancellationToken)
|
public async Task<ActionResult<int>> CreateWhiteboard(CreateWhiteboardCommand command, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var whiteboardId = await _dispatcher.Execute(command, cancellationToken);
|
var whiteboardId = await _dispatcher.Execute(command, cancellationToken);
|
||||||
return Ok(whiteboardId.IdValue);
|
return Ok(whiteboardId.IdValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("adduser")]
|
|
||||||
public async Task<IActionResult> AddUser(AddUserToWhiteboardCommand command,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("recent")]
|
|
||||||
public async Task<ActionResult<ICollection<Whiteboard>>> Recent(GetRecentWhiteboardsQuery query, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = await _dispatcher.Execute(query, cancellationToken);
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("banUser")]
|
|
||||||
public async Task<ActionResult> BanUserFromWhiteboard(BanUserFromWhiteboardCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("unbanUser")]
|
|
||||||
public async Task<ActionResult> UnbanUserFromWhiteboard(UnbanUserFromWhiteboardCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPut("kickUser")]
|
|
||||||
public async Task<ActionResult> KickUserFromWhiteboard(KickUserFromWhiteboardCommand command, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await _dispatcher.Execute(command, cancellationToken);
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user