The Task Manager API is a microservice-based solution that helps manage users, authentication, and task assignments. The API consists of two main services:
- Authentication Service: Manages user registration, login, token validation and user data management.
- Task Management Service: Manages tasks, assignments, and notifications.
- User registration and login
- Token-based authentication
- User profile management
- Create, update, retrieve, and delete tasks
- Assign tasks to users
- List tasks with filters
- Backend Framework: Spring Boot
- Database: MySQL
- Authentication: JWT (JSON Web Token)
- Communication: RESTful APIs
- Messaging: Kafka
-
Java 17 or higher
-
Maven
-
MySQL :
-
Install MySQL
- For Windows:
- Download the MySQL installer from the official MySQL website: https://dev.mysql.com/downloads/installer/
- Run the installer and follow the on-screen instructions.
- During the setup, ensure that MySQL Server is selected.
- For Linux:
- Update your package index and install MySQL:
sudo apt update sudo apt install mysql-server
- Start MySQL and enable it to run on boot:
sudo systemctl start mysql sudo systemctl enable mysql
- For Windows:
-
Log in to MySQL
cd task_manager/script/ mysql -u root -p
- Once MySQL is installed and running, execute the script/Task_manager_script.sql file to set up the necessary database tables.
source Task_manager_script.sql;
-
-
Kafka:
- Install Kafka
- For Windows:
- Download the Kafka binaries from the official Apache Kafka website: https://kafka.apache.org/downloads
- Extract the downloaded file to a directory.
- Navigate to the Kafka directory and start the Zookeeper server:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
- Start the Kafka server:
.\bin\windows\kafka-server-start.bat .\config\server.properties
- Create a topic named notification:
.\bin\windows\kafka-topics.bat --create --topic notification --bootstrap-server localhost:9092
- For Linux:
- Download the Kafka binaries from the official Apache Kafka website: https://kafka.apache.org/downloads
- Extract the downloaded file to a directory.
- Navigate to the Kafka directory and start the Zookeeper server:
bin/zookeeper-server-start.sh config/zookeeper.properties
- Start the Kafka server:
bin/kafka-server-start.sh config/server.properties
- Create a topic named example:
bin/kafka-topics.sh --create --topic example --bootstrap-server localhost:9092
- For Windows:
- Install Kafka
git clone https://github.com/bavllymagid/task_manager.git
cd task_manager
cd user-management
mvn clean install
cd ../task-management
mvn clean install
- There's an application.properties file in each microservice's src/main/resources directory, configure database connection in it.
spring.datasource.url=jdbc:mysql://localhost:3306/(your_database_name)
spring.datasource.username=(your_username)
spring.datasource.password=(your_password)
- Authentication Service:
http://localhost:8080
- Task Management Service:
http://localhost:8081
- Endpoint:
POST /api/users/register
- Description: Registers a new user.
- Request Body:
{ "username": "exampleUsername", "email": "exampleEmail@example.com", "password": "@examplePassword1" }
- Endpoint:
POST /api/users/login
- Description: Logs in a user and returns a JWT token.
- Request Body:
{ "email": "exampleEmail@example.com", "password": "@examplePassword1" }
- Endpoint:
PUT /api/users/update
- Description: Updates user information.
- Authentication: Bearer Token
- Request Body:
{ "username": "exampleUsername3", "email": "exampleEmail@example.com", "password": "@examplePassword1" }
- Endpoint:
DELETE /api/users/delete
- Description: Deletes a user.
- Authentication: Bearer Token
- Query Parameters:
email
: User Email
- Endpoint:
GET /api/users/get_users
- Authentication: Bearer Token
- Description: Retrieves all users.
- Query Parameters:
page
: Page number (default: 0)size
: Page size (default: 20)
- Endpoint:
GET /api/users/get_user
- Authentication: Bearer Token
- Description: Retrieves a user by Email.
- Query Parameters:
email
: User Email
- Endpoint:
GET /api/users/logout
- Authentication: Bearer Token
- Description: Logs out a user.
- Endpoint:
GET /api/token/validate
- Authentication: Bearer Token
- Description: Validates a JWT token.
- Endpoint:
GET /api/token/refresh
- Authentication: Bearer Token
- Description: Refreshes the access token.
- Endpoint:
POST /api/task/create
- Authentication: Bearer Token
- Description: Creates a new task.
- Request Body:
{
"title": "Sample Task Title",
"description": "This is a detailed description of the task.",
"status": "In Progress",
"dueDate": "2024-10-15T12:45:00"
}
- Endpoint:
GET /api/task/get/user_tasks/{userId}
- Authentication: Bearer Token
- Description: Retrieves tasks created by a specific user.
- Query Parameters:
page
: Page number (default: 0)size
: Page size (default: 20)
- Endpoint:
GET /api/task/get/{taskId}
- Authentication: Bearer Token
- Description: Retrieves a task by ID.
- Endpoint:
PUT /api/task/update
- Authentication: Bearer Token
- Description: Updates task details.
- Request Body:
{
"taskId": 1,
"title": "New Title",
"description": "Updated task description.",
"status": "Completed",
"dueDate": "2024-11-15T12:45:00"
}
- Endpoint:
DELETE /api/task/delete/{taskId}
- Authentication: Bearer Token
- Description: Deletes a task.
- Endpoint:
POST /api/task/assign/{taskId}
- Authentication: Bearer Token
- Description: Assigns a task to a user.
- Request Body:
[1, 2, 3]
- Endpoint:
GET /api/task/get/user_assigned_tasks/{userId}
- Authentication: Bearer Token
- Description: Retrieves tasks assigned to a specific user.
- Query Parameters:
page
: Page number (default: 0)size
: Page size (default: 20)
- Endpoint:
DELETE /api/task/unassign/{taskId}
- Authentication: Bearer Token
- Description: Unassigns a task from a user.
- Request Body:
[1, 2, 3]
- Endpoint:
DELETE /api/task/unassign/all/task/{userId}
- Description: Unassigns all tasks from a user.
- Authentication: Bearer Token
- Endpoint:
GET /api/task/notification/send
- Authentication: Bearer Token
- Description: Sends notifications to user.
- Query Parameters:
size
: Page size (default: 20)page
: Page number (default: 0)
- Endpoint:
PUT /api/task/notification/update_status
- Authentication: Bearer Token
- Description: Updates notification read status.
- Query Parameters:
notificationId
: Notification ID
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin feature/your-feature
- Create a new Pull Request
For any questions or issues, please contact Me.