Whiteboard Domain

This commit is contained in:
Veljko Tosic
2026-02-09 00:13:23 +01:00
parent 90c127ddb3
commit f93144f732
7 changed files with 103 additions and 9 deletions

View File

@@ -1,9 +1,6 @@
using AipsCore.Domain.Abstract;
using AipsCore.Domain.Abstract.Rule;
using AipsCore.Domain.Abstract.Rule;
using AipsCore.Domain.Abstract.ValueObject;
using AipsCore.Domain.Common.Validation;
using AipsCore.Domain.Common.Validation.Rules;
using AipsCore.Domain.Common.ValueObjects;
using AipsCore.Domain.Models.Whiteboard.Validation;
namespace AipsCore.Domain.Models.Whiteboard.ValueObjects;
@@ -25,7 +22,7 @@ public record WhiteboardCode : AbstractValueObject
return
[
new ExactLength(CodeValue, CodeLength),
new WhitebordCodeCharsetRule(CodeValue)
new WhiteboardCodeCharsetRule(CodeValue)
];
}
}

View File

@@ -2,4 +2,7 @@
namespace AipsCore.Domain.Models.Whiteboard.ValueObjects;
public record WhiteboardId(string IdValue) : DomainId(IdValue);
public record WhiteboardId(string IdValue) : DomainId(IdValue)
{
public static WhiteboardId Any() => new(Guid.NewGuid().ToString());
}

View File

@@ -0,0 +1,29 @@
using AipsCore.Domain.Abstract.Rule;
using AipsCore.Domain.Abstract.ValueObject;
using AipsCore.Domain.Common.Validation.Rules;
using AipsCore.Domain.Models.Whiteboard.Validation;
namespace AipsCore.Domain.Models.Whiteboard.ValueObjects;
public record WhiteboardTitle : AbstractValueObject
{
private const int MaxWhiteboardTitleLength = 32;
private const int MinWhiteboardTitleLength = 3;
public string TitleValue { get; init; }
public WhiteboardTitle(string TitleValue)
{
this.TitleValue = TitleValue;
Validate();
}
protected override ICollection<IRule> GetValidationRules()
{
return [
new MaxLengthRule(TitleValue, MaxWhiteboardTitleLength),
new MinLengthRule(TitleValue, MinWhiteboardTitleLength),
new WhiteboardTitleCharsetRule(TitleValue)
];
}
}