commit 2bf6ed3973eb1569901a1ec68cb74188a0cc69cb
Author: Silentkiller159 <milanhotovec@seznam.cz>
Date:   Tue Jun 1 21:46:18 2021 +0200

    Comments logic connected

diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
index 0f7714a..8836892 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
@@ -31,52 +31,48 @@
             <button @onclick="EditGoal">Uložit změny</button>
         </div>
         <div class="goal_communication_area">
-            <div class="goal_communication_item">
-                Dominik Chlouba vytvořil tento cíl. <span class="date">3. 5. 2021</span>
-            </div>
-            <div class="goal_communication_item">
-                <div class="item_tool">
-                    <div>Dominik Chlouba přidal komentář. <span class="date">3. 5. 2021</span></div>
-                    <div>
-                        <div class="action_buttons" style="display: none">
-                            <i class="fal fa-edit"></i>
-                            <i class="fal fa-trash"></i>
-                        </div>
-                        <div class="action_buttons" style="display: block">
-                            <i class="green fal fa-check"></i>
-                            <i class="red fal fa-times"></i>
+            @foreach (var comment in Comments)
+            {
+                if (comment.IsSystem)
+                {
+                    <div class="goal_communication_item">
+                        System: Uživatel @comment.Creator.Name.FullName @comment.type.GetStringValue() z @comment.OldText na @comment.Text <span class="date">@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
+                    </div>
+                }
+                else
+                {
+                    <div class="goal_communication_item">
+                        <div class="item_tool">
+                            <div>
+                                @comment.Creator.Name.FullName: @comment.Text <span class="date">>@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
+                            </div>
+                            <div>
+                                <div class="action_buttons" style="display: none">
+                                    <i class="fal fa-edit"></i>
+                                    <i class="fal fa-trash"></i>
+                                </div>
+                                <div class="action_buttons" style="display: block">
+                                    <i class="green fal fa-check"></i>
+                                    <i class="red fal fa-times"></i>
+                                </div>
+                            </div>
                         </div>
+                        <textarea class="comment-textarea noedit"
+                                  oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
+                                  placeholder="Upravte komentář"></textarea>
                     </div>
-                </div>
-                <textarea class="comment-textarea noedit"
-                          oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
-                          placeholder="Upravte komentář"></textarea>
-            </div>
-            <div class="goal_communication_item">
-                Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span>
-            </div>
-            <div class="goal_communication_item">
-                Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span>
-            </div>
-            <div class="goal_communication_item">
-                Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span>
-            </div>
-            <div class="goal_communication_item">
-                Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span>
-            </div>
-            <div class="goal_communication_item">
-                Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span>
-            </div>
+                }
+            }
         </div>
     </div>
     <div class="goal_detail_footer">
-        <textarea placeholder="Přidat soukromý či veřejný komentář"></textarea>
+        <textarea placeholder="Přidat soukromý či veřejný komentář" @bind="CommentText"></textarea>
         <div class="goal_comment_tools">
-            <select>
-                <option value="private">Soukromý</option>
+            <select @bind="CommentVisibility">
                 <option value="public">Veřejný</option>
+                <option value="private">Soukromý</option>
             </select>
-            <button>Přidat komentář</button>
+            <button @onclick="SendComment">Přidat komentář</button>
         </div>
     </div>
 </aside>
@@ -334,6 +330,11 @@
 
     public string Description { get; set; } = "";
 
+    private string CommentText { get; set; } = "";
+
+    private string CommentVisibility { get; set; } = "public";
+
+
 
     private Guid _detailId;
     [Parameter]
@@ -350,6 +351,8 @@
     [Parameter]
     public GoalItem DetailItem { get; set; } = GoalItem.Default();
 
+    private List<CommentGenericDto> Comments { get; set; } = new List<CommentGenericDto>();
+
     [Parameter]
     public EventCallback CloseAside { get; set; }
 
@@ -369,6 +372,13 @@
             Name = DetailItem.Name;
             Description = DetailItem.Description;
         }
+
+        var response2 = await _mediator.Send(new GetAllForGoal.Query(DetailId));
+
+        if (response2.IsSuccess)
+        {
+            Comments = response2.Result.list;
+        }
     }
 
     private async Task EditGoal()
@@ -378,10 +388,23 @@
         if (response.IsSuccess)
         {
             toastService.ShowSuccess("Cíl úspěšně editován");
+            await GetDetails(); //Refresh
         }
         else toastService.ShowError($"Cíl se nepodařilo editovat {response.Errors.FirstOrDefault() ?? ""}");
     }
 
+    private async Task SendComment()
+    {
+        var response = await _mediator.Send(new AddCommentToGoal.Command(DetailId, CommentText, CommentVisibility != "public"));
+
+        if (response.IsSuccess)
+        {
+            //toastService.ShowSuccess("Komentář úspěšně přidán");
+            await GetDetails(); //Refresh
+        }
+        else toastService.ShowError($"Komentář se nepodařil opřidat {response.Errors.FirstOrDefault() ?? ""}");
+    }
+
     private async Task Close()
     {
         //ResetValues();
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor
index 3e2a454..42383d1 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor
@@ -30,6 +30,9 @@
 @using Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Commands
 @using Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Commands
 @using Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Queries
+@using Leuze.Modules.Goal.Application.CQRS.Comments.Commands
+@using Leuze.Modules.Goal.Application.CQRS.Comments.Queries
 @using Leuze.Modules.Goal.Domain.Domains
+@using Leuze.Modules.Goal.Domain.Domains.DTOs
 @using Microsoft.Extensions.Localization
 @using Microsoft.AspNetCore.Localization
\ No newline at end of file
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Commands/AddCommentToGoal.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Commands/AddCommentToGoal.cs
new file mode 100644
index 0000000..db4ce6c
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Commands/AddCommentToGoal.cs
@@ -0,0 +1,67 @@
+﻿using Leuze.Core.Application.CQRS;
+using Leuze.Core.Domain.Repositories;
+using Leuze.Modules.Goal.Domain.Domains;
+using Leuze.Modules.Goal.Domain.Repositories;
+using Microsoft.AspNetCore.Components.Authorization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Claims;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Leuze.Modules.Goal.Application.CQRS.Comments.Commands
+{
+    public static class AddCommentToGoal
+    {
+        public record Command(Guid goalId, string text, bool isPrivate) : IBaseRequest<Response>;
+
+        public record Response();
+
+
+        public class Handler : IBaseRequestHandler<Command, Response>
+        {
+            private readonly ICommentRepository _commentRepo;
+            private readonly IGoalItemRepository _goalItemRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
+
+            public Handler(ICommentRepository commentRepo, IGoalItemRepository goalItemRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
+            {
+                _commentRepo = commentRepo;
+                _goalItemRepo = goalItemRepo;
+                _authenticationStateProvider = authStateProvider;
+                _domainUserRepo = domainUserRepo;
+            }
+
+            public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken)
+            {
+                //TODO: user muze byt null, ale to my nechceme!!!
+                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
+                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
+                var creator = await _domainUserRepo.GetByIdAsync(id);
+                var goal = await _goalItemRepo.GetByIdAsync(request.goalId);
+
+                if (creator == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Creator user with id: {id} not found!");
+                }
+                if (goal == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal with id: {request.goalId} not found!");
+                }
+                if (string.IsNullOrWhiteSpace(request.text))
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Comment text is empty!");
+                }
+
+                var comment = new Comment(creator, goal, request.text, request.isPrivate);
+
+                await _commentRepo.AddAsync(comment);
+
+                return RequestResponse<Response>.CreateSuccessResponse(new());
+            }
+        }
+    }
+}
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Queries/GetAllForGoal.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Queries/GetAllForGoal.cs
new file mode 100644
index 0000000..d9ce74a
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Queries/GetAllForGoal.cs
@@ -0,0 +1,78 @@
+﻿using Leuze.Core.Application.CQRS;
+using Leuze.Core.Domain.Repositories;
+using Leuze.Modules.Goal.Domain.Domains;
+using Leuze.Modules.Goal.Domain.Domains.DTOs;
+using Leuze.Modules.Goal.Domain.Repositories;
+using Microsoft.AspNetCore.Components.Authorization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Claims;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Leuze.Modules.Goal.Application.CQRS.Comments.Queries
+{
+    public static class GetAllForGoal
+    {
+        public record Query(Guid goalId) : IBaseRequest<Response>;
+
+        public record Response(List<CommentGenericDto> list);
+
+
+        public class Handler : IBaseRequestHandler<Query, Response>
+        {
+            private readonly IGoalUpdateRepository _goalUpdateRepo;
+            private readonly ICommentRepository _commentRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
+
+            public Handler(IDomainUserRepository domainUserRepo, AuthenticationStateProvider authStateProvider, ICommentRepository commentRepo, IGoalUpdateRepository goalUpdateRepo)
+            {
+                _goalUpdateRepo = goalUpdateRepo;
+                _commentRepo = commentRepo;
+                _domainUserRepo = domainUserRepo;
+                _authenticationStateProvider = authStateProvider;
+            }
+
+            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
+            {
+                //TODO Predelat kvuli testum?
+                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
+                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
+                var userShortDto = await _domainUserRepo.GetDtoByIdAsync(id);
+
+                if (userShortDto == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst komentáře pro uživatele: {id}!");
+                }
+
+                var comments = await _commentRepo.GetAllForGoalAsync(request.goalId);
+
+                if (comments == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst komentáře pro cíl: {request.goalId}!");
+                }
+
+                comments = comments.Where(o => (o.IsPrivate == false || (o.CreatorId == id))).ToList();
+
+                var updates = await _goalUpdateRepo.GetAllForGoalAsync(request.goalId);
+
+                if (updates == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst změny pro cíl: {request.goalId}!");
+                }
+
+                var genericComments = new List<CommentGenericDto>();
+                comments.ForEach(o => genericComments.Add(new CommentGenericDto(o.Id, o.CreatedAt, o.Creator, o.Text, "", false, o.IsPrivate, o.IsChanged, UpdateType.None)));
+                updates.ForEach(o => genericComments.Add(new CommentGenericDto(o.Id, o.CreatedAt, o.Creator, o.NewValue, o.OldValue, true, false, true, o.UpdatedType)));
+
+
+                genericComments = genericComments.OrderBy(o => o.CreatedAt).ToList();
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(genericComments));
+            }
+        }
+    }
+}
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/CreateGoal.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/CreateGoal.cs
index b94bcb6..5994a42 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/CreateGoal.cs
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/CreateGoal.cs
@@ -22,14 +22,16 @@ namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands
 
         public class Handler : IBaseRequestHandler<Command, Response>
         {
+            private readonly IGoalUpdateRepository _goalUpdateRepo;
             private readonly IGoalItemRepository _goalItemRepo;
             private readonly IGoalDefinitionRepository _goalDefinitionRepo;
             private readonly AuthenticationStateProvider _authenticationStateProvider;
             private readonly IDomainUserRepository _domainUserRepository;
 
-            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, 
+            public Handler(IGoalUpdateRepository goalUpdateRepo, IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, 
                 AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
             {
+                _goalUpdateRepo = goalUpdateRepo;
                 _goalItemRepo = goalItemRepo;
                 _goalDefinitionRepo = goalDefinitionRepo;
                 _authenticationStateProvider = authenticationStateProvider;
@@ -50,9 +52,17 @@ namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands
                 }
 
                 GoalItem item = new(goalDef, user, request.Name, request.Description);
-
                 await _goalItemRepo.AddAsync(item);
 
+                GoalUpdate update = new(user, item, UpdateType.Name, "", item.Name);
+                await _goalUpdateRepo.AddAsync(update);
+
+                if (!string.IsNullOrWhiteSpace(item.Description))
+                {
+                    GoalUpdate descUpdate = new(user, item, UpdateType.Description, "", item.Description);
+                    await _goalUpdateRepo.AddAsync(descUpdate);
+                }
+
                 return RequestResponse<Response>.CreateSuccessResponse(new(item));
             }
         }
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs
index 2479c9c..b698193 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs
@@ -23,15 +23,15 @@ namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands
         public class Handler : IBaseRequestHandler<Command, Response>
         {
             private readonly IGoalItemRepository _goalItemRepo;
-            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
+            private readonly IGoalUpdateRepository _goalUpdateRepo;
             private readonly AuthenticationStateProvider _authenticationStateProvider;
             private readonly IDomainUserRepository _domainUserRepository;
 
-            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, 
+            public Handler(IGoalItemRepository goalItemRepo, IGoalUpdateRepository goalUpdateRepo, 
                 AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
             {
                 _goalItemRepo = goalItemRepo;
-                _goalDefinitionRepo = goalDefinitionRepo;
+                _goalUpdateRepo = goalUpdateRepo;
                 _authenticationStateProvider = authenticationStateProvider;
                 _domainUserRepository = domainUserRepository;
             }
@@ -55,10 +55,33 @@ namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands
                     return RequestResponse<Response>.CreateErrorResponse($"Nelze změnit název cíle");
                 }
 
-                await _goalItemRepo.SetNameAsync(request.goalId, request.name);
-                await _goalItemRepo.SetDescriptionAsync(request.goalId, request.description);
+                bool sendState = false;
+                if (goal.Name != request.name)
+                {
+                    GoalUpdate nameUpdate = new(user, goal, UpdateType.Name, goal.Name, request.name);
+
+                    await _goalItemRepo.SetNameAsync(request.goalId, request.name);
+                    await _goalUpdateRepo.AddAsync(nameUpdate);
+
+                    sendState = true;
+                }
+
+                if (goal.Description != request.description)
+                {
+                    GoalUpdate descUpdate = new(user, goal, UpdateType.Description, goal.Description, request.description);
+
+                    await _goalItemRepo.SetDescriptionAsync(request.goalId, request.description);
+                    await _goalUpdateRepo.AddAsync(descUpdate);
+
+                    sendState = true;
+                }
+
+                if (sendState)
+                {
+                    return RequestResponse<Response>.CreateSuccessResponse(new());
+                }
 
-                return RequestResponse<Response>.CreateSuccessResponse(new());
+                return RequestResponse<Response>.CreateErrorResponse($"Nic se nezměnilo!");
             }
         }
 
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 f374c63..905d03e 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
@@ -24,8 +24,6 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Folder Include="CQRS\Comments\Commands\" />
-    <Folder Include="CQRS\Comments\Queries\" />
     <Folder Include="CQRS\Reviews\Commands\" />
     <Folder Include="CQRS\Reviews\Queries\" />
   </ItemGroup>
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericConvertor.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericConvertor.cs
new file mode 100644
index 0000000..711313d
--- /dev/null
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericConvertor.cs
@@ -0,0 +1,28 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Leuze.Modules.Goal.Domain.Domains.DTOs
+{
+    public static class CommentGenericConvertor
+    {
+        public static string GetStringValue(this UpdateType type)
+        {
+            switch (type)
+            {
+                case UpdateType.Name:
+                    return "UpdatedName";
+                case UpdateType.Description:
+                    return "UpdatedDescription";
+                case UpdateType.PercentileUser:
+                    return "UpdatedPercentileUser";
+                case UpdateType.PercentileFinal:
+                    return "UpdatedPercentileFinal";
+                default:
+                    return "NOT IMPLEMENTED";
+            }
+        }
+    }
+}
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericDto.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericDto.cs
new file mode 100644
index 0000000..71900b4
--- /dev/null
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericDto.cs
@@ -0,0 +1,11 @@
+﻿using Leuze.Core.Domain.Domains.Users;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Leuze.Modules.Goal.Domain.Domains.DTOs
+{
+    public record CommentGenericDto(Guid Id, DateTime CreatedAt, DomainUser Creator, string Text, string OldText, bool IsSystem, bool IsPrivate, bool IsChanged, UpdateType type);
+}
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/UpdateType.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/UpdateType.cs
index 0c50e76..577beea 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/UpdateType.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/UpdateType.cs
@@ -8,6 +8,6 @@ namespace Leuze.Modules.Goal.Domain.Domains
 {
     public enum UpdateType
     {
-        Name, Description, PercentileUser, PercentileFinal
+        Name, Description, PercentileUser, PercentileFinal, None
     }
 }
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 9251605..dee96da 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
@@ -44,7 +44,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<Comment>> GetAllForGoalAsync(Guid goalId)
         {
-            return await dbSet.Where(item => item.GoalId == goalId).ToListAsync();
+            return await dbSet.Where(item => item.GoalId == goalId).Include(o => o.Creator).ToListAsync();
         }
 
         public async Task<List<Comment>> GetAllAsync()
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalUpdateRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalUpdateRepository.cs
index dc68597..29c34fe 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalUpdateRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalUpdateRepository.cs
@@ -3,6 +3,7 @@ using ExtCore.Data.Abstractions;
 using Leuze.Core.Infrastructure.Persistence;
 using Leuze.Modules.Goal.Domain.Domains;
 using Leuze.Modules.Goal.Domain.Repositories;
+using Microsoft.EntityFrameworkCore;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -43,7 +44,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<GoalUpdate>> GetAllForGoalAsync(Guid goalId)
         {
-            return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
+            return await dbSet.Where(item => item.GoalId == goalId).Include(o => o.Creator).ToListAsync();
         }
 
         public async Task<List<GoalUpdate>> GetAllAsync()
