fixes
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using AipsCore.Application.Abstract;
|
||||
using AipsCore.Application.Models.Whiteboard.Query.GetMembershipStatus;
|
||||
using AipsCore.Application.Models.Whiteboard.Query.GetWhiteboardInfoRT;
|
||||
using AipsCore.Domain.Models.Shape.Enums;
|
||||
using AipsCore.Domain.Models.WhiteboardMembership.Enums;
|
||||
using AipsRT.Model.Whiteboard.Shapes.Map;
|
||||
using AipsRT.Model.Users;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard;
|
||||
|
||||
@@ -30,6 +29,11 @@ public class GetWhiteboardService
|
||||
OwnerId = entity.OwnerId,
|
||||
};
|
||||
|
||||
foreach (var membership in entity.Memberships)
|
||||
{
|
||||
whiteboard.AddUser(new User(membership.UserId, membership.User!.UserName!, membership.User.Email!));
|
||||
}
|
||||
|
||||
foreach (var shape in entity.Shapes)
|
||||
{
|
||||
switch (shape.Type)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AipsRT.Model.Whiteboard.Shapes;
|
||||
using AipsRT.Model.Users;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard;
|
||||
|
||||
@@ -10,6 +11,8 @@ public class Whiteboard
|
||||
|
||||
public HashSet<Guid> AcceptedUsers { get; } = new();
|
||||
public HashSet<Guid> PendingUsers { get; } = new();
|
||||
|
||||
public List<User> Users { get; } = [];
|
||||
|
||||
public List<Shape> Shapes { get; } = [];
|
||||
|
||||
@@ -42,6 +45,8 @@ public class Whiteboard
|
||||
TextShapes.Add(shape);
|
||||
}
|
||||
|
||||
public void AddUser(User user) => Users.Add(user);
|
||||
|
||||
public void AddPendingUser(Guid userId) => PendingUsers.Add(userId);
|
||||
|
||||
public void AcceptUser(Guid userId)
|
||||
|
||||
@@ -79,10 +79,10 @@ public class WhiteboardManager
|
||||
|
||||
public bool IsAccepted(Guid userId)
|
||||
{
|
||||
if (!_userInWhiteboards.TryGetValue(userId, out var wbId))
|
||||
if (!_userInWhiteboards.TryGetValue(userId, out var whiteboardId))
|
||||
return false;
|
||||
|
||||
var whiteboard = GetWhiteboard(wbId);
|
||||
var whiteboard = GetWhiteboard(whiteboardId);
|
||||
return whiteboard?.IsAccepted(userId) ?? false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user