diff --git a/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommand.cs b/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommand.cs index 39bad4f..3916524 100644 --- a/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommand.cs +++ b/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommand.cs @@ -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; \ No newline at end of file diff --git a/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommandHandler.cs b/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommandHandler.cs index 284c3a7..67adbae 100644 --- a/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommandHandler.cs +++ b/dotnet/AipsCore/Application/Models/Whiteboard/Command/CreateWhiteboard/CreateWhiteboardCommandHandler.cs @@ -24,11 +24,8 @@ public class CreateWhiteboardCommandHandler : ICommandHandler } 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); diff --git a/dotnet/AipsCore/Domain/Models/Whiteboard/Whiteboard.cs b/dotnet/AipsCore/Domain/Models/Whiteboard/Whiteboard.cs index c4089d4..61cd9de 100644 --- a/dotnet/AipsCore/Domain/Models/Whiteboard/Whiteboard.cs +++ b/dotnet/AipsCore/Domain/Models/Whiteboard/Whiteboard.cs @@ -95,18 +95,15 @@ public partial class Whiteboard : DomainModel 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 whiteboardDeletedAt, whiteboardMaxParticipants, joinPolicy, - state); + WhiteboardState.Active); } } \ No newline at end of file diff --git a/dotnet/AipsWebApi/Controllers/WhiteboardController.cs b/dotnet/AipsWebApi/Controllers/WhiteboardController.cs index 0adbbcb..f1bc7fe 100644 --- a/dotnet/AipsWebApi/Controllers/WhiteboardController.cs +++ b/dotnet/AipsWebApi/Controllers/WhiteboardController.cs @@ -1,4 +1,5 @@ using AipsCore.Application.Abstract; +using AipsCore.Application.Models.Whiteboard.Command.AddUserToWhiteboard; using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard; using Microsoft.AspNetCore.Mvc; @@ -14,4 +15,12 @@ public class WhiteboardController : ControllerBase var whiteboardId = await dispatcher.Execute(command, cancellationToken); return Ok(whiteboardId.IdValue); } + + [HttpPost("adduser")] + public async Task AddUser(AddUserToWhiteboardCommand command, IDispatcher dispatcher, + CancellationToken cancellationToken) + { + await dispatcher.Execute(command, cancellationToken); + return Ok(); + } } \ No newline at end of file