Skip to content

gulbalasalamov/task-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

Task Management System - Effective Mobile Java Developer Backend Challenge

Functional Requirements

  1. Task Management

    • Creating tasks
    • Editing tasks
    • Deleting tasks
    • Viewing tasks
    • Each task must include the following information:
      • Title
      • Description
      • Status (e.g., "pending", "in progress", "completed")
      • Priority (e.g., "high", "medium", "low")
      • Comments
      • Task author (Reporter) and task executor (Assignee)
  2. Authentication and Authorization

    • User authentication and authorization should be done with email and password.
    • API access should be authenticated using JWT tokens.
  3. Role System

    • Admin and user roles should be created.
    • Admin permissions:
      • Manage all tasks (create, edit, view, delete)
      • Change task status and priority
      • Assign tasks to executors
      • Leave comments
    • User permissions:
      • Manage only tasks assigned to them (change status, leave comments)
  4. Filtering and Pagination of Tasks

    • Tasks should be filtered by author (Reporter) or executor (Assignee).
    • Tasks should be paginated.
  5. Error Handling and Data Validation

    • System should handle errors properly and return understandable messages to users.
    • Incoming data should be validated.
  6. Documentation

    • API should be documented using OpenAPI and Swagger.
    • Swagger UI should be configured.
    • A README file should be created with local setup instructions.
  7. Development Environment

    • Development environment should be created using docker-compose.
    • Basic unit tests should be written for core functionalities.

Use-Case Diagram

                            +--------------------+                    
                            |       Admin        |
                            +--------------------+
                                     |
                                     |
                    +----------------+----------------+----------------+
                    |                |                |                |
                    |                |                |                |                   
             +------------+    +-------------+  +-----------+  +-------------+                           
             | View Tasks |    | Create Task |  | Edit Task |  | Delete Task |
             +------------+    +-------------+  +-----------+  +-------------+
                    |
                    |
       +--------------------+------------------+---------------+
       |                    |                  |               |
       |                    |                  |               | 
+---------------+  +---------------+  +---------------+ +---------------+
| Change Status |  |Change Priority|  | Assign Task   | | Leave Comment |
+---------------+  +---------------+  +---------------+ +---------------+


                             +---------------------+
                             |       User          |
                             +---------------------+
                                       |         
                                       |   
                             +---------------------+  
                             | View Assigned Tasks |  
                             +---------------------+  
                                       |
                                       |
                       +-----------------------------------+
                       |                                   |
                       |                                   |
               +---------------+                +----------------+
               | Change Status |                | Leave Comments |
               +---------------+                +----------------+

Database Design


┌──────────────────┐                 ┌──────────────────────┐                 ┌──────────────────┐
│      Roles       │                 │        Users         │                 │      Tasks       │
├──────────────────┤      1:N        ├──────────────────────┤                 ├──────────────────┤
│ role_id (PK)     ├─────────────────┤ user_id (PK)         │       1:N       │ task_id (PK)     │
│ role_name        │                 │ username             ├─────────────────┤ title            │
└──────────────────┘                 │ email                │       1:N       │ description      │
                                     │ password             ├─────────────────┤ status           │
                                     │ role_id (FK)         │                 │ priority         │
                                     │ created_at           │                 │ author_id (FK)   │
                                     │ updated_at           │                 │ assignee_id (FK) │
                                     └───────┬──────────────┘                 │ created_at       │
                                             │                                │ updated_at       │
                                             │                                └────────┬─────────┘
                                             │                                         │
                                             │                                         │
                                             │                                         │
                                             │                                         │
                                             │                                         │
┌──────────────────┐                         │                                         │
│     Comments     │                         │                                         │
├──────────────────┤           1:N           │                                         │
│ comment_id (PK)  │                         │                                         │
│ content          ├─────────────────────────┘                                         │
│ task_id (FK)     │←──────────────────────────────────────────────────────────────────┘
│ user_id (FK)     │                                                    1:N
│ created_at       │
│ updated_at       │
└──────────────────┘

Relationships:

  • Users and Roles:

    • Each user can have one role (role_id).
    • Each role can be assigned to many users.
  • Users and Tasks:

    • author_id: Only admin users can create tasks. (1:N)
    • assignee_id: Each user can be assigned to many tasks. (1:N)
  • Tasks and Comments:

    • task_id: Each task can have many comments. (1:N)
  • Users and Comments:

    • user_id: Each user can leave many comments. (1:N)

Test Coverage

Class : %84

Methods : %74

test-coverage

API Documentation

To access Swagger doc, click live link below.

Swagger / OpenAPI : http://localhost:8080/swagger-ui/swagger-ui/index.html

image

image

Postman Collection To run the collection in your postman:

Run in Postman

API Step by Step Guide

User API

1. Sign Up as Admin or User

image

2. Using the email as username and password to sign in to receive token.

image

3. Copy the generated token and save it as variable. Variables are defined in parent level so all API's will inherit them.

image

4. API Authorization must be Bearer Token and the token value reference the token variable

image

5. User API getAllUsers method retrieves all the registered users. Note that user id 51 has no task for now.

image

Task API

6. As an admin we can create task and assign it to user with any role type. Notice that the new task is assigned to user with id 51 - which previously didnt have a task.

image

But if you try to create a task as a user, you will receive a warning

image

7. You can customize task search by using following dynamic search criterias: taskId, taskStatus, taskPriority,authorId,assigneeId,page,size. You can use any of the filter. By default per page it shows 10 elements. If there are more than 10 elements, it will load second page

image image

8. Admin can delete tasks but users are not allowed.

image

image

Comment API

9. Admins can add comments to any task. Users can leave comment if only the task is assigned to them. For example, admin will add a new comment to task 1 of userId 50

image

image

If you try to add comment as a user with id different than 50, you will receive a warning.

image

Technologies

  • Java 17+
  • Spring Boot
  • PostgreSQL
  • Spring Security JWT
  • Docker

About

Task Management System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages