Skip to content

genbadar/TaskManagerApi

Repository files navigation

TaskManagerApi

A RESTful Task Manager API built with ASP.NET Core, Entity Framework Core, and PostgreSQL. Supports full CRUD for tasks and categories with Swagger documentation.


Tech Stack

Layer Technology
Framework ASP.NET Core (.NET 10)
ORM Entity Framework Core
Database PostgreSQL
API Docs Swagger / Swashbuckle
Language C#

Features

  • Create, read, update, and delete tasks
  • Organize tasks into categories
  • Mark tasks as complete
  • Filter tasks by category
  • Interactive API docs via Swagger UI

Project Structure

TaskManagerApi/
├── Controllers/
│   ├── TasksController.cs
│   └── CategoriesController.cs
│   ├── ProjectsController.cs
│   └── UsersController.cs
├── Data/
│   └── AppDbContext.cs
├── Models/
│   ├── TaskItem.cs
│   └── Category.cs
│   ├── Project.cs
│   └── User.cs
├── Migrations/
├── appsettings.json
└── Program.cs

Getting Started

Prerequisites

dotnet tool install --global dotnet-ef

1. Clone the repository

git clone https://github.com/genbadar/TaskManagerApi.git
cd TaskManagerApi

2. Configure the database

Create a PostgreSQL database:

CREATE DATABASE taskmanagerdb;

Update the connection string in appsettings.json:

"ConnectionStrings": {
  "DefaultConnection": "Host=localhost;Port=5432;Database=taskmanagerdb;Username=postgres;Password=YOUR_PASSWORD"
}

3. Apply migrations

dotnet ef database update

4. Run the API

dotnet run --launch-profile https

5. Open Swagger UI

https://localhost:7158/swagger

API Endpoints

Tasks

Method Endpoint Description
GET /api/tasks Get all tasks
GET /api/tasks/{id} Get task by ID
POST /api/tasks Create a new task
PUT /api/tasks/{id} Update a task
PATCH /api/tasks/{id}/complete Mark task as complete
DELETE /api/tasks/{id} Delete a task

Categories

Method Endpoint Description
GET /api/categories Get all categories
GET /api/categories/{id} Get category by ID (includes tasks)
POST /api/categories Create a new category
PUT /api/categories/{id} Update a category
DELETE /api/categories/{id} Delete a category

Users

Method Endpoint Description
GET /api/users Get all users
GET /api/users/{id} Get user by ID
GET /api/users/{id}/tasks Get tasks assigned to user
POST /api/users Create a new user
PUT /api/users/{id} Update a user
PATCH /api/users/{id}/deactivate Deactivate a user
PATCH /api/users/{id}/role Update user role
DELETE /api/users/{id} Delete a user

Projects

Method Endpoint Description
GET /api/projects Get all active projects
GET /api/projects/{id} Get project by ID
GET /api/projects/{id}/tasks Get tasks in a project
POST /api/projects Create a new project
PUT /api/projects/{id} Update a project
PATCH /api/projects/{id}/archive Archive a project
DELETE /api/projects/{id} Delete a project

Example Requests

Create a category

POST /api/categories
{
  "name": "Work",
  "color": "#4A90E2"
}

Create a task

POST /api/tasks
{
  "title": "Finish project report",
  "description": "Complete the Q2 summary",
  "dueDate": "2026-06-01T00:00:00Z",
  "categoryId": 1
}

Mark a task complete

PATCH /api/tasks/1/complete

EF Core Commands Reference

# Create a new migration after model changes
dotnet ef migrations add <MigrationName>

# Apply migrations to the database
dotnet ef database update

# List all migrations
dotnet ef migrations list

# Undo the last migration (if not yet applied)
dotnet ef migrations remove

# Roll back to a specific migration
dotnet ef database update <MigrationName>

License

This project is open source and available under the MIT License.

About

RESTful Task Manager API built with ASP.NET Core, EF Core & PostgreSQL. Supports workspaces, projects, tasks and users with full CRUD.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages