The initial looze requirements are:
- Create a simple web api to create and read Users and Tasks.
- Users are defined by unique Name.
- Tasks are defined by their Description and a State (Waiting, InProgress, Completed).
- When a Task is created, an User should be assigned to it automatically.
- Users can have multiple tasks, Task can only have one user.
- Every 2 minutes all tasks should be reassigned to another random user (it can't be the user which is already assigned to the task).
- When no users are available the Task will stay without assigned user.
- All task have to be transferred for exactly 3 times, after that, they should be considered completed and stay unassigned.
- No user interface is requirement for the assignment.
We purposely left requirements loose.
- Install .NET 7.0 SDK if you haven't already.
- Clone the repository.
cd .\task-webapi-demo\
cd .\Cnvs.Demo.TaskManagement.WebApi\
- Run
dotnet run
in the root directory of the project. - Follow http://localhost:5188/swagger/index.html to see the API documentation and test the API.
cd .\Cnvs.Demo.TaskManagement.WebApi.Curl\
powershell- Run
.\CreateXTasks.ps1
to run the curl script to test the API. - Run
.\CreateOneUser.ps1
to run the curl script to test the API. - Run
.\CreateThreeUsers.ps1
to run the curl script to test the API. - The current implementation is using in-memory database. The data will be lost when the application is stopped.
- The current implementation is using a simple timer to reassign tasks. The timer will be stopped when the application is stopped.
- Install Docker if you haven't already.
- First, in your terminal, navigate to the directory containing the Dockerfile
cd .\Cnvs.Demo.TaskManagement.WebApi\
- Run
docker build -t task-webapi-demo .
to build the image. - Once the image is built, you can check it in the list of docker images:
docker images
- Run
docker run -p 8000:8000 task-webapi-demo
to run the container. - Follow http://localhost:5188/swagger/index.html to see the API documentation and test the API.
- Use PS scripts from .\Cnvs.Demo.TaskManagement.WebApi.Curl\Docker-curls