commit 6013887a842dc74e2614ec7119759aa29decdef7
Author: Milan Hotovec <silent@students.zcu.cz>
Date:   Tue May 11 10:09:09 2021 +0200

    Repo OK

diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Commands/CreateGoalDefinition.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Commands/CreateGoalDefinition.cs
new file mode 100644
index 0000000..0b10f56
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Commands/CreateGoalDefinition.cs
@@ -0,0 +1,60 @@
+﻿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.Goals.Commands
+{
+    public static class CreateGoalDefinition
+    {
+        public record Command(Guid GoalDefinitionId, string Name, string Description) : IBaseRequest<Response>;
+
+        public record Response(GoalItem item);
+
+
+        public class Handler : IBaseRequestHandler<Command, Response>
+        {
+            private readonly IGoalItemRepository _goalItemRepo;
+            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
+
+            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
+            {
+                _goalItemRepo = goalItemRepo;
+                _goalDefinitionRepo = goalDefinitionRepo;
+                _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 user = await _domainUserRepo.GetByIdAsync(id);
+                var goalDef = await _goalDefinitionRepo.GetByIdAsync(request.GoalDefinitionId);
+
+                if(goalDef == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal definition with id: {request.GoalDefinitionId} not found!");
+                }
+
+                GoalItem item = new(goalDef, user, request.Name, request.Description);
+
+                await _goalItemRepo.AddAsync(item);
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(item));
+            }
+        }
+
+    }
+}
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetGoalDefinitionById.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetGoalDefinitionById.cs
new file mode 100644
index 0000000..0c289f7
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetGoalDefinitionById.cs
@@ -0,0 +1,60 @@
+﻿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.Goals.Commands
+{
+    public static class GetGoalDefinitionById
+    {
+        public record Command(Guid GoalDefinitionId, string Name, string Description) : IBaseRequest<Response>;
+
+        public record Response(GoalItem item);
+
+
+        public class Handler : IBaseRequestHandler<Command, Response>
+        {
+            private readonly IGoalItemRepository _goalItemRepo;
+            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
+
+            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
+            {
+                _goalItemRepo = goalItemRepo;
+                _goalDefinitionRepo = goalDefinitionRepo;
+                _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 user = await _domainUserRepo.GetByIdAsync(id);
+                var goalDef = await _goalDefinitionRepo.GetByIdAsync(request.GoalDefinitionId);
+
+                if(goalDef == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal definition with id: {request.GoalDefinitionId} not found!");
+                }
+
+                GoalItem item = new(goalDef, user, request.Name, request.Description);
+
+                await _goalItemRepo.AddAsync(item);
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(item));
+            }
+        }
+
+    }
+}
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 15fd37f..e13346d 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
@@ -1,10 +1,12 @@
 ﻿using Leuze.Core.Application.CQRS;
-using Leuze.Core.Domain.Domains.Users.Services.Abstractions;
+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;
@@ -22,19 +24,22 @@ namespace Leuze.Modules.Goal.Application.CQRS.Goals.Commands
         {
             private readonly IGoalItemRepository _goalItemRepo;
             private readonly IGoalDefinitionRepository _goalDefinitionRepo;
-            private readonly IDomainUserProvider _domainUserProvider;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
 
-            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, IDomainUserProvider domainuserProvider)
+            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
             {
                 _goalItemRepo = goalItemRepo;
                 _goalDefinitionRepo = goalDefinitionRepo;
-                _domainUserProvider = domainuserProvider;
+                _authenticationStateProvider = authStateProvider;
+                _domainUserRepo = domainUserRepo;
             }
 
             public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken)
             {
-                //TODO: user muze byt null, ale to my nechceme!!!
-                var user = await _domainUserProvider.GetCurrentUserAsync();
+                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
+                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
+                var user = await _domainUserRepo.GetByIdAsync(id);
                 var goalDef = await _goalDefinitionRepo.GetByIdAsync(request.GoalDefinitionId);
 
                 if(goalDef == null)
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalById.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalById.cs
new file mode 100644
index 0000000..8866757
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalById.cs
@@ -0,0 +1,60 @@
+﻿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.Goals.Commands
+{
+    public static class GetGoalById
+    {
+        public record Command(Guid GoalDefinitionId, string Name, string Description) : IBaseRequest<Response>;
+
+        public record Response(GoalItem item);
+
+
+        public class Handler : IBaseRequestHandler<Command, Response>
+        {
+            private readonly IGoalItemRepository _goalItemRepo;
+            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepo;
+
+            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
+            {
+                _goalItemRepo = goalItemRepo;
+                _goalDefinitionRepo = goalDefinitionRepo;
+                _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 user = await _domainUserRepo.GetByIdAsync(id);
+                var goalDef = await _goalDefinitionRepo.GetByIdAsync(request.GoalDefinitionId);
+
+                if(goalDef == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal definition with id: {request.GoalDefinitionId} not found!");
+                }
+
+                GoalItem item = new(goalDef, user, request.Name, request.Description);
+
+                await _goalItemRepo.AddAsync(item);
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(item));
+            }
+        }
+
+    }
+}
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 1021865..96f872f 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,8 @@ 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; private set; }
+        public string Text { get; set; }
         public bool IsPrivate { get; private set; }
-        public bool IsChanged { get; private set; }
+        public bool IsChanged { get; set; }
     }
 }
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 68c456c..5cc9510 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,12 +32,12 @@ 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; private set; }
-        public DateTime From { get; private set; }
-        public DateTime To { get; private set; }
+        public string Name { get; set; }
+        public DateTime From { get; set; }
+        public DateTime To { get; set; }
         public bool OwnerLocked { get; private set; }
         public bool SupervisorLocked { get; private set; }
-        public decimal? Vari { get; private set; }
+        public decimal? Vari { get; set; }
 
         private List<GoalItem> _goals { get; set; }
         public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly();
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 2d2c078..9005377 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; private set; }
-        public string Description { get; private set; }
-        public int PercentileUser { get; private set; }
-        public int PercentileFinal { get; private set; }
+        public string Name { get; set; }
+        public string Description { get; set; }
+        public decimal PercentileUser { get; set; }
+        public decimal PercentileFinal { get; set; }
 
         private List<Comment> _comments { get; set; }
         public IReadOnlyList<Comment> Comments => _comments.AsReadOnly();
diff --git a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IReviewRepository.cs b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IReviewRepository.cs
index 008cf15..539b9d5 100644
--- a/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IReviewRepository.cs
+++ b/src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Repositories/IReviewRepository.cs
@@ -16,7 +16,7 @@ namespace Leuze.Modules.Goal.Domain.Repositories
 
         Task<Review> GetByIdAsync(Guid id);
 
-        Task<List<Review>> GetAllForGoalAsync(Guid definitionId);
+        Task<List<Review>> GetAllForGoalAsync(Guid goalId);
 
         Task<List<Review>> GetAllAsync();
     }
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 fe7e0aa..b04d64f 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
@@ -16,5 +16,49 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         public CommentRepository(IStorageContext context, IMapper mapper) : base(context, mapper)
         {
         }
+
+        public async Task<bool> AddAsync(Comment comment)
+        {
+            await dbSet.AddAsync(comment);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            Comment item = await GetByIdAsync(id);
+            if (item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<Comment> GetByIdAsync(Guid id)
+        {
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<List<Comment>> GetAllForGoalAsync(Guid goalId)
+        {
+            return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
+        }
+
+        public async Task<List<Comment>> GetAllAsync()
+        {
+            return dbSet.ToList(); //TODO: Await??
+        }
+
+        public async Task<bool> EditAsync(Guid id, string text)
+        {
+            Comment item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.Text = 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 4f599fe..c9ab98a 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
@@ -19,9 +19,75 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         {
         }
 
+        public async Task<bool> AddAsync(GoalDefinition gd)
+        {
+            await dbSet.AddAsync(gd);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            GoalDefinition item = await GetByIdAsync(id);
+            if (item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId)
+        {
+            return dbSet.Where(item => item.OwnerId == userId).ToList(); //TODO: await??
+        }
+
+        public async Task<List<GoalDefinition>> GetAllAsync()
+        {
+            return dbSet.ToList(); //TODO: Await??
+        }
+
         public async Task<GoalDefinition> GetByIdAsync(Guid id)
         {
-            return await dbSet.Where(item => item.Id == id).SingleOrDefaultAsync();
+            //return await dbSet.Where(item => item.Id == id).SingleOrDefaultAsync();
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<bool> SetVariAsync(Guid id, decimal vari)
+        {
+            GoalDefinition item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.Vari = vari;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetFromAsync(Guid id, DateTime from)
+        {
+            GoalDefinition item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.From = from;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetToAsync(Guid id, DateTime to)
+        {
+            GoalDefinition item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.To = to;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetNameAsync(Guid id, string name)
+        {
+            GoalDefinition item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.Name = 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 a4add8c..4089531 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
@@ -22,5 +22,73 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
             await dbSet.AddAsync(item);
             await storageContext.SaveChangesAsync();
         }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            GoalItem item = await GetByIdAsync(id);
+            if(item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<GoalItem> GetByIdAsync(Guid id)
+        {
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<List<GoalItem>> GetAllForUserDefinitionAsync(Guid definitionId)
+        {
+            return dbSet.Where(item => item.GoalDefinitionId == definitionId).ToList(); //TODO: await??
+        }
+
+        public async Task<List<GoalItem>> GetAllAsync()
+        {
+            return dbSet.ToList(); //TODO: Await??
+        }
+
+        public async Task<bool> SetNameAsync(Guid id, string name)
+        {
+            GoalItem item = await dbSet.FindAsync(id);
+            if(item == null) return false;
+            item.Name = name;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetDescriptionAsync(Guid id, string description)
+        {
+            GoalItem item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.Description = description;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetPercentileUserAsync(Guid id, decimal percentile)
+        {
+            GoalItem item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.PercentileUser = percentile;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetPercentileFinalAsync(Guid id, decimal percentile)
+        {
+            GoalItem item = await dbSet.FindAsync(id);
+            if (item == null) return false;
+            item.PercentileFinal = percentile;
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> SetGoalDefinitionAsync(Guid id, Guid definitionId)
+        {
+            return false; //TODO: Not needed now, hope not
+        }
     }
 }
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 8737c34..0914602 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
@@ -16,5 +16,39 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         public GoalUpdateRepository(IStorageContext context, IMapper mapper) : base(context, mapper)
         {
         }
+
+        public async Task<bool> AddAsync(GoalUpdate update)
+        {
+            await dbSet.AddAsync(update);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            GoalUpdate item = await GetByIdAsync(id);
+            if (item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<GoalUpdate> GetByIdAsync(Guid id)
+        {
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<List<GoalUpdate>> GetAllForGoalAsync(Guid goalId)
+        {
+            return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
+        }
+
+        public async Task<List<GoalUpdate>> GetAllAsync()
+        {
+            return dbSet.ToList(); //TODO: Await??
+        }
     }
 }
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/ReviewRepository.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/ReviewRepository.cs
index 1257ccd..da63e22 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/ReviewRepository.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/ReviewRepository.cs
@@ -16,5 +16,39 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
         public ReviewRepository(IStorageContext context, IMapper mapper) : base(context, mapper)
         {
         }
+
+        public async Task<bool> AddAsync(Review review)
+        {
+            await dbSet.AddAsync(review);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<bool> RemoveAsync(Guid id)
+        {
+            Review item = await GetByIdAsync(id);
+            if (item == null)
+            {
+                return false;
+            }
+            dbSet.Remove(item);
+            await storageContext.SaveChangesAsync();
+            return true;
+        }
+
+        public async Task<Review> GetByIdAsync(Guid id)
+        {
+            return await dbSet.FindAsync(id);
+        }
+
+        public async Task<List<Review>> GetAllForGoalAsync(Guid goalId)
+        {
+            return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
+        }
+
+        public async Task<List<Review>> GetAllAsync()
+        {
+            return dbSet.ToList(); //TODO: Await??
+        }
     }
 }
