Skip to content

MateuszSeler/task-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Task Manager App

๐Ÿ“Œ Project Overview

Task Manager is a web application designed to help teams organize and manage their projects efficiently. The application provides a structured approach to task management, ensuring that team members have clearly defined roles and responsibilities within each project. At its core, the system allows users to create projects, assign tasks, track progress, and collaborate through comments and file attachments. Access control is a key feature, ensuring that only authorized team members can view or modify project data. The application distinguishes between administrative roles (system-wide) and project-specific roles, enabling flexible permission management.

A built-in notification system informs users about important updates, such as new tasks, status changes, or comments on tasks they are assigned to. The default implementation uses email notifications via Gmail, but the system is designed to be easily extended to other communication platforms

Task Manager also includes cloud-based file storage integration, with Dropbox as the default provider. This allows team members to upload, retrieve, and manage attachments related to specific tasks. The file storage module is built in a way that makes it possible to add new providers or switch to an internal storage system if necessary.

The backend is implemented using Spring Boot, with authentication managed via JWT and Spring Security. Data persistence is handled through MySQL, with schema versioning managed by Liquibase. The application is fully containerized using Docker, and testing is automated with JUnit, Testcontainers, and MailHog.

๐Ÿš€ Features

โœ”๏ธ User authentication & authorization (JWT, Spring Security)
โœ”๏ธ Project Management โ€“ Create projects accessible only to team members.
โœ”๏ธ Task & Project management (CRUD operations, labels, attachments, comments)
โœ”๏ธAttachments โ€“ Upload and manage file attachments.
โœ”๏ธ Event-based notification system


๐Ÿ”น Technologies & Requirements

  • Java 17
  • Spring Boot
  • Maven as the build system
  • MySQL 8 as the database
  • Docker โ€“ Includes Dockerfile and docker-compose.yml
  • JUnit, Testcontainers โ€“ Integration and unit testing (running in Docker and MailHog)
  • Liquibase โ€“ Database versioning and migration

๐Ÿ“‚ Project Structure

The project follows a layered architecture to ensure maintainability, scalability, and clean separation of concerns. Below is the complete project structure along with its key components.

  • config/ โ€“ Contains configuration files, including security, object mapping, and external integrations (e.g., Dropbox).
  • controller/ โ€“ REST controllers responsible for handling HTTP requests.
  • dto/ โ€“ Data Transfer Objects, ensuring a clear separation between API responses and domain models.
  • exception/ โ€“ Custom exception handling to manage application errors gracefully.
  • mapper/ โ€“ Converts entities to DTOs and vice versa.
  • model/ โ€“ JPA entities representing the database structure.
  • repository/ โ€“ Spring Data JPA repositories for database access.
  • security/ โ€“ Security and authentication layer, including JWT handling and user authentication.
  • service/ โ€“ Business logic layer, handling application functionalities such as tasks, projects, and notifications.
  • validator/ โ€“ Custom validation classes, e.g., for email validation.

๐Ÿ” User Authentication & Authorization (JWT, Spring Security)

The application implements two levels of authorization:

  1. Global role-based access control (RBAC) using Spring Security
  2. Project-specific role management handled by the MemberService

๐Ÿ›ก๏ธ Role-Based Access Control (RBAC)

Each user has one of the following global roles:

  • ADMIN โ€“ Can manage users and edit the global set of labels.
  • USER โ€“ Assigned automatically upon registration. Users can create and manage their own projects.

๐Ÿ“Œ Project-Level Permissions

Each project has a list of members with different levels of access:

  • Manager (automatically assigned to the project creator)

    • Can add/remove members and managers
    • Can create, assign, and manage tasks
    • Can add labels
    • Can update project settings
  • Member (added by a manager)

    • Can comment on tasks
    • Can complete assigned tasks
    • Can attachted and download files
    • Can comment task and edit if they are the authors

๐Ÿ” Role Verification

Project roles are managed by the MemberService, which ensures that only authorized users can perform specific actions within a project.

The authentication mechanism uses:
โœ” JWT tokens for stateless authentication
โœ” Spring Security for endpoint protection

All API requests requiring authentication must include a JWT token in the `Authorization


๐Ÿ“Ž Attachments โ€“ Upload and Manage File Attachments

The application provides file attachment management with an integrated cloud storage solution.

๐Ÿ“‚ Storage Providers

Attachments can be stored using different storage providers. By default, the system supports Dropbox, but it is designed to be easily extended with additional storage services or a custom solution.

โœ” Dropbox Integration (default)
โœ” Expandable to other APIs or in-house storage systems

๐Ÿ—๏ธ File Storage Implementation

  • FileStorageProviderFactory dynamically provides the correct storage implementation.
  • Uses a service map approach, where services are registered using @Component("<PROVIDER_NAME>").
  • Example: Dropbox storage is registered as @Component("DROPBOX").

๐Ÿ” Dropbox Authentication Flow

Since Dropbox API requires OAuth 2.0, the application:

  1. Uses a refresh token to request a new access token.
  2. Stores the encrypted access token in the database.
  3. Automatically renews the token upon expiration.

๐Ÿ“Œ Features

โœ” Secure file upload & download
โœ” Storage provider abstraction for easy extension
โœ” Encrypted token storage for Dropbox authentication
โœ” Automatic token refresh on expiration


๐Ÿ”” Event-Based Notification System

The notification system ensures that users are informed about important project updates while maintaining flexibility, scalability, and performance.

๐Ÿ—๏ธ Architecture

โœ” Centralized event handling โ€“ ChangeManager serves as the main communication hub between the application and notification services.
โœ” Flexible event structure โ€“ ProjectEvent follows the Builder Pattern, allowing easy modification and extension.
โœ” Asynchronous processing โ€“ Notifications are sent concurrently, improving efficiency.
โœ” Expandable notification channels โ€“ Designed to integrate additional services (e.g., Slack, WebSockets).

๐Ÿ”„ Notification System Flow

1๏ธโƒฃ ChangeManager acts as the central notification coordinator, receiving and dispatching project-related events.

2๏ธโƒฃ ProjectEvent is a dynamic event model based on the Builder Pattern, allowing flexible event definitions. Any project-related event can be constructed dynamically without requiring multiple classes.

3๏ธโƒฃ Extending ProjectEvent is straightforward โ€“ just add a new field to the class and its constructor. Thanks to Lombok annotations, the builder pattern will automatically include it, simplifying modifications.

4๏ธโƒฃ Custom event types can be added when necessary โ€“ while ProjectEvent covers most scenarios, separate event classes (e.g., UserRegistrationEvent) can be introduced where needed.

5๏ธโƒฃ Notifications are processed asynchronously โ€“ The notification service utilizes multi-threading to handle multiple recipients in parallel. Messages are passed through a CompletableFuture pipeline, allowing easy integration of additional notification services.
ows seamless integration with other notification systems such as WebSockets, push notifications, or third-party services like Slack and Microsoft Teams.

๐Ÿ“Œ Components

  • ProjectEvent โ€“ Represents an event within the system (task updates, attachments, comments, etc.).
  • ChangeManager โ€“ Manages event processing and dispatches notifications.
  • NotificationService โ€“ Sends notifications through various channels.
  • EmailService โ€“ Handles email notifications (integrated with Gmail).

โœ‰๏ธ Email Notifications Configuration

By default, notifications are sent via email using Gmail SMTP, but additional notification methods (e.g., Slack, WebSockets, SMS) can be implemented.

โœ” Uses Spring Mail API
โœ” Supports email authentication & encryption
โœ” Easily extendable to other notification services

๐Ÿ“Œ Configuring Email Notifications

To enable email notifications, configure the following properties in application.properties:

spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=your-email@gmail.com
spring.mail.password=your-email-password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000

๐Ÿงช Testing & Configuration

The application includes unit tests, integration tests, and database migration tests using:

โœ” JUnit 5 โ€“ Unit and integration testing framework
โœ” Testcontainers โ€“ Runs database and email tests in Docker containers
โœ” MailHog โ€“ Email testing container
โœ” Mockito โ€“ Mocking dependencies for unit tests
โœ” Liquibase โ€“ Database migration verification

๐ŸŽฏ Test Strategy

Type Framework Purpose
Unit Tests JUnit 5, Mockito Testing individual components (services, validators, mappers)
Integration Tests Testcontainers Testing interaction with the database and external dependencies
Security Tests Spring Security Test Ensuring proper authentication & authorization
Email Tests MailHog (Docker) Testing email notifications

โš™๏ธ Test Configuration in application-test.properties

The integration tests use a temporary MySQL instance managed by Testcontainers, avoiding the need for a real database.

spring.datasource.url=jdbc:tc:mysql:8:///testdb
spring.datasource.username=test
spring.datasource.password=test

spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=true

spring.liquibase.change-log=classpath:db.testchangelog/db.changelog-master.yaml

spring.mail.host=localhost
spring.mail.port=1025
spring.mail.username=test
spring.mail.password=test

โš ๏ธ Exception Management & Logging

The application includes a centralized exception handling and logging system to ensure that errors are properly captured, logged, and returned to the client in a structured format.

๐Ÿ›  Centralized Exception Handling

All exceptions are handled globally in CustomGlobalExceptionHandler, so developers do not need to log errors manually in individual services or controllers.

โœ” Consistent error responses for API clients.
โœ” Automatic logging of all exceptions, including validation errors, authentication failures, and external API issues.
โœ” Separation of concerns, making it easy to extend exception handling without modifying business logic.

This means that whenever an exception occurs, it is automatically loggedโ€”developers donโ€™t need to write explicit logging statements for every error scenario.

The following exceptions are handled centrally:

Exception Type HTTP Status Description
MethodArgumentNotValidException 400 Bad Request Validation errors in API requests.
RegistrationException 400 Bad Request User registration failure.
AuthenticationException 401 Unauthorized Failed authentication attempts.
EntityNotFoundException 404 Not Found Requested resource not found.
DataProcessingException 400 Bad Request General data processing failure.
DropBoxProcessingException 500 Internal Server Error Dropbox API processing failure.

๐Ÿ“œ Structured Logging

The logging system captures key events and errors in separate logs to facilitate debugging and monitoring.

Log File Purpose
logs/errors.log Stores all critical application errors, managed centrally in CustomGlobalExceptionHandler.
logs/user-registrations.log Logs new user registration attempts, both successful and failed.
logs/app-events.log Captures important application events such as project creation, task assignments, and permission changes.

By maintaining separate log files, the system allows for better monitoring and faster issue resolution.

This approach keeps error management consistent, centralized, and scalable.


๐ŸŒ API Endpoints

Below is a summary of the main API endpoints.

๐Ÿ›ก๏ธ Authentication

Method Endpoint Description Auth Required
POST /authentication/registration Register a new user โŒ No
POST /authentication/login Authenticate and get JWT token โŒ No

๐Ÿ‘ค User Management

Method Endpoint Description Auth Required
GET /users/me Get own user profile โœ… Yes (USER)
PUT /users/me Update own profile โœ… Yes (USER)
GET /users/{userId} Get user by ID โœ… Yes (ADMIN)
DELETE /users/{userId} Delete user by ID โœ… Yes (ADMIN)

๐Ÿ—๏ธ Project Management

Method Endpoint Description Auth Required
POST /projects Create a new project โœ… Yes (USER)
GET /projects Get all of own user's projects โœ… Yes (USER)
GET /projects/{id} Get a specific project โœ… Yes (Member)
PUT /projects/{id} Update project details โœ… Yes (Manager)
DELETE /projects/{id} Delete a project โœ… Yes (Manager/Admin)

๐Ÿ“‹ Task Management

Method Endpoint Description Auth Required
POST /projects/{projectId}/tasks Create a new task โœ… Yes (Manager)
GET /projects/{projectId}/tasks Get all tasks in a project โœ… Yes (Member)
GET /projects/{projectId}/tasks/{taskId} Get a specific task โœ… Yes (Member)
PUT /projects/{projectId}/tasks/{taskId} Update a task โœ… Yes (Manager)
DELETE /projects/{projectId}/tasks/{taskId} Delete a task โœ… Yes (Manager)

๐Ÿ“ Attachments

Method Endpoint Description Auth Required
POST /projects/{projectId}/tasks/{taskId}/attachments/{apiName} Upload file โœ… Yes (Member)
GET /projects/{projectId}/tasks/{taskId}/attachments/{fileId} Download file โœ… Yes (Member)
DELETE /projects/{projectId}/tasks/{taskId}/attachments/{fileId} Delete file โœ… Yes (Manager)

๐Ÿ’ฌ Comments

Method Endpoint Description Auth Required
POST /projects/{projectId}/tasks/{taskId}/comments Add comment โœ… Yes (Member)
GET /projects/{projectId}/tasks/{taskId}/comments Get task comments โœ… Yes (Member)
PUT /projects/{projectId}/tasks/{taskId}/comments/{commentId} Edit comment โœ… Yes (Author)
DELETE /projects/{projectId}/tasks/{taskId}/comments/{commentId} Delete comment โœ… Yes (Manager/Author)

๐Ÿท๏ธ Labels

Method Endpoint Description Auth Required
POST /labels Create a new label โœ… Yes (Admin)
GET /labels Get all labels โœ… Yes (Admin)
PUT /labels/{labelId} Update label โœ… Yes (Admin)
DELETE /labels/{labelId} Delete label โœ… Yes (Admin)

๐Ÿ‘ฅ Team & Members

Method Endpoint Description Auth Required
POST /projects/{projectId}/members/{userId} Add member to project โœ… Yes (Manager)
DELETE /projects/{projectId}/members/{userId} Remove member โœ… Yes (Manager)
POST /projects/{projectId}/members/{userId}/managers Promote user to manager โœ… Yes (Manager)
DELETE /projects/{projectId}/members/{userId}/managers Revoke manager role โœ… Yes (Manager)

๐Ÿ›  Authentication via JWT tokens

All API endpoints require authentication via JWT tokens in the Authorization header: Authorization: Bearer <JWT_TOKEN>


๐Ÿ“œ Summary

Task Manager is a role-based project and task management system. The system is modular and allows for future extensions, including additional notification channels, integrations with external services, and UI enhancements.

๐Ÿ”ฎ Future Enhancements

Planned improvements and possible extensions:

1๏ธโƒฃ Task Dependency Chains โ€“ Ability to link tasks into logical sequences, ensuring that one task cannot start until another is completed.
2๏ธโƒฃ In-App Notifications โ€“ A notification center within the application for tracking important updates without relying on emails.
3๏ธโƒฃ Social Media & External Authentication โ€“ Integration with Google, Facebook, and other OAuth providers for faster and easier login.
4๏ธโƒฃ Project Timeline View โ€“ A visual timeline that helps teams track project progress over time.
5๏ธโƒฃ Calendar Integration โ€“ Syncing tasks and deadlines with calendar applications like Google Calendar and Outlook.

These features would further enhance collaboration, usability, and efficiency, making the system more adaptable to various team workflows.


๐Ÿ‘ค Author & Contact

Author: Mateusz Seler
๐Ÿ“ง Email: mate.tasks.manager@gmail.com

For any questions, suggestions, or contributions, feel free to reach out! ๐Ÿš€

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors