Skip to content

Samcodedev/task-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Task Management API Documentation

A robust REST API for managing tasks, groups, and user assignments built with Node.js, Express, and MongoDB.

Table of Contents

Getting Started

Prerequisites

  • Node.js
  • MongoDB
  • npm or yarn

Installation

  1. Clone the repository
git clone [repository-url]
  1. Install dependencies
npm install
  1. Create a .env file with the following variables:

Server Configuration

PORT=3000
MONGODB_URI=your_mongodb_connection_string
ACCESS_TOKEN_SECRET=your_jwt_secret
REFRESH_TOKEN_SECRET=your_refresh_token

Email Configuration

SMTP_HOST=your_smtp_host
SMTP_PORT=your_smtp_port
SMTP_USER=your_smtp_username
SMTP_PASS=your_smtp_password
MAIL_FROM_NAME=your_app_name
MAIL_FROM_ADDRESS=your_email_address
  1. Start the server
npm start

Authentication

Register a New User

POST /api/v1/user/register
Content-Type: application/json
{
  "firstName": "John",
  "lastName": "Doe",
  "userName": "johndoe",
  "email": "user@example.com",
  "phoneNumber": "+2345678900",
  "password": "password123"
}

Login

POST /api/v1/user/login
Content-Type: application/json
{
  "email": "user@example.com",
  "password": "password123"
}

Verify Account

POST /api/v1/user/verify
Content-Type: application/json
{
  "email": "user@example.com",
  "otp": "12345"
}

Get User Profile

GET /api/v1/user/getUser
Authorization: Bearer your_jwt_token

Forgot Password

POST /api/v1/user/forgotPassword
Content-Type: application/json
{
  "email": "user@example.com"
}

Reset Password

POST /api/v1/user/resetPassword
Content-Type: application/json
{
  "token": "reset_token",
  "newPassword": "newPassword123"
}

Resend OTP

POST /api/v1/user/resend-otp
Content-Type: application/json
{
  "email": "user@example.com"
}

Groups

Create New Group

POST /api/v1/group/register
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "groupName": "Marketing Team",
  "description": "Group for marketing team members"
}

Update Group

PUT /api/v1/group/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "groupName": "Updated Group Name",
  "description": "Updated group description"
}

Admin

Set Member Role

POST /api/v1/admin/role/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "memberId": "user_id",
  "role": "admin" // Options: "admin", "manager", "member"
}

Add Group Member

POST /api/v1/admin/add/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "newMemberId": "user_id",
  "role": "member" // Options: "admin", "manager", "member"
}

Remove Group Member

PUT /api/v1/add/remove/:groupId
Authorization: Bearer your_jwt_token
{
  "memberId": "user_id",
}

Tasks

Create a New Task

POST /api/v1/task/create/:groupId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "title": "Task Title",
  "description": "Task Description",
  "priority": "high", // Options: "high", "low", "urgent"
  "status": "pending", // Options: "pending", "in-progress", "completed", "on-hold"
  "tasksList": ["task1", "task2"],
  "dueDate": "2024-03-20",
  "assignedTo": ["user_id1", "user_id2"],
  "supervisor": "supervisor_id"
}

Update a Task

PUT /api/v1/task/update/:taskId
Authorization: Bearer your_jwt_token
Content-Type: application/json
{
  "title": "Updated Title",
  "status": "in-progress",
  "priority": "urgent"
}

Error Responses

All endpoints may return the following error responses:

{
  "status": "error",
  "message": "Error description"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published