Skip to content

Commit

Permalink
Closes #60
Browse files Browse the repository at this point in the history
Add Logs
Remove the redirect for debuging
  • Loading branch information
mtracewicz committed Sep 10, 2024
1 parent 3611d3c commit 55e3679
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions backend/src/api/Controllers/TodoController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using api.Data.DTO;
using api.Services;
using api.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

Expand All @@ -11,17 +10,23 @@ namespace api.Controllers;
public class TodoController : ControllerBase
{
private readonly ITodoService _service;
private readonly ILogger<TodoController> _logger;

public TodoController(ITodoService service) => _service = service;
public TodoController(ITodoService service, ILogger<TodoController> 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)),
};
}

}
}
2 changes: 1 addition & 1 deletion scripts/apply_migrations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55e3679

Please sign in to comment.