commit f2249f10b972fe8a634a6b1d3fb125f1fbe36800
Author: Vojtěch Bartička <aitakaitov@gmail.com>
Date:   Sat Apr 9 21:34:31 2022 +0200

    Added AutoMapper, configured, added DTO mappings

diff --git a/Backend/Backend/Program.cs b/Backend/Backend/Program.cs
index 64dd01e..89b3219 100644
--- a/Backend/Backend/Program.cs
+++ b/Backend/Backend/Program.cs
@@ -9,6 +9,8 @@ using Microsoft.OpenApi.Models;
 using RestAPI.Middleware;
 using RestAPI.Utils;
 using Serilog;
+using AutoMapper;
+using Core.MapperProfiles;
 
 var builder = WebApplication.CreateBuilder(args);
 
@@ -57,6 +59,8 @@ builder.Services.AddScoped<ClientInfo>(provider =>
 // Database
 builder.Services.AddDbContext<DatabaseContext>();
 
+// AutoMapper
+RegisterMappings.Register(builder);
 var app = builder.Build();
 
 // Enable DateTime in PostgreSQL
diff --git a/Backend/Backend/RestAPI.csproj b/Backend/Backend/RestAPI.csproj
index 9b79f14..24d877a 100644
--- a/Backend/Backend/RestAPI.csproj
+++ b/Backend/Backend/RestAPI.csproj
@@ -9,6 +9,8 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="AutoMapper" Version="11.0.1" />
+    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">
       <PrivateAssets>all</PrivateAssets>
diff --git a/Backend/Core/Core.csproj b/Backend/Core/Core.csproj
index d42d515..bf8842f 100644
--- a/Backend/Core/Core.csproj
+++ b/Backend/Core/Core.csproj
@@ -7,6 +7,8 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="AutoMapper" Version="11.0.1" />
+    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
     <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.3" />
diff --git a/Backend/Core/MapperProfiles/DocumentProfileEF.cs b/Backend/Core/MapperProfiles/DocumentProfileEF.cs
new file mode 100644
index 0000000..bf95650
--- /dev/null
+++ b/Backend/Core/MapperProfiles/DocumentProfileEF.cs
@@ -0,0 +1,24 @@
+﻿using AutoMapper;
+using Core.Entities;
+using Models.Documents;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Core.MapperProfiles
+{
+    public class DocumentProfileEF : Profile
+    {
+        public DocumentProfileEF()
+        {
+            CreateMap<Document, DocumentListInfo>();
+                /*.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
+                .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
+                .ForMember(dest => dest.Length, opt => opt.MapFrom(src => src.Length))
+                .ForMember(dest => dest.RequiredAnnotations, opt => opt.MapFrom(src => src.RequiredAnnotations));*/
+
+        }
+    }
+}
diff --git a/Backend/Core/MapperProfiles/RegisterMappings.cs b/Backend/Core/MapperProfiles/RegisterMappings.cs
new file mode 100644
index 0000000..931f33f
--- /dev/null
+++ b/Backend/Core/MapperProfiles/RegisterMappings.cs
@@ -0,0 +1,19 @@
+﻿using Microsoft.AspNetCore.Builder;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoMapper;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Core.MapperProfiles
+{
+    public class RegisterMappings
+    {
+        public static void Register(WebApplicationBuilder builder)
+        {
+            builder.Services.AddAutoMapper(typeof(UserProfileEF), typeof(DocumentProfileEF));
+        }
+    }
+}
diff --git a/Backend/Core/MapperProfiles/UserProfileEF.cs b/Backend/Core/MapperProfiles/UserProfileEF.cs
new file mode 100644
index 0000000..b409924
--- /dev/null
+++ b/Backend/Core/MapperProfiles/UserProfileEF.cs
@@ -0,0 +1,19 @@
+﻿using AutoMapper;
+using Core.Entities;
+using Models.Users;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Core.MapperProfiles
+{
+    public class UserProfileEF : Profile
+    {
+        public UserProfileEF()
+        {
+           CreateMap<User, UserInfo>();
+        }
+    }
+}
diff --git a/Backend/Models/Models.csproj b/Backend/Models/Models.csproj
index 132c02c..a2a168f 100644
--- a/Backend/Models/Models.csproj
+++ b/Backend/Models/Models.csproj
@@ -6,4 +6,8 @@
     <Nullable>enable</Nullable>
   </PropertyGroup>
 
+  <ItemGroup>
+    <PackageReference Include="AutoMapper" Version="11.0.1" />
+  </ItemGroup>
+
 </Project>
