implement fix
This commit is contained in:
@@ -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>;
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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.CreateWhiteboard;
|
using AipsCore.Application.Models.Whiteboard.Command.CreateWhiteboard;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
@@ -14,4 +15,12 @@ public class WhiteboardController : ControllerBase
|
|||||||
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, IDispatcher dispatcher,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await dispatcher.Execute(command, cancellationToken);
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user