You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of the test task is to develop a web API of a task planning system. The web API must allow to
create and edit a task hierarchy, as well as perform calculations on the data fields of the tasks in the
hierarchy.
Technologies used:
ASP.NET Core 6, C#, EntityFramework Core, MS SQL Server Database, Docker
App architecture used with different layers
VPSDemo.Api (main Web API project) contains Controllers (endpoints), Contracts, Mappers, Filters.
VPSDemo.Application contains Interfaces, Errors, Logic to fetch data
VPSDemo.Domain contains Entities
VPSDemo.Infrastructure contains Repositories, Migration files and other fiels related to DB
in order to add custom 'errorMessage' to ProblemDetails class we override method CreateProblemDetails in VPSDemo.Api.Common VPSProblemDetailsFactory.cs
DB and UI models
DB Model (Entity) defined in VPSDemo.Domain.Entities Task.cs class
UI models (Contracts) defined in VPSDemo.Api.Contracts
Capabilities of the Web API
Create Task, Delete Task, Edit Task, Get Task, Assign Sub task
Get Task - also retrieves sub Tasks
Delete Task - Only a task which does not have sub-tasks can be deleted.
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Validation Error",
"status": 400,
"traceId": "00-21790aa1386552307b4397420650fefa-18df5db6c8db92e1-00",
"errorMessage": [
"The Title field is required."
]
}
Edit
PUT VPSDemo_URL/tasks/2
Request body
Response (FAIL 400)
{
"description": "description"
}
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Validation Error",
"status": 400,
"traceId": "00-21790aa1386552307b4397420650fefa-18df5db6c8db92e1-00",
"errorMessage": [
"The Status field is required.",
"The field Status is invalid"
]
}
Assign sub task
PUT VPSDemo_URL/tasks/assignSubTask/4?parentIdentifier=3
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.8",
"title": "Conflict",
"status": 409,
"traceId": "00-7d2127bfe809238b8d944c0cb64fec29-d17390d3fe719a93-00",
"errorMessage": [
"Task with identifier [1] has assigned one or more Task with identifiers: [4]"
]
}
Docker
VPSDemo.Api contains Dockerfile to build docker image.
We use base image mcr.microsoft.com/dotnet/sdk:6.0 to build binaries.
.Net runtime image mcr.microsoft.com/dotnet/aspnet:6.0 is used to serve artefacts we've created
Local docker container running our image:
Opening the browser to display app runnig from docker container:
About
VPSDemo: A task planning web API built with ASP.NET Core 6, employing Clean Architecture and EntityFramework Core, featuring automated mapping with AutoMapper and error handling with FluentResults.