Skip to content

akhilk2802/TaskSphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TaskSphere

This project was done as a part of Object Oriented Design (CSYE 6200) Course-work, and have been uploaded here from private university github profile.

TaskSphere is a collaborative project and task management system inspired by Kanban principles. It offers a visual board for streamlined project organization, allowing users to create, assign, and track tasks effectively. With features such as detailed task management, real-time progress monitoring, and user assignments, TaskSphere facilitates seamless collaboration. Authentication is handled through JWT tokens, ensuring secure user access. The system also supports export/import functionalities for efficient project management. TaskSphere aims to enhance team coordination and project success with its user-friendly interface and robust features.

Index

  1. Introduction
  2. Tech Stack
  3. Flows
  4. Concepts Used
  5. Individual Contributions
  6. Class Diagram
  7. Steps to Setup Backend
  8. Steps to Setup Frontend
  9. Swagger Documentation

Tech Stack

Backend: Java, Spring Boot, PostgreSQL, Spring Security, JWT, JPA, Rest API

Frontend: React, HTML, CSS, JS

Flows

User

The User Flow involves the creation, authentication, and management of users. Users can register and log in through the AuthenticationController, which uses the AuthenticationServiceImpl. User information is stored in the User entity, and passwords are securely encoded.

Upon successful registration or login, a JWT token is generated for user authentication. The Token entity represents these tokens, allowing secure access to protected endpoints.

Authentication

The Authentication Flow begins with the AuthenticationController, handling user registration and login endpoints. These are processed by the AuthenticationServiceImpl. The register function creates a new user and generates a JWT token, while login authenticates the user and returns a JWT token. The Token entity represents a user's authentication token.

Project

In the Project Flow, ProjectController manages endpoints for project operations. The ProjectServiceImpl provides functions for interacting with projects, including getting project details, creating, updating, and deleting projects, assigning users to projects, and exporting/importing projects from/to CSV files. The Project entity represents a project, and UserProject represents the relationship between users and projects.

Task

The Task Flow is handled by TaskController, including endpoints for tasks like getting task details, creating, updating, and deleting tasks, assigning tasks to users, and changing task priority and status. The TaskServiceImpl implements functions for these operations. The Task entity represents a task with properties like name, description, deadline, priority, status, associated project, assignee, and comments.

Concepts Used (Few Examples)

Inheritance

ProjectRequest extends ProjectDTO,

ProjectRepository extends JPARepository,

BadRequestException extends RuntimeException

Polymorphism In entity models: User.java, Task.java, Project.java, Token.java, JwtAuthenticationFilter.java etc.

toString, equals, logout, compare, compareTo, createProject, commence, doFilterInternal

LogoutService.java

@Override
    public void logout(
            HttpServletRequest request,
            HttpServletResponse response,
            Authentication authentication
    ) {
        final String authHeader = request.getHeader("Authorization");
        final String jwt;
        if (authHeader == null || !authHeader.startsWith("Bearer ")) {
            return;
        }
    }

APIs Interfaces & Implementations

AuthenticationServiceImpl implements AuthenticationService,

UserServiceImpl implements UserService,

UserProjectServiceImpl implements UserProjectService,

ProjectServiceImpl implements ProjectService,

TaskServiceImpl implements TaskService

Enums

Role Role.java : Admin, Manager, Developer

Task Priority Task Priority.java : Lowest, Low, Medium, High, Highest

Abstarct methods

public abstract ProjectDTO createProjectDto(Integer id, String name, String description); ProjectDtoFactory.java

Lambdas

TaskServiceImpl.java

List<TaskDTO> taskDTOList = taskStream
                .sorted()
                .map(this::mapToTaskDTO)
                .collect(Collectors.toList());
taskStream = taskStream.filter(task -> task.getPriority().equals(priority));

Inner classes

public static class UserProjectId implements Serializable - UserProject.java

public static class LastestCommentComparator implements Comparator<Comment> - Comment.java

Comparators Comment.java

public static class LastestCommentComparator implements Comparator<Comment> {

        @Override
        public int compare(Comment o1, Comment o2) {
            return o2.getCreatedAt().compareTo(o1.getCreatedAt());
        }
    }

Comparables Task.java

public class Task implements Comparable<Task> {
    @Override
    public int compareTo(Task o) {
        return Integer.compare(this.getPriority().getPriority(), o.getPriority().getPriority());
    }
}

Generics

TaskRepository extends JpaRepository<Task, Integer>,

ResponseEntity<TaskDTO>,

ResponseEntity<APIResponse>

Exception Handling

BadRequestException extends RuntimeException,

ResourceNotFoundException extends RuntimeException,

UnauthorizedException extends RuntimeException

CSV file handling Importing Project from CSV File (Reading CSV Files) - ProjectServiceImpl.java

public ResponseEntity<List<ProjectDTO>> importProject(File file) {
        ProjectFactory projectFactory = ProjectFactory.getInstance();
        List<ProjectDTO> list = new ArrayList<>();
        try (FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr)) {
            String inputLine = null;
            while ((inputLine = br.readLine()) != null) {
                String[] fields = inputLine.split(",");
                Project project = projectFactory.createProject(fields[0], fields[1]);
                projectRepository.save(project);
                list.add(new ProjectDTO(project.getId(), project.getName(), project.getDescription()));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return ResponseEntity.ok(list);
    }

String Builder ProjectServiceImpl.java

for (Project p : projects) {
                StringBuilder sb = new StringBuilder();
                sb.append(p.getId()).append(",");
                sb.append(p.getName()).append(",");
                sb.append(p.getDescription()).append(",");
                sb.append(p.getCreatedAt());
                bw.write(sb.toString());
                bw.newLine();

                list.add(new ProjectDTO(p.getId(), p.getName(), p.getDescription()));
            }

Design Patterns

  1. Repository Pattern:

    • UserRepository.java, TaskRepository.java
    • Provides a consistent and abstracted interface for data access, facilitating interactions with the underlying database for entities such as User, UserProject, Task, and Project.
  2. Factory Method Pattern:

  3. Singleton Pattern:

  4. Observer Pattern:

    • Task.java, Comment.java
    • Established implicitly through the bidirectional relationship between Task and Comment, allowing tasks to be observed for changes in the associated comments. Any changes in comments can be reflected in the task, providing a form of observation.
  5. Strategy Pattern:

    • TaskServiceImpl.java
    • The strategy pattern is not explicitly implemented in the code but can be considered in the TaskServiceImpl. The service class encapsulates algorithms for various task operations, providing a strategy for each operation.
  6. MVC (Model-View-Controller) Pattern:

  • packages: controller, service, repository, model, entity
  • The MVC pattern is implicitly applied in the task management module. The Controller acts as the controller, handling user input and directing it to the ServiceImpl for processing. The DTO & Entity serves as the model, representing the data, and the view is represented by the API endpoints, which return responses to the user.

Induvidual Contributions

Name NU ID Contributions
Aashish Chaple #002680570 Streams, Enums, Strategy Pattern, MVC Design Pattern
Akhileshkumar Kumbar #002201470 Lazy Singleton Design Pattern, Enum Singleton Factory Pattern
Akshay Bharadwaj #002745765 Observer Design Pattern, Streams, MVC Design Pattern
Pritesh Nimje #002817324 Repository Pattern, Observer Pattern, MVC Design Pattern, Streams
Ruchika Shashidhara #002245068 Comparable, Streams, Enum Singleton & Lazy Singleton Factory Pattern
Sai Geeta Acharya #002627749 Comparator, Inner Classes, Eager Singleton Factory Pattern
Yuchen Zhang #002646829 CSV Files, Repository Design Pattern, MVC Design Pattern

Class Diagram

tasksphere

Steps to Setup Backend

1. Clone the application

git clone https://github.com/CSYE6200-Object-Oriented-DesignFall2023/final-project-final-group-19.git

2. Create postgres database

create database 'TaskSphere'
  • run src/main/resources/tasksphere.sql

3. Run the app using maven

cd backend

mvn clean install

mvn spring-boot:run

The app will start running at http://localhost:8080

Steps to Setup Frontend

This project was bootstrapped with Create React App.

In the project directory, you can run:

cd frontend

npm i react-beautiful-dnd antd styled-components to install three packages and their dependenciess

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

You can learn more in the Create React App documentation.

Swagger documentation

Swagger documentation will be available at http://localhost:8080/swagger-ui/index.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published