Merge pull request #13 from StewKI/feature-shape-author

Added author to shape model
This commit is contained in:
Veljko
2026-02-10 13:00:32 +01:00
committed by GitHub
9 changed files with 37 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ namespace AipsCore.Application.Models.Shape.Command.CreateRectangle;
public record CreateRectangleCommand( public record CreateRectangleCommand(
string WhiteboardId, string WhiteboardId,
string AuthorId,
int PositionX, int PositionX,
int PositionY, int PositionY,
string Color, string Color,

View File

@@ -21,6 +21,7 @@ public class CreateRectangleCommandHandler : ICommandHandler<CreateRectangleComm
{ {
var rectangle = Rectangle.Create( var rectangle = Rectangle.Create(
command.WhiteboardId, command.WhiteboardId,
command.AuthorId,
command.PositionX, command.PositionY, command.PositionX, command.PositionY,
command.Color, command.Color,
command.EndPositionX, command.EndPositionX,

View File

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

View File

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

View File

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

View File

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

View File

@@ -36,6 +36,7 @@ public static partial class ShapeMappers
return Line.Create( return Line.Create(
shape.Id.ToString(), shape.Id.ToString(),
shape.WhiteboardId.ToString(), shape.WhiteboardId.ToString(),
shape.AuthorId.ToString(),
shape.PositionX, shape.PositionY, shape.PositionX, shape.PositionY,
shape.Color, shape.Color,
shape.EndPositionX!.Value, shape.EndPositionY!.Value, shape.EndPositionX!.Value, shape.EndPositionY!.Value,
@@ -47,6 +48,7 @@ public static partial class ShapeMappers
return Arrow.Create( return Arrow.Create(
shape.Id.ToString(), shape.Id.ToString(),
shape.WhiteboardId.ToString(), shape.WhiteboardId.ToString(),
shape.AuthorId.ToString(),
shape.PositionX, shape.PositionY, shape.PositionX, shape.PositionY,
shape.Color, shape.Color,
shape.EndPositionX!.Value, shape.EndPositionY!.Value, shape.EndPositionX!.Value, shape.EndPositionY!.Value,
@@ -58,6 +60,7 @@ public static partial class ShapeMappers
return TextShape.Create( return TextShape.Create(
shape.Id.ToString(), shape.Id.ToString(),
shape.WhiteboardId.ToString(), shape.WhiteboardId.ToString(),
shape.AuthorId.ToString(),
shape.PositionX, shape.PositionY, shape.PositionX, shape.PositionY,
shape.Color, shape.Color,
shape.TextValue!, shape.TextSize!.Value); shape.TextValue!, shape.TextSize!.Value);

View File

@@ -13,6 +13,9 @@ public class Shape
public Guid WhiteboardId { get; set; } public Guid WhiteboardId { get; set; }
public Whiteboard.Whiteboard Whiteboard { get; set; } = null!; public Whiteboard.Whiteboard Whiteboard { get; set; } = null!;
public Guid AuthorId { get; set; }
public User.User Author { get; set; } = null!;
public ShapeType Type { get; set; } public ShapeType Type { get; set; }
public int PositionX { get; set; } public int PositionX { get; set; }