Merge branch 'main' into feature-commands-kick-ban-unban-user

# Conflicts:
#	dotnet/AipsWebApi/Controllers/WhiteboardController.cs
This commit is contained in:
Veljko Tosic
2026-02-11 22:20:17 +01:00
5 changed files with 18 additions and 18 deletions

View File

@@ -8,9 +8,6 @@ namespace AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard;
public record CreateWhiteboardCommand( public record CreateWhiteboardCommand(
string OwnerId, string OwnerId,
string Title, string Title,
DateTime CreatedAt,
DateTime DeletedAt,
int MaxParticipants, int MaxParticipants,
WhiteboardJoinPolicy JoinPolicy, WhiteboardJoinPolicy JoinPolicy)
WhiteboardState State)
: ICommand<WhiteboardId>; : ICommand<WhiteboardId>;

View File

@@ -24,11 +24,8 @@ public class CreateWhiteboardCommandHandler : ICommandHandler<CreateWhiteboardCo
command.OwnerId, command.OwnerId,
whiteboardCode.CodeValue, whiteboardCode.CodeValue,
command.Title, command.Title,
command.CreatedAt,
command.DeletedAt,
command.MaxParticipants, command.MaxParticipants,
command.JoinPolicy, command.JoinPolicy);
command.State);
await _whiteboardRepository.SaveAsync(whiteboard, cancellationToken); await _whiteboardRepository.SaveAsync(whiteboard, cancellationToken);
await _unitOfWork.SaveChangesAsync(cancellationToken); await _unitOfWork.SaveChangesAsync(cancellationToken);

View File

@@ -24,12 +24,12 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
} }
membership = WhiteboardMembership.WhiteboardMembership.Create( membership = WhiteboardMembership.WhiteboardMembership.Create(
this.Id.ToString(), this.Id.IdValue,
user.Id.ToString(), user.Id.IdValue,
false, false,
false, false,
this.GetCanJoin(), this.GetCanJoin(),
DateTime.Now DateTime.UtcNow
); );
await membershipRepository.AddAsync(membership, cancellationToken); await membershipRepository.AddAsync(membership, cancellationToken);

View File

@@ -95,18 +95,15 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
string ownerId, string ownerId,
string code, string code,
string title, string title,
DateTime createdAt,
DateTime? deletedAt,
int maxParticipants, int maxParticipants,
WhiteboardJoinPolicy joinPolicy, WhiteboardJoinPolicy joinPolicy)
WhiteboardState state)
{ {
var whiteboardId = WhiteboardId.Any(); var whiteboardId = WhiteboardId.Any();
var whiteboardOwnerId = new UserId(ownerId); var whiteboardOwnerId = new UserId(ownerId);
var whiteboardCode = new WhiteboardCode(code); var whiteboardCode = new WhiteboardCode(code);
var whiteboardTitle = new WhiteboardTitle(title); var whiteboardTitle = new WhiteboardTitle(title);
var whiteboardCreatedAt = new WhiteboardCreatedAt(createdAt); var whiteboardCreatedAt = new WhiteboardCreatedAt(DateTime.UtcNow);
var whiteboardDeletedAt = new WhiteboardDeletedAt(deletedAt); var whiteboardDeletedAt = new WhiteboardDeletedAt(null);
var whiteboardMaxParticipants = new WhiteboardMaxParticipants(maxParticipants); var whiteboardMaxParticipants = new WhiteboardMaxParticipants(maxParticipants);
return new Whiteboard( return new Whiteboard(
@@ -118,6 +115,6 @@ public partial class Whiteboard : DomainModel<WhiteboardId>
whiteboardDeletedAt, whiteboardDeletedAt,
whiteboardMaxParticipants, whiteboardMaxParticipants,
joinPolicy, joinPolicy,
state); WhiteboardState.Active);
} }
} }

View File

@@ -1,4 +1,5 @@
using AipsCore.Application.Abstract; using AipsCore.Application.Abstract;
using AipsCore.Application.Models.Whiteboard.Command.AddUserToWhiteboard;
using AipsCore.Application.Models.Whiteboard.Command.BanUserFromWhiteboard; using AipsCore.Application.Models.Whiteboard.Command.BanUserFromWhiteboard;
using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard; using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard;
using AipsCore.Application.Models.Whiteboard.Command.KickUserFromWhiteboard; using AipsCore.Application.Models.Whiteboard.Command.KickUserFromWhiteboard;
@@ -18,6 +19,14 @@ public class WhiteboardController : ControllerBase
return Ok(whiteboardId.IdValue); 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")] [HttpPut("banUser")]
public async Task<ActionResult> BanUserFromWhiteboard(BanUserFromWhiteboardCommand command, IDispatcher dispatcher, CancellationToken cancellationToken) public async Task<ActionResult> BanUserFromWhiteboard(BanUserFromWhiteboardCommand command, IDispatcher dispatcher, CancellationToken cancellationToken)
{ {