diff --git a/back/Controllers/Controllers.csproj b/back/Controllers/Controllers.csproj
index 9daa180..34f05b7 100644
--- a/back/Controllers/Controllers.csproj
+++ b/back/Controllers/Controllers.csproj
@@ -10,4 +10,10 @@
+
+
+
+
+
+
diff --git a/back/Controllers/Controllers/AuthController.cs b/back/Controllers/Controllers/AuthController.cs
new file mode 100644
index 0000000..5184f89
--- /dev/null
+++ b/back/Controllers/Controllers/AuthController.cs
@@ -0,0 +1,64 @@
+using Contracts.DTO;
+using Contracts.Services;
+using Contracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+using Services.Support.Exceptions;
+
+namespace Controllers.Controllers
+{
+ [ApiController]
+ [Route("api/[controller]")]
+ public class AuthController : ControllerBase
+ {
+ private readonly IAuthService _authService;
+
+ public AuthController(IAuthService authService)
+ {
+ _authService = authService;
+ }
+
+ [HttpPost]
+ public async Task> Login([FromBody] UserLoginDTO loginData)
+ {
+ try
+ {
+ var user = await _authService.Login(loginData);
+ return Ok(user);
+ }
+ catch (ArgumentException ex)
+ {
+ return BadRequest(ex.Message);
+ }
+ catch (UserNotFoundException ex)
+ {
+ return NotFound(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, ex.Message);
+ }
+ }
+
+ [HttpPost("register")]
+ public async Task> Register([FromBody] UserDto user)
+ {
+ try
+ {
+ var createdUser = await _authService.Register(user);
+ return CreatedAtAction(nameof(Login), new { name = createdUser.Name }, createdUser);
+ }
+ catch (ArgumentException ex)
+ {
+ return BadRequest(ex.Message);
+ }
+ catch (AlreadyExistsException ex)
+ {
+ return Conflict(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, ex.Message);
+ }
+ }
+ }
+}
diff --git a/back/Controllers/Controllers/UserController.cs b/back/Controllers/Controllers/UserController.cs
new file mode 100644
index 0000000..bfca307
--- /dev/null
+++ b/back/Controllers/Controllers/UserController.cs
@@ -0,0 +1,44 @@
+using Contracts.DTO;
+using Contracts.SearchModels;
+using Contracts.Services;
+using Contracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Controllers.Controllers
+{
+ [ApiController]
+ [Route("api/[controller]")]
+ public class UserController : ControllerBase
+ {
+ private readonly IUserService _userService;
+
+ public UserController(IUserService userService)
+ {
+ _userService = userService;
+ }
+
+ [HttpGet]
+ public async Task> GetUser([FromQuery] UserSearch search)
+ {
+ var user = await _userService.GetDetails(search);
+
+ return Ok(user);
+ }
+
+ [HttpPut]
+ public async Task> UpdateUser([FromBody] UserDto user)
+ {
+ var updatedUser = await _userService.UpdateUserData(user);
+
+ return Ok(updatedUser);
+ }
+
+ [HttpDelete]
+ public async Task> DeleteUser([FromQuery] UserSearch search)
+ {
+ var deletedUser = await _userService.Delete(search);
+
+ return Ok(deletedUser);
+ }
+ }
+}
diff --git a/back/Controllers/Extensions/AddDbConnectionService.cs b/back/Controllers/Extensions/AddDbConnectionService.cs
new file mode 100644
index 0000000..e78595e
--- /dev/null
+++ b/back/Controllers/Extensions/AddDbConnectionService.cs
@@ -0,0 +1,19 @@
+using Infrastructure;
+using Microsoft.EntityFrameworkCore;
+
+namespace Controllers.Extensions;
+
+public static class DbConnectionServiceExtension
+{
+ public static void AddDbConnectionService(this IServiceCollection services)
+ {
+ var host = Environment.GetEnvironmentVariable("DB_HOST");
+ var database = Environment.GetEnvironmentVariable("DB_NAME");
+ var username = Environment.GetEnvironmentVariable("DB_USER");
+ var password = Environment.GetEnvironmentVariable("DB_PASSWORD");
+ var connectionString = $"Host={host};Database={database};Username={username};Password={password}";
+
+ services.AddDbContext(options => options.UseNpgsql(connectionString));
+ services.AddSingleton, DbContextFactory>();
+ }
+}
\ No newline at end of file
diff --git a/back/Controllers/Extensions/AddDomainServicesExt.cs b/back/Controllers/Extensions/AddDomainServicesExt.cs
new file mode 100644
index 0000000..f68caa1
--- /dev/null
+++ b/back/Controllers/Extensions/AddDomainServicesExt.cs
@@ -0,0 +1,13 @@
+using Contracts.Services;
+using Services.Domain;
+
+namespace Controllers.Extensions;
+
+public static class AddDomainServicesExtension
+{
+ public static void AddDomainServices(this IServiceCollection services)
+ {
+ services.AddSingleton();
+ services.AddSingleton();
+ }
+}
\ No newline at end of file
diff --git a/back/Controllers/Extensions/AddReposExt.cs b/back/Controllers/Extensions/AddReposExt.cs
new file mode 100644
index 0000000..27d5b68
--- /dev/null
+++ b/back/Controllers/Extensions/AddReposExt.cs
@@ -0,0 +1,14 @@
+using Contracts.Repositories;
+using Contracts.Services;
+using Infrastructure.Repositories;
+using Services.Domain;
+
+namespace Controllers.Extensions;
+
+public static class AddReposExtension
+{
+ public static void AddRepos(this IServiceCollection services)
+ {
+ services.AddSingleton();
+ }
+}
\ No newline at end of file
diff --git a/back/Controllers/Program.cs b/back/Controllers/Program.cs
index 48863a6..1bb1553 100644
--- a/back/Controllers/Program.cs
+++ b/back/Controllers/Program.cs
@@ -1,6 +1,11 @@
+using Controllers.Extensions;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
+builder.Services.AddRepos();
+builder.Services.AddDomainServices();
+builder.Services.AddDbConnectionService();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle