2
0

Some small improvements for clarity.

* PostModel -> PostDto
* 404 test case
* README
This commit is contained in:
2026-02-18 10:41:52 +01:00
parent f1c0021ad3
commit c3c8c85afe
4 changed files with 6 additions and 6 deletions

View File

@@ -8,14 +8,14 @@ This exercise is designed to test your skills in C# and .NET.
* Minimal ASP.NET Core Web API
* Entity Framework Core
* SQLite3 Database (simplified for portability)
* HttpClient for downstream REST API calls
* `HttpClient` for downstream REST API calls
* ???
## Prerequisites
* Latest [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
* Visual Studio Code
* Docker Desktop and docker compose plugin
* Visual Studio Code with C# Dev Kit extension
* Also works with Visual Studio 2022 and JetBrains Rider.
* **Disable Copilot completions** (that would make it too easy...)
* Be ready for sharing your screen in Zoom
* Launch settings have been configured to run and debug the web application

View File

@@ -16,7 +16,7 @@ public class JsonPlaceholderClient
// TODO: Configure the client as needed.
}
public async Task<PostModel?> GetPostByIdAsync(int id, CancellationToken ct = default)
public async Task<PostDto?> GetPostByIdAsync(int id, CancellationToken ct = default)
{
// TODO: Implement the logic to call the external service and retrieve the post by ID.
throw new NotImplementedException("This method will be implemented in Phase 1.");

View File

@@ -3,7 +3,7 @@ using System;
namespace service;
[Serializable]
public class PostModel
public class PostDto
{
public int Id { get; set; }
public int UserId { get; set; }

View File

@@ -35,7 +35,7 @@ app.UseRequestTimeouts();
app.MapGet("/posts/{id}", async (AppDbContext dbContext, JsonPlaceholderClient client, int id) =>
{
// TODO: (Phase 1) Implement the logic to retrieve a post by ID and store it in the database.
// Consider some minimal error handling in case the post is not found (e.g. Id > 100).
// Consider some minimal error handling in case the post is not found (e.g. when testing with an Id > 100).
return Results.Ok();
})
.WithRequestTimeout(TimeSpan.FromSeconds(29))