Merge branch 'main' into feature-commands-kick-ban-unban-user
# Conflicts: # dotnet/AipsWebApi/Controllers/WhiteboardController.cs
This commit is contained in:
@@ -8,9 +8,6 @@ namespace AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard;
|
||||
public record CreateWhiteboardCommand(
|
||||
string OwnerId,
|
||||
string Title,
|
||||
DateTime CreatedAt,
|
||||
DateTime DeletedAt,
|
||||
int MaxParticipants,
|
||||
WhiteboardJoinPolicy JoinPolicy,
|
||||
WhiteboardState State)
|
||||
WhiteboardJoinPolicy JoinPolicy)
|
||||
: ICommand<WhiteboardId>;
|
||||
@@ -24,11 +24,8 @@ public class CreateWhiteboardCommandHandler : ICommandHandler<CreateWhiteboardCo
|
||||
command.OwnerId,
|
||||
whiteboardCode.CodeValue,
|
||||
command.Title,
|
||||
command.CreatedAt,
|
||||
command.DeletedAt,
|
||||
command.MaxParticipants,
|
||||
command.JoinPolicy,
|
||||
command.State);
|
||||
command.JoinPolicy);
|
||||
|
||||
await _whiteboardRepository.SaveAsync(whiteboard, cancellationToken);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
@@ -24,12 +24,12 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
|
||||
}
|
||||
|
||||
membership = WhiteboardMembership.WhiteboardMembership.Create(
|
||||
this.Id.ToString(),
|
||||
user.Id.ToString(),
|
||||
this.Id.IdValue,
|
||||
user.Id.IdValue,
|
||||
false,
|
||||
false,
|
||||
this.GetCanJoin(),
|
||||
DateTime.Now
|
||||
DateTime.UtcNow
|
||||
);
|
||||
|
||||
await membershipRepository.AddAsync(membership, cancellationToken);
|
||||
|
||||
@@ -95,18 +95,15 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
|
||||
string ownerId,
|
||||
string code,
|
||||
string title,
|
||||
DateTime createdAt,
|
||||
DateTime? deletedAt,
|
||||
int maxParticipants,
|
||||
WhiteboardJoinPolicy joinPolicy,
|
||||
WhiteboardState state)
|
||||
WhiteboardJoinPolicy joinPolicy)
|
||||
{
|
||||
var whiteboardId = WhiteboardId.Any();
|
||||
var whiteboardOwnerId = new UserId(ownerId);
|
||||
var whiteboardCode = new WhiteboardCode(code);
|
||||
var whiteboardTitle = new WhiteboardTitle(title);
|
||||
var whiteboardCreatedAt = new WhiteboardCreatedAt(createdAt);
|
||||
var whiteboardDeletedAt = new WhiteboardDeletedAt(deletedAt);
|
||||
var whiteboardCreatedAt = new WhiteboardCreatedAt(DateTime.UtcNow);
|
||||
var whiteboardDeletedAt = new WhiteboardDeletedAt(null);
|
||||
var whiteboardMaxParticipants = new WhiteboardMaxParticipants(maxParticipants);
|
||||
|
||||
return new Whiteboard(
|
||||
@@ -118,6 +115,6 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
|
||||
whiteboardDeletedAt,
|
||||
whiteboardMaxParticipants,
|
||||
joinPolicy,
|
||||
state);
|
||||
WhiteboardState.Active);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using AipsCore.Application.Abstract;
|
||||
using AipsCore.Application.Models.Whiteboard.Command.AddUserToWhiteboard;
|
||||
using AipsCore.Application.Models.Whiteboard.Command.BanUserFromWhiteboard;
|
||||
using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard;
|
||||
using AipsCore.Application.Models.Whiteboard.Command.KickUserFromWhiteboard;
|
||||
@@ -18,6 +19,14 @@ public class WhiteboardController : ControllerBase
|
||||
return Ok(whiteboardId.IdValue);
|
||||
}
|
||||
|
||||
[HttpPost("adduser")]
|
||||
public async Task<IActionResult> AddUser(AddUserToWhiteboardCommand command, IDispatcher dispatcher,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
await dispatcher.Execute(command, cancellationToken);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPut("banUser")]
|
||||
public async Task<ActionResult> BanUserFromWhiteboard(BanUserFromWhiteboardCommand command, IDispatcher dispatcher, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user