commit 240d2e5be1e2de6598f15b6402a3556878a1a99a
Author: Milan Hotovec <silent@students.zcu.cz>
Date:   Tue May 11 19:08:20 2021 +0200

    Goals initial connected

diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.Designer.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.Designer.cs
new file mode 100644
index 0000000..c1e5968
--- /dev/null
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.Designer.cs
@@ -0,0 +1,698 @@
+﻿// <auto-generated />
+using System;
+using Leuze.Core.Infrastructure.Persistence;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace Leuze.Core.Infrastructure.Persistence.Migrations
+{
+    [DbContext(typeof(LeuzeDbContext))]
+    [Migration("20210511102009_EditPercentile")]
+    partial class EditPercentile
+    {
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("Relational:MaxIdentifierLength", 128)
+                .HasAnnotation("ProductVersion", "5.0.4")
+                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+            modelBuilder.Entity("ApplicationPermissionApplicationRole", b =>
+                {
+                    b.Property<Guid>("PermissionsId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("RolesId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("PermissionsId", "RolesId");
+
+                    b.HasIndex("RolesId");
+
+                    b.ToTable("Leuze_Roles_Assigned_Permissions");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationPermission", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("Module")
+                        .IsRequired()
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(512)
+                        .HasColumnType("nvarchar(512)");
+
+                    b.Property<string>("Privilege")
+                        .IsRequired()
+                        .HasMaxLength(2048)
+                        .HasColumnType("nvarchar(2048)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Leuze_Application_Permissions");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRole", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("IsDefault")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NormalizedName")
+                        .IsUnique()
+                        .HasDatabaseName("RoleNameIndex")
+                        .HasFilter("[NormalizedName] IS NOT NULL");
+
+                    b.ToTable("Leuze_Roles");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRoleClaim", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<Guid>("RoleId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetRoleClaims");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUser", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<int>("AccessFailedCount")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Email")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("EmailConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsAdUser")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("LockoutEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<DateTimeOffset?>("LockoutEnd")
+                        .HasColumnType("datetimeoffset");
+
+                    b.Property<string>("NormalizedEmail")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedUserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("PasswordHash")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("PhoneNumber")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("PhoneNumberConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("SecurityStamp")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("TwoFactorEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("UserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NormalizedEmail")
+                        .HasDatabaseName("EmailIndex");
+
+                    b.HasIndex("NormalizedUserName")
+                        .IsUnique()
+                        .HasDatabaseName("UserNameIndex")
+                        .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+                    b.ToTable("Leuze_Users");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserClaim", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int")
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserClaims");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserLogin", b =>
+                {
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderKey")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderDisplayName")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("LoginProvider", "ProviderKey");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserLogins");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserRole", b =>
+                {
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("RoleId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("UserId", "RoleId");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetUserRoles");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserToken", b =>
+                {
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Name")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Value")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("UserId", "LoginProvider", "Name");
+
+                    b.ToTable("AspNetUserTokens");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
+                {
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid?>("SeniorUserId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.HasKey("UserId");
+
+                    b.HasIndex("SeniorUserId");
+
+                    b.ToTable("Leuze_Domain_Users");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Comment", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("CreatorId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("GoalId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<bool>("IsChanged")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsPrivate")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Text")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CreatorId");
+
+                    b.HasIndex("GoalId");
+
+                    b.ToTable("Leuze_Modules_Goal_Domain_Comments");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("CreatorId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<DateTime>("From")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.Property<Guid>("OwnerId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<bool>("OwnerLocked")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("SupervisorLocked")
+                        .HasColumnType("bit");
+
+                    b.Property<DateTime>("To")
+                        .HasColumnType("datetime2");
+
+                    b.Property<decimal?>("Vari")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CreatorId");
+
+                    b.HasIndex("OwnerId");
+
+                    b.ToTable("Leuze_Modules_Goal_Domain_GoalDefinitions");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("CreatorId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("Description")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<Guid>("GoalDefinitionId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(255)
+                        .HasColumnType("nvarchar(255)");
+
+                    b.Property<decimal>("PercentileFinal")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<decimal>("PercentileUser")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CreatorId");
+
+                    b.HasIndex("GoalDefinitionId");
+
+                    b.ToTable("Leuze_Modules_Goal_Domain_GoalItems");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalUpdate", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("CreatorId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("GoalId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("NewValue")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("OldValue")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("UpdatedType")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CreatorId");
+
+                    b.HasIndex("GoalId");
+
+                    b.ToTable("Leuze_Modules_Goal_Domain_GoalUpdates");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Review", b =>
+                {
+                    b.Property<Guid>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<string>("CommentCreator")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CommentOwner")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<Guid>("CreatorId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<Guid>("GoalId")
+                        .HasColumnType("uniqueidentifier");
+
+                    b.Property<bool>("IsFinal")
+                        .HasColumnType("bit");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("CreatorId");
+
+                    b.HasIndex("GoalId");
+
+                    b.ToTable("Leuze_Modules_Goal_Domain_Reviews");
+                });
+
+            modelBuilder.Entity("ApplicationPermissionApplicationRole", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationPermission", null)
+                        .WithMany()
+                        .HasForeignKey("PermissionsId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RolesId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRoleClaim", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserClaim", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserLogin", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserRole", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", "Role")
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Role");
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserToken", b =>
+                {
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "SeniorUser")
+                        .WithMany("Juniors")
+                        .HasForeignKey("SeniorUserId");
+
+                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
+                        .WithOne()
+                        .HasForeignKey("Leuze.Core.Domain.Domains.Users.DomainUser", "UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.OwnsOne("Leuze.Core.Domain.Domains.Shared.ValueObjects.EmailAddress", "EmailAddress", b1 =>
+                        {
+                            b1.Property<Guid>("DomainUserUserId")
+                                .HasColumnType("uniqueidentifier");
+
+                            b1.Property<string>("Email")
+                                .IsRequired()
+                                .HasMaxLength(512)
+                                .HasColumnType("nvarchar(512)");
+
+                            b1.HasKey("DomainUserUserId");
+
+                            b1.ToTable("Leuze_Domain_Users");
+
+                            b1.WithOwner()
+                                .HasForeignKey("DomainUserUserId");
+                        });
+
+                    b.OwnsOne("Leuze.Core.Domain.Domains.Shared.ValueObjects.PersonFullName", "Name", b1 =>
+                        {
+                            b1.Property<Guid>("DomainUserUserId")
+                                .HasColumnType("uniqueidentifier");
+
+                            b1.Property<string>("FullName")
+                                .IsRequired()
+                                .HasMaxLength(256)
+                                .HasColumnType("nvarchar(256)");
+
+                            b1.HasKey("DomainUserUserId");
+
+                            b1.ToTable("Leuze_Domain_Users");
+
+                            b1.WithOwner()
+                                .HasForeignKey("DomainUserUserId");
+                        });
+
+                    b.Navigation("EmailAddress")
+                        .IsRequired();
+
+                    b.Navigation("Name")
+                        .IsRequired();
+
+                    b.Navigation("SeniorUser");
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Comment", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
+                        .WithMany()
+                        .HasForeignKey("CreatorId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
+                        .WithMany("Comments")
+                        .HasForeignKey("GoalId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Creator");
+
+                    b.Navigation("Goal");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
+                        .WithMany()
+                        .HasForeignKey("CreatorId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Owner")
+                        .WithMany()
+                        .HasForeignKey("OwnerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Creator");
+
+                    b.Navigation("Owner");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
+                        .WithMany()
+                        .HasForeignKey("CreatorId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", "GoalDefinition")
+                        .WithMany("Goals")
+                        .HasForeignKey("GoalDefinitionId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Creator");
+
+                    b.Navigation("GoalDefinition");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalUpdate", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
+                        .WithMany()
+                        .HasForeignKey("CreatorId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
+                        .WithMany("Updates")
+                        .HasForeignKey("GoalId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Creator");
+
+                    b.Navigation("Goal");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Review", b =>
+                {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
+                        .WithMany()
+                        .HasForeignKey("CreatorId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
+                        .WithMany("Reviews")
+                        .HasForeignKey("GoalId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Creator");
+
+                    b.Navigation("Goal");
+                });
+
+            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
+                {
+                    b.Navigation("Juniors");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
+                {
+                    b.Navigation("Goals");
+                });
+
+            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
+                {
+                    b.Navigation("Comments");
+
+                    b.Navigation("Reviews");
+
+                    b.Navigation("Updates");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.cs
new file mode 100644
index 0000000..f13ff8e
--- /dev/null
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.cs
@@ -0,0 +1,88 @@
+﻿using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Leuze.Core.Infrastructure.Persistence.Migrations
+{
+    public partial class EditPercentile : Migration
+    {
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<bool>(
+                name: "IsDefault",
+                table: "Leuze_Roles",
+                type: "bit",
+                nullable: false,
+                defaultValue: false);
+
+            migrationBuilder.AlterColumn<decimal>(
+                name: "PercentileUser",
+                table: "Leuze_Modules_Goal_Domain_GoalItems",
+                type: "decimal(18,2)",
+                nullable: false,
+                oldClrType: typeof(int),
+                oldType: "int");
+
+            migrationBuilder.AlterColumn<decimal>(
+                name: "PercentileFinal",
+                table: "Leuze_Modules_Goal_Domain_GoalItems",
+                type: "decimal(18,2)",
+                nullable: false,
+                oldClrType: typeof(int),
+                oldType: "int");
+
+            migrationBuilder.AddColumn<Guid>(
+                name: "SeniorUserId",
+                table: "Leuze_Domain_Users",
+                type: "uniqueidentifier",
+                nullable: true);
+
+            migrationBuilder.CreateIndex(
+                name: "IX_Leuze_Domain_Users_SeniorUserId",
+                table: "Leuze_Domain_Users",
+                column: "SeniorUserId");
+
+            migrationBuilder.AddForeignKey(
+                name: "FK_Leuze_Domain_Users_Leuze_Domain_Users_SeniorUserId",
+                table: "Leuze_Domain_Users",
+                column: "SeniorUserId",
+                principalTable: "Leuze_Domain_Users",
+                principalColumn: "UserId",
+                onDelete: ReferentialAction.Restrict);
+        }
+
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropForeignKey(
+                name: "FK_Leuze_Domain_Users_Leuze_Domain_Users_SeniorUserId",
+                table: "Leuze_Domain_Users");
+
+            migrationBuilder.DropIndex(
+                name: "IX_Leuze_Domain_Users_SeniorUserId",
+                table: "Leuze_Domain_Users");
+
+            migrationBuilder.DropColumn(
+                name: "IsDefault",
+                table: "Leuze_Roles");
+
+            migrationBuilder.DropColumn(
+                name: "SeniorUserId",
+                table: "Leuze_Domain_Users");
+
+            migrationBuilder.AlterColumn<int>(
+                name: "PercentileUser",
+                table: "Leuze_Modules_Goal_Domain_GoalItems",
+                type: "int",
+                nullable: false,
+                oldClrType: typeof(decimal),
+                oldType: "decimal(18,2)");
+
+            migrationBuilder.AlterColumn<int>(
+                name: "PercentileFinal",
+                table: "Leuze_Modules_Goal_Domain_GoalItems",
+                type: "int",
+                nullable: false,
+                oldClrType: typeof(decimal),
+                oldType: "decimal(18,2)");
+        }
+    }
+}
diff --git a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/LeuzeDbContextModelSnapshot.cs b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/LeuzeDbContextModelSnapshot.cs
index 9a5b476..a277899 100644
--- a/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/LeuzeDbContextModelSnapshot.cs
+++ b/src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/LeuzeDbContextModelSnapshot.cs
@@ -70,6 +70,9 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
                         .IsConcurrencyToken()
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<bool>("IsDefault")
+                        .HasColumnType("bit");
+
                     b.Property<string>("Name")
                         .HasMaxLength(256)
                         .HasColumnType("nvarchar(256)");
@@ -263,8 +266,13 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
                     b.Property<Guid>("UserId")
                         .HasColumnType("uniqueidentifier");
 
+                    b.Property<Guid?>("SeniorUserId")
+                        .HasColumnType("uniqueidentifier");
+
                     b.HasKey("UserId");
 
+                    b.HasIndex("SeniorUserId");
+
                     b.ToTable("Leuze_Domain_Users");
                 });
 
@@ -361,11 +369,11 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
                         .HasMaxLength(255)
                         .HasColumnType("nvarchar(255)");
 
-                    b.Property<int>("PercentileFinal")
-                        .HasColumnType("int");
+                    b.Property<decimal>("PercentileFinal")
+                        .HasColumnType("decimal(18,2)");
 
-                    b.Property<int>("PercentileUser")
-                        .HasColumnType("int");
+                    b.Property<decimal>("PercentileUser")
+                        .HasColumnType("decimal(18,2)");
 
                     b.HasKey("Id");
 
@@ -512,6 +520,10 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
 
             modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
                 {
+                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "SeniorUser")
+                        .WithMany("Juniors")
+                        .HasForeignKey("SeniorUserId");
+
                     b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
                         .WithOne()
                         .HasForeignKey("Leuze.Core.Domain.Domains.Users.DomainUser", "UserId")
@@ -560,6 +572,8 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
                     b.Navigation("Name")
                         .IsRequired();
 
+                    b.Navigation("SeniorUser");
+
                     b.Navigation("User");
                 });
 
@@ -658,6 +672,11 @@ namespace Leuze.Core.Infrastructure.Persistence.Migrations
                     b.Navigation("Goal");
                 });
 
+            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
+                {
+                    b.Navigation("Juniors");
+                });
+
             modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
                 {
                     b.Navigation("Goals");
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateGoalAside.razor b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateGoalAside.razor
index 5f7de01..579dc35 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateGoalAside.razor
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateGoalAside.razor
@@ -1,4 +1,6 @@
-﻿
+﻿@inject IMediator _mediator
+@inject IToastService toastService
+
 <aside class="@_aside review_detail">
     <div class="review_detail_header">
         <div>Vytvořit nový cíl</div>
@@ -10,12 +12,12 @@
     </div>
     <div class="review_detail_body">
         <div class="review_description_title">Název cíle</div>
-        <input type="text" />
+        <input type="text" @bind-value="Name" />
         <div class="review_description_title">Popis cíle</div>
-        <textarea></textarea>
+        <textarea @oninput="(item) => Description = item.Value.ToString()">@Description</textarea>
     </div>
     <div class="review_detail_footer">
-        <button>Vytvořit</button>
+        <button @onclick="Create">Vytvořit</button>
         <button>Zrušit</button>
     </div>
 </aside>
@@ -123,12 +125,36 @@
 
     private string _aside;
 
+    public string Name { get; set; }
+
+    public string Description { get; set; }
+
     [Parameter]
     public bool Show { get; set; } = false;
 
+    [Parameter]
+    public Guid DefinitionId { get; set; } = default;
+
     [Parameter]
     public EventCallback CloseAside { get; set; }
 
+    [Parameter]
+    public EventCallback LoadGoalsInDefinitionView { get; set; }
+
+    private async Task Create()
+    {
+        var response = await _mediator.Send(new CreateGoal.Command(DefinitionId, Name, Description));
+
+        if (response.IsSuccess)
+        {
+            toastService.ShowSuccess("Cíl úspěšně vytvořen");
+            await LoadGoalsInDefinitionView.InvokeAsync();
+        }
+        else toastService.ShowError("Cíl se nepodařilo vytvořit");
+
+        await Close();
+    }
+
     private async Task Close()
     {
         //ResetValues();
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 7926331..e29ced4 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
@@ -1,4 +1,5 @@
-﻿
+﻿@inject IMediator _mediator
+
 <aside class="@_aside goal_detail">
     <div class="goal_detail_header">
         <div>
@@ -22,10 +23,10 @@
     </div>
     <div class="goal_detail_body">
         <div class="goal_detail_area">
-            <input class="goal_name" type="text" placeholder="Zadejte název cíle" />
+            <input class="goal_name" type="text" placeholder="Zadejte název cíle" value="@DetailItem.Name" />
             <div class="goal_description_title">Popis cíle</div>
             <textarea oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
-                      class="goal_description" placeholder="Vyplňte popis cíle"></textarea>
+                      class="goal_description" placeholder="Vyplňte popis cíle">@DetailItem.Description</textarea>
         </div>
         <div class="goal_communication_area">
             <div class="goal_communication_item">
@@ -325,8 +326,20 @@
     [Parameter]
     public bool Show { get; set; } = false;
 
+    private Guid _detailId;
+    [Parameter]
+    public Guid DetailId
+    {
+        get { return _detailId; }
+        set
+        {
+            _detailId = value;
+            GetDetails().Wait();
+        }
+    }
+
     [Parameter]
-    public Guid DetailId { get; set; } = default;
+    public GoalItem DetailItem { get; set; } = GoalItem.Default();
 
     [Parameter]
     public EventCallback CloseAside { get; set; }
@@ -337,6 +350,16 @@
 
     public void CloseReview() => ReviewId = default(Guid);
 
+    private async Task GetDetails()
+    {
+        var response = await _mediator.Send(new GetGoalById.Query(DetailId));
+
+        if (response.IsSuccess)
+        {
+            DetailItem = response.Result.item;
+        }
+    }
+
     private async Task Close()
     {
         //ResetValues();
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor
index fcb75ad..434de4b 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor
@@ -1,4 +1,4 @@
-﻿@page "/goals/detail/{id}"
+﻿@page "/goals/detail/{Id:guid}"
 @attribute [Authorize]
 @layout MainLayout
 @inject IMediator _mediator
@@ -24,7 +24,6 @@
         <tr>
             <th>Název</th>
             <th>Vytvořil</th>
-            <th>Datum vytvoření</th>
             <th>Hodnocení uživatel</th>
             <th>Hodnocení nadřízený</th>
             <th>Akce</th>
@@ -32,15 +31,14 @@
         @foreach (var range in Goals)
         {
             <tr>
-                <td>Název cíle</td>
-                <td>David Vytvořílek</td>
-                <td>3.5.2021</td>
-                <td>80%</td>
-                <td>150%</td>
+                <td>@range.Name</td>
+                <td>@range.Creator.Name</td>
+                <td>@range.PercentileUser</td>
+                <td>@range.PercentileFinal</td>
                 <td>
                     <div class="flex">
                         <div></div>
-                        <div @onclick='() => SetDetailId(Guid.NewGuid())'>
+                        <div @onclick='() => SetDetailId(range.Id)'>
                             <i class="fal fa-eye"></i>
                             Otevřít
                         </div>
@@ -56,7 +54,7 @@ else
 }
 
 <Leuze.Modules.Goal.Application.UI.Pages.Components.GoalDetailAside Show="DetailId != default(Guid)" DetailId="DetailId" CloseAside="CloseDetailAside" />
-<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateGoalAside Show="ShowCreate" CloseAside="CloseCreateAside" />
+<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateGoalAside Show="ShowCreate" DefinitionId="Id" CloseAside="CloseCreateAside" LoadGoalsInDefinitionView="GetGoals" />
 
 <BlazorStyled.Styled>
     .section_header {
@@ -161,9 +159,9 @@ else
 @code {
 
     [Parameter]
-    public string Id { get; set; }
+    public Guid Id { get; set; }
 
-    public List<Guid> Goals { get; set; } = new() { Guid.NewGuid() };
+    public List<GoalItem> Goals { get; set; } = new();
 
     public Guid DetailId { get; set; } = default(Guid);
 
@@ -177,5 +175,21 @@ else
 
     private void CloseCreateAside() => ShowCreate = false;
 
+    private async Task GetGoals()
+    {
+        var response = await _mediator.Send(new GetGoalsForDefinition.Query(Id));
+
+        if (response.IsSuccess)
+        {
+            Goals = response.Result.list;
+        }
+    }
+
+    protected async override Task OnInitializedAsync()
+    {
+        await base.OnInitializedAsync();
+        await GetGoals();
+    }
+
 
 }
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/MyGoalDefinition.razor b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/MyGoalDefinition.razor
index 9a3da18..91f1f40 100644
--- a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/MyGoalDefinition.razor
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/MyGoalDefinition.razor
@@ -18,12 +18,12 @@
         @foreach (var range in Definitions)
         {
             <tr>
-                <td>Název definice</td>
-                <td>David Vytvořílek</td>
+                <td>@range.Name</td>
+                <td>@range.Creator.Name</td>
                 <td>
                     <div class="flex">
                         <div></div>
-                        <div @onclick='() => _nav.NavigateTo("/goals/detail/test")'>
+                        <div @onclick='() => _nav.NavigateTo($"/goals/detail/{range.Id}")'>
                             <i class="fal fa-eye"></i>
                             Otevřít
                         </div>
@@ -113,7 +113,7 @@ else
 
 @code {
 
-    public List<Guid> Definitions { get; set; } = new() { Guid.NewGuid() };
+    public List<GoalDefinition> Definitions { get; set; } = new();
 
     public Guid DetailId { get; set; } = default(Guid);
 
@@ -133,4 +133,20 @@ else
 
     private void CloseCreateAside() => ShowCreate = false;
 
+    private async Task GetMyDefinitions()
+    {
+        var response = await _mediator.Send(new GetMyGoalDefinitions.Query());
+
+        if (response.IsSuccess)
+        {
+            Definitions = response.Result.list;
+        }
+    }
+
+    protected async override Task OnInitializedAsync()
+    {
+        await base.OnInitializedAsync();
+        await GetMyDefinitions();
+    }
+
 }
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 ea3dfaa..8bc45af 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
@@ -23,4 +23,8 @@
 @using Leuze.Core.Application.CQRS.Roles.Queries
 @using Blazored.Toast
 @using Blazored.Toast.Services
-@using Leuze.Core.Domain.Domains.Users
\ No newline at end of file
+@using Leuze.Core.Domain.Domains.Users
+@using Leuze.Modules.Goal.Application.CQRS.Goals.Commands
+@using Leuze.Modules.Goal.Application.CQRS.Goals.Queries
+@using Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Queries
+@using Leuze.Modules.Goal.Domain.Domains
\ No newline at end of file
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetMyGoalDefinitions.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetMyGoalDefinitions.cs
new file mode 100644
index 0000000..eafd62f
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetMyGoalDefinitions.cs
@@ -0,0 +1,52 @@
+﻿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.GoalDefinitions.Queries
+{
+    public static class GetMyGoalDefinitions
+    {
+        public record Query() : IBaseRequest<Response>;
+
+        public record Response(List<GoalDefinition> list);
+
+
+        public class Handler : IBaseRequestHandler<Query, Response>
+        {
+            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepository;
+
+            public Handler(IGoalDefinitionRepository goalDefinitionRepo,
+                AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
+            {
+                _goalDefinitionRepo = goalDefinitionRepo;
+                _authenticationStateProvider = authenticationStateProvider;
+                _domainUserRepository = domainUserRepository;
+            }
+
+            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
+            {
+                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
+                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
+                var goalDefs = await _goalDefinitionRepo.GetAllForUserAsync(id);
+
+                if (goalDefs == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal definitions for user: {id} not found!");
+                }
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(goalDefs));
+            }
+        }
+    }
+}
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
index 8866757..4d81f93 100644
--- 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
@@ -15,44 +15,30 @@ 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 Query(Guid goalId) : IBaseRequest<Response>;
 
         public record Response(GoalItem item);
 
 
-        public class Handler : IBaseRequestHandler<Command, Response>
+        public class Handler : IBaseRequestHandler<Query, 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)
+            public Handler(IGoalItemRepository goalItemRepo)
             {
                 _goalItemRepo = goalItemRepo;
-                _goalDefinitionRepo = goalDefinitionRepo;
-                _authenticationStateProvider = authStateProvider;
-                _domainUserRepo = domainUserRepo;
             }
 
-            public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken)
+            public async Task<RequestResponse<Response>> Handle(Query 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);
+                var goal = await _goalItemRepo.GetByIdAsync(request.goalId);
 
-                if(goalDef == null)
+                if(goal == null)
                 {
-                    return RequestResponse<Response>.CreateErrorResponse($"Goal definition with id: {request.GoalDefinitionId} not found!");
+                    return RequestResponse<Response>.CreateErrorResponse($"Goal with id: {request.goalId} not found!");
                 }
 
-                GoalItem item = new(goalDef, user, request.Name, request.Description);
-
-                await _goalItemRepo.AddAsync(item);
-
-                return RequestResponse<Response>.CreateSuccessResponse(new(item));
+                return RequestResponse<Response>.CreateSuccessResponse(new(goal));
             }
         }
 
diff --git a/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalsForDefinition.cs b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalsForDefinition.cs
new file mode 100644
index 0000000..a6715ef
--- /dev/null
+++ b/src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalsForDefinition.cs
@@ -0,0 +1,52 @@
+﻿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.Queries
+{
+    public static class GetGoalsForDefinition
+    {
+        public record Query(Guid goalDefinition) : IBaseRequest<Response>;
+
+        public record Response(List<GoalItem> list);
+
+
+        public class Handler : IBaseRequestHandler<Query, Response>
+        {
+            private readonly IGoalItemRepository _goalItemRepo;
+            private readonly AuthenticationStateProvider _authenticationStateProvider;
+            private readonly IDomainUserRepository _domainUserRepository;
+
+            public Handler(IGoalItemRepository goalItemRepo,
+                AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
+            {
+                _goalItemRepo = goalItemRepo;
+                _authenticationStateProvider = authenticationStateProvider;
+                _domainUserRepository = domainUserRepository;
+            }
+
+            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
+            {
+                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
+                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
+                var goals = await _goalItemRepo.GetAllForUserDefinitionAsync(request.goalDefinition);
+
+                if (goals == null)
+                {
+                    return RequestResponse<Response>.CreateErrorResponse($"Goals for definition: {request.goalDefinition} not found!");
+                }
+
+                return RequestResponse<Response>.CreateSuccessResponse(new(goals));
+            }
+        }
+    }
+}
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 cae6d4f..010ba73 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
@@ -39,7 +39,7 @@ namespace Leuze.Modules.Goal.Domain.Domains
         public bool SupervisorLocked { get; private set; }
         public decimal? Vari { get; private set; }
 
-        private List<GoalItem> _goals { get; set; }
+        private List<GoalItem> _goals = new List<GoalItem>();
         public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly();
 
         public void SetName(string name)
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 5afbcbf..8d2c985 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
@@ -25,6 +25,12 @@ namespace Leuze.Modules.Goal.Domain.Domains
             this.Description = description;
         }
 
+        public static GoalItem Default()
+        {
+            GoalItem item = new GoalItem();
+            return item;
+        }
+
         public Guid Id { get; private set; }
         public GoalDefinition GoalDefinition { get; private set; }
         public Guid GoalDefinitionId { get; private set; }
@@ -35,13 +41,13 @@ namespace Leuze.Modules.Goal.Domain.Domains
         public decimal PercentileUser { get; private set; }
         public decimal PercentileFinal { get; private set; }
 
-        private List<Comment> _comments { get; set; }
+        private List<Comment> _comments = new();
         public IReadOnlyList<Comment> Comments => _comments.AsReadOnly();
 
-        private List<GoalUpdate> _updates { get; set; }
+        private List<GoalUpdate> _updates = new();
         public IReadOnlyList<GoalUpdate> Updates => _updates.AsReadOnly();
 
-        private List<Review> _reviews { get; set; }
+        private List<Review> _reviews = new();
         public IReadOnlyList<Review> Reviews => _reviews.AsReadOnly();
 
         public void SetName(string name)
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/DependencyInjection.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/DependencyInjection.cs
index 02cd40d..913a92c 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/DependencyInjection.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/DependencyInjection.cs
@@ -1,8 +1,14 @@
 ﻿using ExtCore.Infrastructure.Actions;
+using Leuze.Core.Application.Configuration;
+using Leuze.Core.Domain.Domains.Users;
+using Leuze.Core.Infrastructure.Persistence;
+using Leuze.Modules.Goal.Domain.Domains;
 using Leuze.Modules.Goal.Infrastructure.Persistence.Extensions;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Options;
 using System;
+using System.Linq;
 
 namespace Leuze.Modules.Goal.Infrastructure.Persistence
 {
@@ -44,7 +50,16 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence
         /// <param name="serviceProvider"></param>
         public void Execute(IApplicationBuilder applicationBuilder, IServiceProvider serviceProvider)
         {
+            using (var serviceScope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
+            {
+                var context = serviceScope.ServiceProvider.GetRequiredService<LeuzeDbContext>();
+                var appSettings = serviceScope.ServiceProvider.GetRequiredService<IOptions<AppSettings>>().Value;
 
+                var user = context.Set<DomainUser>().Where(item => item.EmailAddress.Email == "ma@test.cz").FirstOrDefault();
+                GoalDefinition gd = new GoalDefinition(user, user, "Test Goal definition", DateTime.Now, DateTime.Now.AddDays(10));
+                context.Add(gd);
+                context.SaveChanges();
+            }
         }
     }
 }
diff --git a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Extensions/RepositoriesExtension.cs b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Extensions/RepositoriesExtension.cs
index 45101ef..03a464c 100644
--- a/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Extensions/RepositoriesExtension.cs
+++ b/src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Extensions/RepositoriesExtension.cs
@@ -20,6 +20,8 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Extensions
             services.AddTransient<IGoalItemRepository,GoalItemRepository>();
             services.AddTransient<IGoalUpdateRepository,GoalUpdateRepository>();
             services.AddTransient<IReviewRepository,ReviewRepository>();
+
+
         }
 
     }
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 903a8d2..c528206 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,7 +40,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId)
         {
-            return await dbSet.Where(item => item.OwnerId == userId).ToListAsync();
+            return await dbSet.Include(item => item.Creator).Where(item => item.OwnerId == userId).ToListAsync();
         }
 
         public async Task<List<GoalDefinition>> GetAllAsync()
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 63c8963..1b3b3f6 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
@@ -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;
@@ -42,7 +43,7 @@ namespace Leuze.Modules.Goal.Infrastructure.Persistence.Repositories
 
         public async Task<List<GoalItem>> GetAllForUserDefinitionAsync(Guid definitionId)
         {
-            return dbSet.Where(item => item.GoalDefinitionId == definitionId).ToList(); //TODO: await??
+            return await dbSet.Include(item => item.Creator).Where(item => item.GoalDefinitionId == definitionId).ToListAsync();
         }
 
         public async Task<List<GoalItem>> GetAllAsync()
