Refactored to follow naming convention

This commit is contained in:
Veljko Tosic
2026-02-11 13:10:39 +01:00
parent e7abe1eaed
commit 4255512097
14 changed files with 128 additions and 128 deletions

View File

@@ -8,19 +8,19 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
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
{
ShapeType.Rectangle => PersistenceEntityToRectangle(shape),
ShapeType.Line => PersistenceEntityToLine(shape),
ShapeType.Arrow => PersistenceEntityToArrow(shape),
ShapeType.Text => PersistenceEntityToTextShape(shape),
ShapeType.Rectangle => EntityToRectangle(shape),
ShapeType.Line => EntityToLine(shape),
ShapeType.Arrow => EntityToArrow(shape),
ShapeType.Text => EntityToTextShape(shape),
_ => throw new ArgumentOutOfRangeException()
};
}
private static Rectangle PersistenceEntityToRectangle(Shape shape)
public static Rectangle EntityToRectangle(Shape shape)
{
return Rectangle.Create(
shape.Id.ToString(),
@@ -31,7 +31,7 @@ public static partial class ShapeMappers
shape.Thickness!.Value);
}
private static Line PersistenceEntityToLine(Shape shape)
public static Line EntityToLine(Shape shape)
{
return Line.Create(
shape.Id.ToString(),
@@ -43,7 +43,7 @@ public static partial class ShapeMappers
shape.Thickness!.Value);
}
private static Arrow PersistenceEntityToArrow(Shape shape)
public static Arrow EntityToArrow(Shape shape)
{
return Arrow.Create(
shape.Id.ToString(),
@@ -55,7 +55,7 @@ public static partial class ShapeMappers
shape.Thickness!.Value);
}
private static TextShape PersistenceEntityToTextShape(Shape shape)
public static TextShape EntityToTextShape(Shape shape)
{
return TextShape.Create(
shape.Id.ToString(),

View File

@@ -9,19 +9,19 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
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
{
ShapeType.Rectangle => RectangleToPersistenceEntity((Rectangle)model),
ShapeType.Line => LineToPersistenceEntity((Line)model),
ShapeType.Arrow => ArrowToPersistenceEntity((Arrow)model),
ShapeType.Text => TextShapeToPersistenceEntity((TextShape)model),
ShapeType.Rectangle => RectangleToEntity((Rectangle)model),
ShapeType.Line => LineToEntity((Line)model),
ShapeType.Arrow => ArrowToEntity((Arrow)model),
ShapeType.Text => TextShapeToEntity((TextShape)model),
_ => throw new ArgumentOutOfRangeException()
};
}
private static Shape RectangleToPersistenceEntity(Rectangle rectangle)
public static Shape RectangleToEntity(Rectangle rectangle)
{
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
{
@@ -55,7 +55,7 @@ public static partial class ShapeMappers
};
}
private static Shape ArrowToPersistenceEntity(Arrow arrow)
public static Shape ArrowToEntity(Arrow arrow)
{
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
{

View File

@@ -8,7 +8,7 @@ namespace AipsCore.Infrastructure.Persistence.Shape.Mappers;
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.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.EndPositionY = rectangle.EndPosition.Y;
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.EndPositionY = line.EndPosition.Y;
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.EndPositionY = arrow.EndPosition.Y;
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.TextSize = textShape.TextShapeSize.Size;