diff --git a/dotnet/AipsCore/AipsCore.csproj b/dotnet/AipsCore/AipsCore.csproj index 021cc81..55eef2c 100644 --- a/dotnet/AipsCore/AipsCore.csproj +++ b/dotnet/AipsCore/AipsCore.csproj @@ -21,7 +21,6 @@ - diff --git a/dotnet/AipsCore/Infrastructure/Persistence/Whiteboard/WhiteboardRepository.cs b/dotnet/AipsCore/Infrastructure/Persistence/Whiteboard/WhiteboardRepository.cs index 29518f9..f647ef2 100644 --- a/dotnet/AipsCore/Infrastructure/Persistence/Whiteboard/WhiteboardRepository.cs +++ b/dotnet/AipsCore/Infrastructure/Persistence/Whiteboard/WhiteboardRepository.cs @@ -58,11 +58,18 @@ public class WhiteboardRepository entity.State = model.State; } - public async Task WhiteboardCodeExists(WhiteboardCode whiteboardCode) + public async Task WhiteboardCodeExistsAsync(WhiteboardCode whiteboardCode) { return await Context.Whiteboards.AnyAsync(w => w.Code == whiteboardCode.CodeValue); } + public async Task GetByCodeAsync(WhiteboardCode whiteboardCode, CancellationToken cancellationToken = default) + { + var entity = await Context.Whiteboards.FirstOrDefaultAsync(w => w.Code == whiteboardCode.CodeValue, cancellationToken); + + return entity != null ? MapToModel(entity) : null; + } + public async Task SoftDeleteAsync(WhiteboardId id, CancellationToken cancellationToken = default) { var entity = await Context.Whiteboards.FindAsync([new Guid(id.IdValue)], cancellationToken); diff --git a/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembership.cs b/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembership.cs index c2cd8d8..469654d 100644 --- a/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembership.cs +++ b/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembership.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using AipsCore.Domain.Models.WhiteboardMembership.Enums; namespace AipsCore.Infrastructure.Persistence.WhiteboardMembership; @@ -15,11 +16,9 @@ public class WhiteboardMembership public User.User? User { get; set; } = null!; - public bool IsBanned { get; set; } - public bool EditingEnabled { get; set; } - public bool CanJoin { get; set; } + public WhiteboardMembershipStatus Status { get; set; } public DateTime LastInteractedAt { get; set; } } \ No newline at end of file diff --git a/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembershipRepository.cs b/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembershipRepository.cs index 52bd6ba..b556326 100644 --- a/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembershipRepository.cs +++ b/dotnet/AipsCore/Infrastructure/Persistence/WhiteboardMembership/WhiteboardMembershipRepository.cs @@ -24,9 +24,8 @@ public class WhiteboardMembershipRepository entity.Id.ToString(), entity.WhiteboardId.ToString(), entity.UserId.ToString(), - entity.IsBanned, entity.EditingEnabled, - entity.CanJoin, + entity.Status, entity.LastInteractedAt ); } @@ -38,18 +37,16 @@ public class WhiteboardMembershipRepository Id = new Guid(model.Id.IdValue), WhiteboardId = new Guid(model.WhiteboardId.IdValue), UserId = new Guid(model.UserId.IdValue), - IsBanned = model.IsBanned.IsBannedValue, EditingEnabled = model.EditingEnabled.EditingEnabledValue, - CanJoin = model.CanJoin.CanJoinValue, + Status = model.Status, LastInteractedAt = model.LastInteractedAt.LastInteractedAtValue }; } protected override void UpdateEntity(WhiteboardMembership entity, Domain.Models.WhiteboardMembership.WhiteboardMembership model) { - entity.IsBanned = model.IsBanned.IsBannedValue; entity.EditingEnabled = model.EditingEnabled.EditingEnabledValue; - entity.CanJoin = model.CanJoin.CanJoinValue; + entity.Status = model.Status; entity.LastInteractedAt = model.LastInteractedAt.LastInteractedAtValue; }