Added author to shape model
This commit is contained in:
@@ -5,6 +5,7 @@ namespace AipsCore.Application.Models.Shape.Command.CreateRectangle;
|
||||
|
||||
public record CreateRectangleCommand(
|
||||
string WhiteboardId,
|
||||
string AuthorId,
|
||||
int PositionX,
|
||||
int PositionY,
|
||||
string Color,
|
||||
|
||||
@@ -21,6 +21,7 @@ public class CreateRectangleCommandHandler : ICommandHandler<CreateRectangleComm
|
||||
{
|
||||
var rectangle = Rectangle.Create(
|
||||
command.WhiteboardId,
|
||||
command.AuthorId,
|
||||
command.PositionX, command.PositionY,
|
||||
command.Color,
|
||||
command.EndPositionX,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -36,6 +36,7 @@ public static partial class ShapeMappers
|
||||
return Line.Create(
|
||||
shape.Id.ToString(),
|
||||
shape.WhiteboardId.ToString(),
|
||||
shape.AuthorId.ToString(),
|
||||
shape.PositionX, shape.PositionY,
|
||||
shape.Color,
|
||||
shape.EndPositionX!.Value, shape.EndPositionY!.Value,
|
||||
@@ -47,6 +48,7 @@ public static partial class ShapeMappers
|
||||
return Arrow.Create(
|
||||
shape.Id.ToString(),
|
||||
shape.WhiteboardId.ToString(),
|
||||
shape.AuthorId.ToString(),
|
||||
shape.PositionX, shape.PositionY,
|
||||
shape.Color,
|
||||
shape.EndPositionX!.Value, shape.EndPositionY!.Value,
|
||||
@@ -58,6 +60,7 @@ public static partial class ShapeMappers
|
||||
return TextShape.Create(
|
||||
shape.Id.ToString(),
|
||||
shape.WhiteboardId.ToString(),
|
||||
shape.AuthorId.ToString(),
|
||||
shape.PositionX, shape.PositionY,
|
||||
shape.Color,
|
||||
shape.TextValue!, shape.TextSize!.Value);
|
||||
|
||||
@@ -13,6 +13,9 @@ public class Shape
|
||||
public Guid WhiteboardId { get; set; }
|
||||
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 int PositionX { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user