From 6d7636b2e70a4568a362eda6fe871c0fa64bb4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 16 Jan 2021 22:11:20 +0300 Subject: [PATCH] Create Organization entity. --- .../Organizations/OrganizationContst.cs | 8 +++ .../Organizations/Organization.cs | 52 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 eventhub/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs create mode 100644 eventhub/src/EventHub.Domain/Organizations/Organization.cs diff --git a/eventhub/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs b/eventhub/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs new file mode 100644 index 0000000..c239006 --- /dev/null +++ b/eventhub/src/EventHub.Domain.Shared/Organizations/OrganizationContst.cs @@ -0,0 +1,8 @@ +namespace EventHub.Organizations +{ + public static class OrganizationConsts + { + public const int MinNameLength = 2; + public const int MaxNameLength = 32; + } +} diff --git a/eventhub/src/EventHub.Domain/Organizations/Organization.cs b/eventhub/src/EventHub.Domain/Organizations/Organization.cs new file mode 100644 index 0000000..b2a4254 --- /dev/null +++ b/eventhub/src/EventHub.Domain/Organizations/Organization.cs @@ -0,0 +1,52 @@ +using System; +using Volo.Abp; +using Volo.Abp.Domain.Entities; + +namespace EventHub.Organizations +{ + public class Organization : AggregateRoot + { + public string Name { get; private set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + + public string Website { get; set; } + + public string TwitterUsername { get; set; } + + public string GitHubUsername { get; set; } + + public string FacebookUsername { get; set; } + + public string InstagramUsername { get; set; } + + public string MediumUsername { get; set; } + + private Organization() + { + + } + + public Organization( + Guid id, + string name, + string displayName) + : base(id) + { + SetName(name); + SetDisplayName(displayName); + } + + internal void SetName(string name) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), OrganizationConsts.MaxNameLength, OrganizationConsts.MinNameLength); + } + + public void SetDisplayName(string displayName) + { + DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName)); + } + } +}