Skip to content

irvankadhafi/TaskManagement

Repository files navigation

Task Management System

A practical Task Management System built with .NET 8 that demonstrates clean separation of concerns, SOLID design, and flexible infrastructure. The service exposes a RESTful API for managing tasks and can run either in‑memory or on PostgreSQL with a single switch.


Table of Contents

  1. Overview

  2. Architecture

  3. Features

  4. Prerequisites

  5. Getting Started

    1. Clone the Repository
    2. Run Locally
    3. Run with Docker
  6. API Reference

  7. Testing

  8. Project Structure


Overview

This service lets you create, assign, update, and track tasks. It is intentionally lightweight yet production‑ready:

  • Layered Clean Architecture – Presentation ➜ Application ➜ Domain ➜ Infrastructure.
  • Dependency Injection – services and repositories are registered in Program.cs.
  • Repository Pattern – swap between In‑Memory and PostgreSQL without changing higher layers.
  • Extensive Unit Tests – core use‑cases are covered with xUnit + Moq + FluentAssertions.

Architecture

┌──────────────────────────┐
│   Presentation Layer     │  → ASP.NET Core Web API (Delivery)
└───────────────▲──────────┘
                │ Calls (DTO)
┌───────────────┴──────────┐
│   Application Layer      │  → Use‑Case Interactors (TaskService), Ports, DTOs
└───────────────▲──────────┘
                │ Depends on Abstractions
┌───────────────┴──────────┐
│     Domain Layer         │  → Entities (TaskItem), Enums, Repository Interfaces
└───────────────▲──────────┘
                │ Implemented by
┌───────────────┴──────────┐
│ Infrastructure Layer     │  → InMemoryTaskRepository | TaskRepository(EF Core)
└──────────────────────────┘

Dependency Flow

High‑level policies (Domain/Application) are completely isolated from low‑level concerns (Infrastructure, Web API). Swapping a database, adding RabbitMQ, or migrating to gRPC requires changes only in the outer layers.


Features

Capability Description
Create Task  POST /api/tasks – title, description, due date, priority, assignee
Update Task  PUT /api/tasks/{id} – change status or priority
Delete Task  DELETE /api/tasks/{id}
List Tasks  GET /api/tasks
List by User  GET /api/tasks/user/{userId}
Validation  Rejects tasks with due‑date in the past
Logging  Key operations are logged via built‑in logging provider

Prerequisites


Getting Started

Clone the Repository

git clone https://github.com/irvankadhafi/TaskManagement.git
cd TaskManagement

Run Locally (In‑Memory Database)

cd src/TaskManagement.API
# restore packages & run
dotnet restore
DOTNET_ENVIRONMENT=Development dotnet run

The API listens on https://localhost:5001 and Swagger UI is available at /swagger.

Run with Docker (PostgreSQL)

docker‑compose up --build

API Reference

Open the generated Swagger UI to explore and test every endpoint interactively.


Testing

Unit tests live under tests/TaskManagement.Application.Tests.

dotnet test tests/TaskManagement.Application.Tests

The suite covers:

  • Creating a task (happy & invalid paths)
  • Updating status/priority
  • Listing tasks (all / by user)
  • Deleting tasks

All use‑cases are isolated with mocks, making the tests fast and deterministic.


Project Structure

TaskManagement/
├─ Dockerfile
├─ docker-compose.yml
├─ TaskManagement.sln
├─ src/
│  ├─ TaskManagement.API/            # ASP.NET Core Web API (presentation layer)
│  │   └─ Controllers/               # HTTP endpoints
│  ├─ TaskManagement.Application/    # DTOs, ports, and TaskService interactor
│  ├─ TaskManagement.Contracts/      # Shared contract models between layers
│  ├─ TaskManagement.Delivery.Http/  # (Optional) additional delivery adapters
│  ├─ TaskManagement.Domain/         # Core domain entities & enums
│  ├─ TaskManagement.Infrastructure/ # In‑memory repository (mock DB)
│  ├─ TaskManagement.Persistence/    # EF Core DbContext & PostgreSQL repository
│  └─ TaskManagement.UseCases/       # Reusable use‑case orchestrations
└─ tests/
   └─ TaskManagement.Application.Tests/ # Unit tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors