Refactored to follow naming convention
This commit is contained in:
@@ -2,18 +2,18 @@ using AipsCore.Domain.Common.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Abstract;
|
namespace AipsCore.Domain.Abstract;
|
||||||
|
|
||||||
public abstract class DomainEntity<TId> where TId : DomainId
|
public abstract class DomainModel<TId> where TId : DomainId
|
||||||
{
|
{
|
||||||
private readonly List<IDomainEvent> _domainEvents = [];
|
private readonly List<IDomainEvent> _domainEvents = [];
|
||||||
|
|
||||||
public TId Id { get; init; }
|
public TId Id { get; init; }
|
||||||
|
|
||||||
protected DomainEntity()
|
protected DomainModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DomainEntity(TId id)
|
protected DomainModel(TId id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,11 @@ using AipsCore.Domain.Common.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Abstract;
|
namespace AipsCore.Domain.Abstract;
|
||||||
|
|
||||||
public interface IAbstractRepository<TEntity, in TId>
|
public interface IAbstractRepository<TModel, in TId>
|
||||||
where TEntity : DomainEntity<TId>
|
where TModel : DomainModel<TId>
|
||||||
where TId : DomainId
|
where TId : DomainId
|
||||||
{
|
{
|
||||||
Task<TEntity?> GetByIdAsync(TId id, CancellationToken cancellationToken = default);
|
Task<TModel?> GetByIdAsync(TId id, CancellationToken cancellationToken = default);
|
||||||
Task SaveAsync(TEntity entity, CancellationToken cancellationToken = default);
|
Task SaveAsync(TModel model, CancellationToken cancellationToken = default);
|
||||||
Task AddAsync(TEntity entity, CancellationToken cancellationToken = default);
|
Task AddAsync(TModel model, CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Models.Shape;
|
namespace AipsCore.Domain.Models.Shape;
|
||||||
|
|
||||||
public abstract class Shape : DomainEntity<ShapeId>
|
public abstract class Shape : DomainModel<ShapeId>
|
||||||
{
|
{
|
||||||
public WhiteboardId WhiteboardId { get; private set; }
|
public WhiteboardId WhiteboardId { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using AipsCore.Domain.Models.User.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Models.User;
|
namespace AipsCore.Domain.Models.User;
|
||||||
|
|
||||||
public class User : DomainEntity<UserId>
|
public class User : DomainModel<UserId>
|
||||||
{
|
{
|
||||||
public Email Email { get; private set; }
|
public Email Email { get; private set; }
|
||||||
public Username Username { get; private set; }
|
public Username Username { get; private set; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Models.Whiteboard;
|
namespace AipsCore.Domain.Models.Whiteboard;
|
||||||
|
|
||||||
public class Whiteboard : DomainEntity<WhiteboardId>
|
public class Whiteboard : DomainModel<WhiteboardId>
|
||||||
{
|
{
|
||||||
public UserId WhiteboardOwnerId { get; private set; }
|
public UserId WhiteboardOwnerId { get; private set; }
|
||||||
public WhiteboardCode Code { get; private set; }
|
public WhiteboardCode Code { get; private set; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using AipsCore.Domain.Models.WhiteboardMembership.ValueObjects;
|
|||||||
|
|
||||||
namespace AipsCore.Domain.Models.WhiteboardMembership;
|
namespace AipsCore.Domain.Models.WhiteboardMembership;
|
||||||
|
|
||||||
public class WhiteboardMembership : DomainEntity<WhiteboardMembershipId>
|
public class WhiteboardMembership : DomainModel<WhiteboardMembershipId>
|
||||||
{
|
{
|
||||||
public WhiteboardId WhiteboardId { get; private set; }
|
public WhiteboardId WhiteboardId { get; private set; }
|
||||||
public UserId UserId { get; private set; }
|
public UserId UserId { get; private set; }
|
||||||
|
|||||||
@@ -5,51 +5,51 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace AipsCore.Infrastructure.Persistence.Abstract;
|
namespace AipsCore.Infrastructure.Persistence.Abstract;
|
||||||
|
|
||||||
public abstract class AbstractRepository<TEntity, TId, TPersistenceEntity> : IAbstractRepository<TEntity, TId>
|
public abstract class AbstractRepository<TModel, TId, TEntity> : IAbstractRepository<TModel, TId>
|
||||||
where TEntity : DomainEntity<TId>
|
where TModel : DomainModel<TId>
|
||||||
where TId : DomainId
|
where TId : DomainId
|
||||||
where TPersistenceEntity : class
|
where TEntity : class
|
||||||
{
|
{
|
||||||
protected readonly AipsDbContext Context;
|
protected readonly AipsDbContext Context;
|
||||||
protected readonly DbSet<TPersistenceEntity> DbSet;
|
protected readonly DbSet<TEntity> DbSet;
|
||||||
|
|
||||||
protected AbstractRepository(AipsDbContext context)
|
protected AbstractRepository(AipsDbContext context)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
DbSet = Context.Set<TPersistenceEntity>();
|
DbSet = Context.Set<TEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TEntity?> GetByIdAsync(TId id, CancellationToken cancellationToken = default)
|
public async Task<TModel?> GetByIdAsync(TId id, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var persistenceEntity = await DbSet.FindAsync([new Guid(id.IdValue)], cancellationToken);
|
var entity = await DbSet.FindAsync([new Guid(id.IdValue)], cancellationToken);
|
||||||
|
|
||||||
return persistenceEntity != null ? MapToDomainEntity(persistenceEntity) : null;
|
return entity != null ? MapToModel(entity) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveAsync(TEntity entity, CancellationToken cancellationToken = default)
|
public async Task SaveAsync(TModel model, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var persistenceEntity = await DbSet.FindAsync([new Guid(entity.Id.IdValue)], cancellationToken);
|
var entity = await DbSet.FindAsync([new Guid(model.Id.IdValue)], cancellationToken);
|
||||||
|
|
||||||
if (persistenceEntity == null)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
persistenceEntity = MapToPersistenceEntity(entity);
|
entity = MapToEntity(model);
|
||||||
await DbSet.AddAsync(persistenceEntity, cancellationToken);
|
await DbSet.AddAsync(entity, cancellationToken);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdatePersistenceEntity(persistenceEntity, entity);
|
UpdateEntity(entity, model);
|
||||||
DbSet.Update(persistenceEntity);
|
DbSet.Update(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddAsync(TEntity entity, CancellationToken cancellationToken = default)
|
public async Task AddAsync(TModel model, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var persistenceEntity = MapToPersistenceEntity(entity);
|
var entity = MapToEntity(model);
|
||||||
|
|
||||||
await DbSet.AddAsync(persistenceEntity, cancellationToken);
|
await DbSet.AddAsync(entity, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract TEntity MapToDomainEntity(TPersistenceEntity persistenceEntity);
|
protected abstract TModel MapToModel(TEntity entity);
|
||||||
protected abstract TPersistenceEntity MapToPersistenceEntity(TEntity domainEntity);
|
protected abstract TEntity MapToEntity(TModel model);
|
||||||
protected abstract void UpdatePersistenceEntity(TPersistenceEntity persistenceEntity, TEntity domainEntity);
|
protected abstract void UpdateEntity(TEntity entity, TModel model);
|
||||||
}
|
}
|
||||||
@@ -8,19 +8,19 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
|
|||||||
|
|
||||||
public static partial class ShapeMappers
|
public static partial class ShapeMappers
|
||||||
{
|
{
|
||||||
public static Domain.Models.Shape.Shape MapToDomainEntity(Shape shape)
|
public static Domain.Models.Shape.Shape MapToEntity(Shape shape)
|
||||||
{
|
{
|
||||||
return shape.Type switch
|
return shape.Type switch
|
||||||
{
|
{
|
||||||
ShapeType.Rectangle => PersistenceEntityToRectangle(shape),
|
ShapeType.Rectangle => EntityToRectangle(shape),
|
||||||
ShapeType.Line => PersistenceEntityToLine(shape),
|
ShapeType.Line => EntityToLine(shape),
|
||||||
ShapeType.Arrow => PersistenceEntityToArrow(shape),
|
ShapeType.Arrow => EntityToArrow(shape),
|
||||||
ShapeType.Text => PersistenceEntityToTextShape(shape),
|
ShapeType.Text => EntityToTextShape(shape),
|
||||||
_ => throw new ArgumentOutOfRangeException()
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Rectangle PersistenceEntityToRectangle(Shape shape)
|
public static Rectangle EntityToRectangle(Shape shape)
|
||||||
{
|
{
|
||||||
return Rectangle.Create(
|
return Rectangle.Create(
|
||||||
shape.Id.ToString(),
|
shape.Id.ToString(),
|
||||||
@@ -31,7 +31,7 @@ public static partial class ShapeMappers
|
|||||||
shape.Thickness!.Value);
|
shape.Thickness!.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Line PersistenceEntityToLine(Shape shape)
|
public static Line EntityToLine(Shape shape)
|
||||||
{
|
{
|
||||||
return Line.Create(
|
return Line.Create(
|
||||||
shape.Id.ToString(),
|
shape.Id.ToString(),
|
||||||
@@ -43,7 +43,7 @@ public static partial class ShapeMappers
|
|||||||
shape.Thickness!.Value);
|
shape.Thickness!.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Arrow PersistenceEntityToArrow(Shape shape)
|
public static Arrow EntityToArrow(Shape shape)
|
||||||
{
|
{
|
||||||
return Arrow.Create(
|
return Arrow.Create(
|
||||||
shape.Id.ToString(),
|
shape.Id.ToString(),
|
||||||
@@ -55,7 +55,7 @@ public static partial class ShapeMappers
|
|||||||
shape.Thickness!.Value);
|
shape.Thickness!.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextShape PersistenceEntityToTextShape(Shape shape)
|
public static TextShape EntityToTextShape(Shape shape)
|
||||||
{
|
{
|
||||||
return TextShape.Create(
|
return TextShape.Create(
|
||||||
shape.Id.ToString(),
|
shape.Id.ToString(),
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
|
|||||||
public static partial class ShapeMappers
|
public static partial class ShapeMappers
|
||||||
{
|
{
|
||||||
|
|
||||||
public static Shape MapToPersistenceEntity(Domain.Models.Shape.Shape model)
|
public static Shape MapToEntity(Domain.Models.Shape.Shape model)
|
||||||
{
|
{
|
||||||
return model.ShapeType switch
|
return model.ShapeType switch
|
||||||
{
|
{
|
||||||
ShapeType.Rectangle => RectangleToPersistenceEntity((Rectangle)model),
|
ShapeType.Rectangle => RectangleToEntity((Rectangle)model),
|
||||||
ShapeType.Line => LineToPersistenceEntity((Line)model),
|
ShapeType.Line => LineToEntity((Line)model),
|
||||||
ShapeType.Arrow => ArrowToPersistenceEntity((Arrow)model),
|
ShapeType.Arrow => ArrowToEntity((Arrow)model),
|
||||||
ShapeType.Text => TextShapeToPersistenceEntity((TextShape)model),
|
ShapeType.Text => TextShapeToEntity((TextShape)model),
|
||||||
_ => throw new ArgumentOutOfRangeException()
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Shape RectangleToPersistenceEntity(Rectangle rectangle)
|
public static Shape RectangleToEntity(Rectangle rectangle)
|
||||||
{
|
{
|
||||||
return new Shape
|
return new Shape
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@ public static partial class ShapeMappers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Shape LineToPersistenceEntity(Line line)
|
public static Shape LineToEntity(Line line)
|
||||||
{
|
{
|
||||||
return new Shape
|
return new Shape
|
||||||
{
|
{
|
||||||
@@ -55,7 +55,7 @@ public static partial class ShapeMappers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Shape ArrowToPersistenceEntity(Arrow arrow)
|
public static Shape ArrowToEntity(Arrow arrow)
|
||||||
{
|
{
|
||||||
return new Shape
|
return new Shape
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ public static partial class ShapeMappers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Shape TextShapeToPersistenceEntity(TextShape textShape)
|
public static Shape TextShapeToEntity(TextShape textShape)
|
||||||
{
|
{
|
||||||
return new Shape
|
return new Shape
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
|
|||||||
|
|
||||||
public static partial class ShapeMappers
|
public static partial class ShapeMappers
|
||||||
{
|
{
|
||||||
public static void UpdatePersistenceEntity(Shape entity, Domain.Models.Shape.Shape model)
|
public static void UpdateEntity(Shape entity, Domain.Models.Shape.Shape model)
|
||||||
{
|
{
|
||||||
entity.WhiteboardId = new Guid(model.WhiteboardId.IdValue);
|
entity.WhiteboardId = new Guid(model.WhiteboardId.IdValue);
|
||||||
entity.PositionX = model.Position.X;
|
entity.PositionX = model.Position.X;
|
||||||
@@ -32,28 +32,28 @@ public static partial class ShapeMappers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateEntityFromRectangle(Shape entity, Rectangle rectangle)
|
public static void UpdateEntityFromRectangle(Shape entity, Rectangle rectangle)
|
||||||
{
|
{
|
||||||
entity.EndPositionX = rectangle.EndPosition.X;
|
entity.EndPositionX = rectangle.EndPosition.X;
|
||||||
entity.EndPositionY = rectangle.EndPosition.Y;
|
entity.EndPositionY = rectangle.EndPosition.Y;
|
||||||
entity.Thickness = rectangle.BorderThickness.Value;
|
entity.Thickness = rectangle.BorderThickness.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateEntityFromLine(Shape entity, Line line)
|
public static void UpdateEntityFromLine(Shape entity, Line line)
|
||||||
{
|
{
|
||||||
entity.EndPositionX = line.EndPosition.X;
|
entity.EndPositionX = line.EndPosition.X;
|
||||||
entity.EndPositionY = line.EndPosition.Y;
|
entity.EndPositionY = line.EndPosition.Y;
|
||||||
entity.Thickness = line.Thickness.Value;
|
entity.Thickness = line.Thickness.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateEntityFromArrow(Shape entity, Arrow arrow)
|
public static void UpdateEntityFromArrow(Shape entity, Arrow arrow)
|
||||||
{
|
{
|
||||||
entity.EndPositionX = arrow.EndPosition.X;
|
entity.EndPositionX = arrow.EndPosition.X;
|
||||||
entity.EndPositionY = arrow.EndPosition.Y;
|
entity.EndPositionY = arrow.EndPosition.Y;
|
||||||
entity.Thickness = arrow.Thickness.Value;
|
entity.Thickness = arrow.Thickness.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateEntityFromTextShape(Shape entity, TextShape textShape)
|
public static void UpdateEntityFromTextShape(Shape entity, TextShape textShape)
|
||||||
{
|
{
|
||||||
entity.TextValue = textShape.TextShapeValue.Text;
|
entity.TextValue = textShape.TextShapeValue.Text;
|
||||||
entity.TextSize = textShape.TextShapeSize.Size;
|
entity.TextSize = textShape.TextShapeSize.Size;
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ public class ShapeRepository : AbstractRepository<Domain.Models.Shape.Shape, Sha
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Domain.Models.Shape.Shape MapToDomainEntity(Shape persistenceEntity)
|
protected override Domain.Models.Shape.Shape MapToModel(Shape entity)
|
||||||
{
|
{
|
||||||
return ShapeMappers.MapToDomainEntity(persistenceEntity);
|
return ShapeMappers.MapToEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Shape MapToPersistenceEntity(Domain.Models.Shape.Shape domainEntity)
|
protected override Shape MapToEntity(Domain.Models.Shape.Shape model)
|
||||||
{
|
{
|
||||||
return ShapeMappers.MapToPersistenceEntity(domainEntity);
|
return ShapeMappers.MapToEntity(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdatePersistenceEntity(Shape persistenceEntity, Domain.Models.Shape.Shape domainEntity)
|
protected override void UpdateEntity(Shape entity, Domain.Models.Shape.Shape model)
|
||||||
{
|
{
|
||||||
ShapeMappers.UpdatePersistenceEntity(persistenceEntity, domainEntity);
|
ShapeMappers.UpdateEntity(entity, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,34 +12,34 @@ public class UserRepository : AbstractRepository<Domain.Models.User.User, UserId
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Domain.Models.User.User MapToDomainEntity(User persistenceEntity)
|
protected override Domain.Models.User.User MapToModel(User entity)
|
||||||
{
|
{
|
||||||
return Domain.Models.User.User.Create(
|
return Domain.Models.User.User.Create(
|
||||||
persistenceEntity.Id.ToString(),
|
entity.Id.ToString(),
|
||||||
persistenceEntity.Email,
|
entity.Email,
|
||||||
persistenceEntity.Username,
|
entity.Username,
|
||||||
persistenceEntity.CreatedAt,
|
entity.CreatedAt,
|
||||||
persistenceEntity.DeletedAt
|
entity.DeletedAt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override User MapToPersistenceEntity(Domain.Models.User.User domainEntity)
|
protected override User MapToEntity(Domain.Models.User.User model)
|
||||||
{
|
{
|
||||||
return new User
|
return new User
|
||||||
{
|
{
|
||||||
Id = new Guid(domainEntity.Id.IdValue),
|
Id = new Guid(model.Id.IdValue),
|
||||||
Email = domainEntity.Email.EmailValue,
|
Email = model.Email.EmailValue,
|
||||||
Username = domainEntity.Username.UsernameValue,
|
Username = model.Username.UsernameValue,
|
||||||
CreatedAt = domainEntity.CreatedAt.CreatedAtValue,
|
CreatedAt = model.CreatedAt.CreatedAtValue,
|
||||||
DeletedAt = domainEntity.DeletedAt.DeletedAtValue
|
DeletedAt = model.DeletedAt.DeletedAtValue
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdatePersistenceEntity(User persistenceEntity, Domain.Models.User.User domainEntity)
|
protected override void UpdateEntity(User entity, Domain.Models.User.User model)
|
||||||
{
|
{
|
||||||
persistenceEntity.Email = domainEntity.Email.EmailValue;
|
entity.Email = model.Email.EmailValue;
|
||||||
persistenceEntity.Username = domainEntity.Username.UsernameValue;
|
entity.Username = model.Username.UsernameValue;
|
||||||
persistenceEntity.CreatedAt = domainEntity.CreatedAt.CreatedAtValue;
|
entity.CreatedAt = model.CreatedAt.CreatedAtValue;
|
||||||
persistenceEntity.DeletedAt = domainEntity.DeletedAt.DeletedAtValue;
|
entity.DeletedAt = model.DeletedAt.DeletedAtValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,46 +15,46 @@ public class WhiteboardRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Domain.Models.Whiteboard.Whiteboard MapToDomainEntity(Whiteboard persistenceEntity)
|
protected override Domain.Models.Whiteboard.Whiteboard MapToModel(Whiteboard entity)
|
||||||
{
|
{
|
||||||
return Domain.Models.Whiteboard.Whiteboard.Create(
|
return Domain.Models.Whiteboard.Whiteboard.Create(
|
||||||
persistenceEntity.Id.ToString(),
|
entity.Id.ToString(),
|
||||||
persistenceEntity.OwnerId.ToString(),
|
entity.OwnerId.ToString(),
|
||||||
persistenceEntity.Code,
|
entity.Code,
|
||||||
persistenceEntity.Title,
|
entity.Title,
|
||||||
persistenceEntity.CreatedAt,
|
entity.CreatedAt,
|
||||||
persistenceEntity.DeletedAt,
|
entity.DeletedAt,
|
||||||
persistenceEntity.MaxParticipants,
|
entity.MaxParticipants,
|
||||||
persistenceEntity.JoinPolicy,
|
entity.JoinPolicy,
|
||||||
persistenceEntity.State
|
entity.State
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Whiteboard MapToPersistenceEntity(Domain.Models.Whiteboard.Whiteboard domainEntity)
|
protected override Whiteboard MapToEntity(Domain.Models.Whiteboard.Whiteboard model)
|
||||||
{
|
{
|
||||||
return new Whiteboard
|
return new Whiteboard
|
||||||
{
|
{
|
||||||
Id = new Guid(domainEntity.Id.IdValue),
|
Id = new Guid(model.Id.IdValue),
|
||||||
OwnerId = new Guid(domainEntity.WhiteboardOwnerId.IdValue),
|
OwnerId = new Guid(model.WhiteboardOwnerId.IdValue),
|
||||||
Code = domainEntity.Code.CodeValue,
|
Code = model.Code.CodeValue,
|
||||||
Title = domainEntity.Title.TitleValue,
|
Title = model.Title.TitleValue,
|
||||||
CreatedAt = domainEntity.CreatedAt.CreatedAtValue,
|
CreatedAt = model.CreatedAt.CreatedAtValue,
|
||||||
DeletedAt = domainEntity.DeletedAt.DeletedAtValue,
|
DeletedAt = model.DeletedAt.DeletedAtValue,
|
||||||
MaxParticipants = domainEntity.MaxParticipants.MaxParticipantsValue,
|
MaxParticipants = model.MaxParticipants.MaxParticipantsValue,
|
||||||
JoinPolicy = domainEntity.JoinPolicy,
|
JoinPolicy = model.JoinPolicy,
|
||||||
State = domainEntity.State
|
State = model.State
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdatePersistenceEntity(Whiteboard persistenceEntity, Domain.Models.Whiteboard.Whiteboard domainEntity)
|
protected override void UpdateEntity(Whiteboard entity, Domain.Models.Whiteboard.Whiteboard model)
|
||||||
{
|
{
|
||||||
persistenceEntity.Code = domainEntity.Code.CodeValue;
|
entity.Code = model.Code.CodeValue;
|
||||||
persistenceEntity.Title = domainEntity.Title.TitleValue;
|
entity.Title = model.Title.TitleValue;
|
||||||
persistenceEntity.CreatedAt = domainEntity.CreatedAt.CreatedAtValue;
|
entity.CreatedAt = model.CreatedAt.CreatedAtValue;
|
||||||
persistenceEntity.DeletedAt = domainEntity.DeletedAt.DeletedAtValue;
|
entity.DeletedAt = model.DeletedAt.DeletedAtValue;
|
||||||
persistenceEntity.MaxParticipants = domainEntity.MaxParticipants.MaxParticipantsValue;
|
entity.MaxParticipants = model.MaxParticipants.MaxParticipantsValue;
|
||||||
persistenceEntity.JoinPolicy = domainEntity.JoinPolicy;
|
entity.JoinPolicy = model.JoinPolicy;
|
||||||
persistenceEntity.State = domainEntity.State;
|
entity.State = model.State;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> WhiteboardCodeExists(WhiteboardCode whiteboardCode)
|
public async Task<bool> WhiteboardCodeExists(WhiteboardCode whiteboardCode)
|
||||||
|
|||||||
@@ -15,38 +15,38 @@ public class WhiteboardMembershipRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Domain.Models.WhiteboardMembership.WhiteboardMembership MapToDomainEntity(WhiteboardMembership persistenceEntity)
|
protected override Domain.Models.WhiteboardMembership.WhiteboardMembership MapToModel(WhiteboardMembership entity)
|
||||||
{
|
{
|
||||||
return Domain.Models.WhiteboardMembership.WhiteboardMembership.Create(
|
return Domain.Models.WhiteboardMembership.WhiteboardMembership.Create(
|
||||||
persistenceEntity.Id.ToString(),
|
entity.Id.ToString(),
|
||||||
persistenceEntity.WhiteboardId.ToString(),
|
entity.WhiteboardId.ToString(),
|
||||||
persistenceEntity.UserId.ToString(),
|
entity.UserId.ToString(),
|
||||||
persistenceEntity.IsBanned,
|
entity.IsBanned,
|
||||||
persistenceEntity.EditingEnabled,
|
entity.EditingEnabled,
|
||||||
persistenceEntity.CanJoin,
|
entity.CanJoin,
|
||||||
persistenceEntity.LastInteractedAt
|
entity.LastInteractedAt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WhiteboardMembership MapToPersistenceEntity(Domain.Models.WhiteboardMembership.WhiteboardMembership domainEntity)
|
protected override WhiteboardMembership MapToEntity(Domain.Models.WhiteboardMembership.WhiteboardMembership model)
|
||||||
{
|
{
|
||||||
return new WhiteboardMembership
|
return new WhiteboardMembership
|
||||||
{
|
{
|
||||||
Id = new Guid(domainEntity.Id.IdValue),
|
Id = new Guid(model.Id.IdValue),
|
||||||
WhiteboardId = new Guid(domainEntity.WhiteboardId.IdValue),
|
WhiteboardId = new Guid(model.WhiteboardId.IdValue),
|
||||||
UserId = new Guid(domainEntity.UserId.IdValue),
|
UserId = new Guid(model.UserId.IdValue),
|
||||||
IsBanned = domainEntity.IsBanned.IsBannedValue,
|
IsBanned = model.IsBanned.IsBannedValue,
|
||||||
EditingEnabled = domainEntity.EditingEnabled.EditingEnabledValue,
|
EditingEnabled = model.EditingEnabled.EditingEnabledValue,
|
||||||
CanJoin = domainEntity.CanJoin.CanJoinValue,
|
CanJoin = model.CanJoin.CanJoinValue,
|
||||||
LastInteractedAt = domainEntity.LastInteractedAt.LastInteractedAtValue
|
LastInteractedAt = model.LastInteractedAt.LastInteractedAtValue
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdatePersistenceEntity(WhiteboardMembership persistenceEntity, Domain.Models.WhiteboardMembership.WhiteboardMembership domainEntity)
|
protected override void UpdateEntity(WhiteboardMembership entity, Domain.Models.WhiteboardMembership.WhiteboardMembership model)
|
||||||
{
|
{
|
||||||
persistenceEntity.IsBanned = domainEntity.IsBanned.IsBannedValue;
|
entity.IsBanned = model.IsBanned.IsBannedValue;
|
||||||
persistenceEntity.EditingEnabled = domainEntity.EditingEnabled.EditingEnabledValue;
|
entity.EditingEnabled = model.EditingEnabled.EditingEnabledValue;
|
||||||
persistenceEntity.CanJoin = domainEntity.CanJoin.CanJoinValue;
|
entity.CanJoin = model.CanJoin.CanJoinValue;
|
||||||
persistenceEntity.LastInteractedAt = domainEntity.LastInteractedAt.LastInteractedAtValue;
|
entity.LastInteractedAt = model.LastInteractedAt.LastInteractedAtValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user