commit a163f8f1484c2703132534b56738ffb9822eb136
Author: Milan Hotovec <silent@students.zcu.cz>
Date:   Tue May 11 10:53:45 2021 +0200

    Edit repo, added set methods

diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj
index b9d062e..95a62a6 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj
@@ -23,4 +23,11 @@
     <ProjectReference Include="..\..\Domain\Leuze.Modules.Goal.Domain\Leuze.Modules.Goal.Domain.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="CQRS\Comments\Commands\" />
+    <Folder Include="CQRS\Comments\Queries\" />
+    <Folder Include="CQRS\Reviews\Commands\" />
+    <Folder Include="CQRS\Reviews\Queries\" />
+  </ItemGroup>
+
 </Project>
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs
index 96f872f..5d9698d 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs
@@ -30,8 +30,13 @@ namespace Leuze.Modules.Goal.Domain.Domains
         public Guid CreatorId { get; private set; }
         public GoalItem Goal { get; private set; }
         public Guid GoalId { get; private set; }
-        public string Text { get; set; }
+        public string Text { get; private set; }
         public bool IsPrivate { get; private set; }
         public bool IsChanged { get; set; }
+
+        public void SetText(string text)
+        {
+            this.Text = text;
+        }
     }
 }
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs
index 5cc9510..cae6d4f 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs
@@ -32,14 +32,32 @@ namespace Leuze.Modules.Goal.Domain.Domains
         public Guid OwnerId { get; private set; }
         public DomainUser Creator { get; private set; }
         public Guid CreatorId { get; private set; }
-        public string Name { get; set; }
-        public DateTime From { get; set; }
-        public DateTime To { get; set; }
+        public string Name { get; private set; }
+        public DateTime From { get; private set; }
+        public DateTime To { get; private set; }
         public bool OwnerLocked { get; private set; }
         public bool SupervisorLocked { get; private set; }
-        public decimal? Vari { get; set; }
+        public decimal? Vari { get; private set; }
 
         private List<GoalItem> _goals { get; set; }
         public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly();
+
+        public void SetName(string name)
+        {
+            this.Name = name;
+        }
+        public void SetFrom(DateTime from)
+        {
+            this.From = from;
+        }
+        public void SetTo(DateTime to)
+        {
+            this.To = to;
+        }
+        public void SetVari(decimal vari)
+        {
+            this.Vari = vari;
+        }
+
     }
 }
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs
index 9005377..5afbcbf 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs
@@ -30,10 +30,10 @@ namespace Leuze.Modules.Goal.Domain.Domains
         public Guid GoalDefinitionId { get; private set; }
         public DomainUser Creator { get; private set; }
         public Guid CreatorId { get; private set; }
-        public string Name { get; set; }
-        public string Description { get; set; }
-        public decimal PercentileUser { get; set; }
-        public decimal PercentileFinal { get; set; }
+        public string Name { get; private set; }
+        public string Description { get; private set; }
+        public decimal PercentileUser { get; private set; }
+        public decimal PercentileFinal { get; private set; }
 
         private List<Comment> _comments { get; set; }
         public IReadOnlyList<Comment> Comments => _comments.AsReadOnly();
@@ -43,5 +43,23 @@ namespace Leuze.Modules.Goal.Domain.Domains
 
         private List<Review> _reviews { get; set; }
         public IReadOnlyList<Review> Reviews => _reviews.AsReadOnly();
+
+        public void SetName(string name)
+        {
+            this.Name = name;
+        }
+        public void SetDescription(string desc)
+        {
+            this.Description = desc;
+        }
+        public void SetPercentileUser(decimal perc)
+        {
+            this.PercentileUser = perc;
+        }
+        public void SetPercentileFinal(decimal perc)
+        {
+            this.PercentileFinal = perc;
+        }
+
     }
 }
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
index b04d64f..2143c69 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs
@@ -55,7 +55,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             Comment item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.Text = text;
+            item.SetText(text);
             item.IsChanged = true;
             await storageContext.SaveChangesAsync();
             return true;
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs
index c9ab98a..903a8d2 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs
@@ -40,12 +40,12 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId)
         {
-            return dbSet.Where(item => item.OwnerId == userId).ToList(); //TODO: await??
+            return await dbSet.Where(item => item.OwnerId == userId).ToListAsync();
         }
 
         public async Task<List<GoalDefinition>> GetAllAsync()
         {
-            return dbSet.ToList(); //TODO: Await??
+            return await dbSet.ToListAsync();
         }
 
         public async Task<GoalDefinition> GetByIdAsync(Guid id)
@@ -58,7 +58,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalDefinition item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.Vari = vari;
+            item.SetVari(vari);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -67,7 +67,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalDefinition item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.From = from;
+            item.SetFrom(from);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -76,7 +76,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalDefinition item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.To = to;
+            item.SetTo(to);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -85,7 +85,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalDefinition item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.Name = name;
+            item.SetName(name);
             await storageContext.SaveChangesAsync();
             return true;
         }
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs
index 4089531..63c8963 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs
@@ -54,7 +54,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalItem item = await dbSet.FindAsync(id);
             if(item == null) return false;
-            item.Name = name;
+            item.SetName(name);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -63,7 +63,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalItem item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.Description = description;
+            item.SetDescription(description);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -72,7 +72,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalItem item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.PercentileUser = percentile;
+            item.SetPercentileUser(percentile);
             await storageContext.SaveChangesAsync();
             return true;
         }
@@ -81,7 +81,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
             GoalItem item = await dbSet.FindAsync(id);
             if (item == null) return false;
-            item.PercentileFinal = percentile;
+            item.SetPercentileFinal(percentile);
             await storageContext.SaveChangesAsync();
             return true;
         }
