Some small improvements for clarity.
* PostModel -> PostDto * 404 test case * README
This commit is contained in:
@@ -8,14 +8,14 @@ This exercise is designed to test your skills in C# and .NET.
|
|||||||
* Minimal ASP.NET Core Web API
|
* Minimal ASP.NET Core Web API
|
||||||
* Entity Framework Core
|
* Entity Framework Core
|
||||||
* SQLite3 Database (simplified for portability)
|
* SQLite3 Database (simplified for portability)
|
||||||
* HttpClient for downstream REST API calls
|
* `HttpClient` for downstream REST API calls
|
||||||
* ???
|
* ???
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* Latest [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
* Latest [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||||
* Visual Studio Code
|
* Visual Studio Code with C# Dev Kit extension
|
||||||
* Docker Desktop and docker compose plugin
|
* Also works with Visual Studio 2022 and JetBrains Rider.
|
||||||
* **Disable Copilot completions** (that would make it too easy...)
|
* **Disable Copilot completions** (that would make it too easy...)
|
||||||
* Be ready for sharing your screen in Zoom
|
* Be ready for sharing your screen in Zoom
|
||||||
* Launch settings have been configured to run and debug the web application
|
* Launch settings have been configured to run and debug the web application
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class JsonPlaceholderClient
|
|||||||
// TODO: Configure the client as needed.
|
// 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.
|
// 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.");
|
throw new NotImplementedException("This method will be implemented in Phase 1.");
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System;
|
|||||||
namespace service;
|
namespace service;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class PostModel
|
public class PostDto
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
@@ -35,7 +35,7 @@ app.UseRequestTimeouts();
|
|||||||
app.MapGet("/posts/{id}", async (AppDbContext dbContext, JsonPlaceholderClient client, int id) =>
|
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.
|
// 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();
|
return Results.Ok();
|
||||||
})
|
})
|
||||||
.WithRequestTimeout(TimeSpan.FromSeconds(29))
|
.WithRequestTimeout(TimeSpan.FromSeconds(29))
|
||||||
|
|||||||
Reference in New Issue
Block a user