Added author to shape model

This commit is contained in:
Veljko Tosic
2026-02-09 23:48:54 +01:00
parent 1f6af52f14
commit 0d08a64e6f
9 changed files with 37 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Shape.Enums;
using AipsCore.Domain.Models.Shape.ValueObjects;
using AipsCore.Domain.Models.User.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape;
@@ -11,17 +12,20 @@ public abstract class Shape
public WhiteboardId WhiteboardId { get; private set; }
public UserId AuthorId { get; private set; }
public abstract ShapeType ShapeType { get; }
public Position Position { get; private set; }
public Color Color { get; private set; }
protected Shape(ShapeId id, WhiteboardId whiteboardId, Position position, Color color)
protected Shape(ShapeId id, WhiteboardId whiteboardId, UserId authorId, Position position, Color color)
{
Id = id;
Position = position;
Color = color;
AuthorId = authorId;
WhiteboardId = whiteboardId;
}
@@ -29,8 +33,9 @@ public abstract class Shape
string id,
string whiteboardId,
int positionX, int positionY,
string color)
string color, UserId authorId)
{
AuthorId = authorId;
Id = new ShapeId(id);
Position = new Position(positionX, positionY);
Color = new Color(color);

View File

@@ -1,6 +1,7 @@
using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Shape.Enums;
using AipsCore.Domain.Models.Shape.ValueObjects;
using AipsCore.Domain.Models.User.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Arrow;
@@ -10,7 +11,8 @@ public class Arrow : Shape
public Position EndPosition { get; private set; }
public Thickness Thickness { get; private set; }
public Arrow(ShapeId id, WhiteboardId whiteboardId, Position position, Color color, Position endPosition, Thickness thickness) : base(id, whiteboardId, position, color)
public Arrow(ShapeId id, WhiteboardId whiteboardId, UserId authorId, Position position, Color color, Position endPosition, Thickness thickness)
: base(id, whiteboardId, authorId, position, color)
{
EndPosition = endPosition;
Thickness = thickness;
@@ -21,6 +23,7 @@ public class Arrow : Shape
public static Arrow Create(
string id,
string whiteboardId,
string authorId,
int positionX, int positionY,
string color,
int endPositionX, int endPositionY,
@@ -29,6 +32,7 @@ public class Arrow : Shape
return new Arrow(
new ShapeId(id),
new WhiteboardId(whiteboardId),
new UserId(authorId),
new Position(positionX, positionY),
new Color(color),
new Position(endPositionX, endPositionY),

View File

@@ -1,6 +1,7 @@
using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Shape.Enums;
using AipsCore.Domain.Models.Shape.ValueObjects;
using AipsCore.Domain.Models.User.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Line;
@@ -10,7 +11,8 @@ public class Line : Shape
public Position EndPosition { get; private set; }
public Thickness Thickness { get; private set; }
public Line(ShapeId id, WhiteboardId whiteboardId, Position position, Color color, Position endPosition, Thickness thickness) : base(id, whiteboardId, position, color)
public Line(ShapeId id, WhiteboardId whiteboardId, UserId authorId, Position position, Color color, Position endPosition, Thickness thickness)
: base(id, whiteboardId, authorId, position, color)
{
EndPosition = endPosition;
Thickness = thickness;
@@ -21,6 +23,7 @@ public class Line : Shape
public static Line Create(
string id,
string whiteboardId,
string authorId,
int positionX, int positionY,
string color,
int endPositionX, int endPositionY,
@@ -29,6 +32,7 @@ public class Line : Shape
return new Line(
new ShapeId(id),
new WhiteboardId(whiteboardId),
new UserId(authorId),
new Position(positionX, positionY),
new Color(color),
new Position(endPositionX, endPositionY),

View File

@@ -1,6 +1,7 @@
using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Shape.Enums;
using AipsCore.Domain.Models.Shape.ValueObjects;
using AipsCore.Domain.Models.User.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Rectangle;
@@ -13,8 +14,8 @@ public class Rectangle : Shape
public Thickness BorderThickness { get; }
public Rectangle(ShapeId id, WhiteboardId whiteboardId, Position position, Color color, Position endPosition, Thickness borderThickness)
: base(id, whiteboardId, position, color)
public Rectangle(ShapeId id, WhiteboardId whiteboardId, UserId authorId, Position position, Color color, Position endPosition, Thickness borderThickness)
: base(id, whiteboardId, authorId, position, color)
{
EndPosition = endPosition;
BorderThickness = borderThickness;
@@ -23,6 +24,7 @@ public class Rectangle : Shape
public static Rectangle Create(
string id,
string whiteboardId,
string authorId,
int positionX, int positionY,
string color,
int endPositionX, int endPositionY,
@@ -31,6 +33,7 @@ public class Rectangle : Shape
return new Rectangle(
new ShapeId(id),
new WhiteboardId(whiteboardId),
new UserId(authorId),
new Position(positionX, positionY),
new Color(color),
new Position(endPositionX, endPositionY),
@@ -39,6 +42,7 @@ public class Rectangle : Shape
public static Rectangle Create(
string whiteboardId,
string authorId,
int positionX, int positionY,
string color,
int endPositionX, int endPositionY,
@@ -47,6 +51,7 @@ public class Rectangle : Shape
return new Rectangle(
ShapeId.Any(),
new WhiteboardId(whiteboardId),
new UserId(authorId),
new Position(positionX, positionY),
new Color(color),
new Position(endPositionX, endPositionY),

View File

@@ -2,6 +2,7 @@ using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Shape.Enums;
using AipsCore.Domain.Models.Shape.Sub.TextShape.ValueObjects;
using AipsCore.Domain.Models.Shape.ValueObjects;
using AipsCore.Domain.Models.User.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.TextShape;
@@ -12,8 +13,8 @@ public class TextShape : Shape
public TextShapeSize TextShapeSize { get; private set; }
public TextShape(ShapeId id, WhiteboardId whiteboardId, Position position, Color color, TextShapeValue textShapeValue, TextShapeSize textShapeSize)
: base(id, whiteboardId, position, color)
public TextShape(ShapeId id, WhiteboardId whiteboardId, UserId authorId, Position position, Color color, TextShapeValue textShapeValue, TextShapeSize textShapeSize)
: base(id, whiteboardId, authorId, position, color)
{
TextShapeValue = textShapeValue;
TextShapeSize = textShapeSize;
@@ -24,6 +25,7 @@ public class TextShape : Shape
public static TextShape Create(
string id,
string whiteboardId,
string authorId,
int positionX, int positionY,
string color,
string textValue, int textSize)
@@ -31,6 +33,7 @@ public class TextShape : Shape
return new TextShape(
new ShapeId(id),
new WhiteboardId(whiteboardId),
new UserId(authorId),
new Position(positionX, positionY),
new Color(color),
new TextShapeValue(textValue),