Merge branch 'main' into feature-shape-infrastructure

# Conflicts:
#	dotnet/AipsCore/Infrastructure/Persistence/Db/AipsDbContext.cs
This commit is contained in:
2026-02-09 21:23:19 +01:00
16 changed files with 388 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
using AipsCore.Application.Abstract.Command;
using AipsCore.Domain.Models.WhiteboardMembership.ValueObjects;
namespace AipsCore.Application.Models.WhiteboardMembership.Command.CreateWhiteboardMembership;
public record CreateWhiteboardMembershipCommand(
string WhiteboardId,
string UserId,
bool IsBanned,
bool EditingEnabled,
bool CanJoin,
DateTime LastInteractedAt)
: ICommand<WhiteboardMembershipId>;

View File

@@ -0,0 +1,34 @@
using AipsCore.Application.Abstract.Command;
using AipsCore.Domain.Abstract;
using AipsCore.Domain.Models.WhiteboardMembership.External;
using AipsCore.Domain.Models.WhiteboardMembership.ValueObjects;
namespace AipsCore.Application.Models.WhiteboardMembership.Command.CreateWhiteboardMembership;
public class CreateWhiteboardMembershipCommandHandler : ICommandHandler<CreateWhiteboardMembershipCommand, WhiteboardMembershipId>
{
private readonly IWhiteboardMembershipRepository _whiteboardMembershipRepository;
private readonly IUnitOfWork _unitOfWork;
public CreateWhiteboardMembershipCommandHandler(IWhiteboardMembershipRepository whiteboardMembershipRepository, IUnitOfWork unitOfWork)
{
_whiteboardMembershipRepository = whiteboardMembershipRepository;
_unitOfWork = unitOfWork;
}
public async Task<WhiteboardMembershipId> Handle(CreateWhiteboardMembershipCommand command, CancellationToken cancellationToken = default)
{
var whiteboardMembership = Domain.Models.WhiteboardMembership.WhiteboardMembership.Create(
command.WhiteboardId,
command.UserId,
command.IsBanned,
command.EditingEnabled,
command.CanJoin,
command.LastInteractedAt);
await _whiteboardMembershipRepository.Save(whiteboardMembership, cancellationToken);
await _unitOfWork.SaveChangesAsync(cancellationToken);
return whiteboardMembership.Id;
}
}