Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 9 column 1
---

## Getting Started

### Prerequisites
- Java 17+
- Maven 3.9+
- PostgreSQL 18

### 1. Clone the repository
```bash
git clone https://github.com/manishaagangadevi/taskflow-api.git
cd taskflow-api
```

### 2. Create the database
```sql
CREATE DATABASE taskflowdb;
```

### 3. Configure application.yaml
```yaml
spring:
  datasource:
    url: jdbc:postgresql://localhost:5432/taskflowdb
    username: postgres
    password: your_password
```

### 4. Run the application
```bash
mvn spring-boot:run
```

API will be available at `http://localhost:8080`

### Run with Docker
```bash
docker build -t taskflow-api .
docker run -p 8080:8080 \
  -e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/taskflowdb \
  -e SPRING_DATASOURCE_PASSWORD=postgres \
  taskflow-api
```

---

API Reference

Authentication

Register

POST /api/auth/register
Content-Type: application/json

{
  "name": "Manisha Gangadevi",
  "email": "manisha@example.com",
  "password": "securepassword"
}

Response

{
  "token": "eyJhbGciOiJIUzI1NiJ9...",
  "email": "manisha@example.com",
  "role": "ROLE_USER"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "manisha@example.com",
  "password": "securepassword"
}

Tasks

All task endpoints require Authorization: Bearer <token> header

Create Task

POST /api/tasks
Authorization: Bearer <token>
Content-Type: application/json

{
  "title": "Complete project documentation",
  "description": "Write API docs and README",
  "priority": "HIGH",
  "status": "TODO",
  "dueDate": "2026-06-01T00:00:00"
}

Get All Tasks (Paginated)

GET /api/tasks?page=0&size=10&sortBy=createdAt
Authorization: Bearer <token>

Filter by Status

GET /api/tasks?status=TODO
Authorization: Bearer <token>

Filter by Priority

GET /api/tasks?priority=HIGH
Authorization: Bearer <token>

Get Task by ID

GET /api/tasks/{id}
Authorization: Bearer <token>

Update Task

PUT /api/tasks/{id}
Authorization: Bearer <token>
Content-Type: application/json

{
  "title": "Updated title",
  "status": "IN_PROGRESS",
  "priority": "MEDIUM"
}

Delete Task

DELETE /api/tasks/{id}
Authorization: Bearer <token>

Error Responses

All errors follow a consistent format:

{
  "timestamp": "2026-05-26T10:30:00",
  "status": 404,
  "message": "Task not found"
}
Status Code Meaning
400 Bad Request / Validation Error
401 Unauthorized — missing or invalid token
403 Forbidden — access to another user's resource
404 Resource not found

Database Schema

-- users table
CREATE TABLE users (
    id       BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    name     VARCHAR(255) NOT NULL,
    email    VARCHAR(255) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    role     VARCHAR(50)
);

-- tasks table
CREATE TABLE tasks (
    id          BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
    title       VARCHAR(255) NOT NULL,
    description VARCHAR(255),
    status      VARCHAR(50),
    priority    VARCHAR(50),
    due_date    TIMESTAMP,
    created_at  TIMESTAMP,
    user_id     BIGINT REFERENCES users(id)
);

Security Architecture

About

Production-grade Task Management REST API with Spring Boot, JWT Auth & Role-Based Access

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages