diff --git a/backend/src/api/Controllers/TodoController.cs b/backend/src/api/Controllers/TodoController.cs index ee522a4..35f9bad 100644 --- a/backend/src/api/Controllers/TodoController.cs +++ b/backend/src/api/Controllers/TodoController.cs @@ -1,5 +1,4 @@ -using api.Data.DTO; -using api.Services; +using api.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -11,17 +10,23 @@ namespace api.Controllers; public class TodoController : ControllerBase { private readonly ITodoService _service; + private readonly ILogger _logger; - public TodoController(ITodoService service) => _service = service; + public TodoController(ITodoService service, ILogger logger){ + _service = service; + _logger = logger; + } [HttpGet("lists")] public IActionResult List() { - return Request.UserId() switch + var userId = Request.UserId(); + _logger.LogInformation("User: {user} requested his lists", userId); + return userId switch { null => Unauthorized(), var user => Ok(_service.GetLists(user)), }; } -} +} \ No newline at end of file diff --git a/scripts/apply_migrations.ps1 b/scripts/apply_migrations.ps1 index 201925c..05aa6c2 100755 --- a/scripts/apply_migrations.ps1 +++ b/scripts/apply_migrations.ps1 @@ -13,7 +13,7 @@ docker compose up db -d 2>&1 > $null Write-Output "Generateing migration script" Set-Location ../backend/src/api mkdir migration_scripts 2>&1 > $null -dotnet ef migrations script --idempotent -o ./migration_scripts/migration.sql 2>&1 > $null +dotnet ef migrations script --idempotent -o ./migration_scripts/migration.sql Write-Output "Applying.." $passwd = "PGPASSWORD=" + $Env:POSTGRES_PASSWORD