Skip to content

Bashmdz/calendar-backend

Repository files navigation

CalenTask

CalenTask-responsiveness

Table of Contents

Introduction and Project Goals

CalenTask is a Task Management System designed to help users organize and track their tasks efficiently. It allows users to register, create tasks, assign them to other users, and monitor their progress through an intuitive calendar interface.

Authentication App

Models

CustomUsers

  • name: CharField(max_length=256, null=True, blank=True)
  • email: EmailField(max_length=256, unique=True)
  • username: CharField(max_length=256, null=True, blank=True)
  • password: CharField(max_length=2048)
  • timestamp: DateTimeField(auto_now_add=True)

CustomUserManager

  • Provides custom methods for creating regular users and superusers.

Endpoints

  • validate: POST - Validate user credentials.
  • users: GET - Retrieve a list of users.
  • user: GET/POST - Retrieve or create a user.
  • user/<pk>: GET/PUT/DELETE - Retrieve, update, or delete a specific user.

API App

Models

Category

  • name: CharField(max_length=50, unique=True)

Task

  • title: CharField(max_length=256)
  • priority: CharField(max_length=10, choices=[("Important", "Important"), ("Medium", "Medium"), ("Low", "Low")], default="Medium")
  • category: ForeignKey(Category, on_delete=models.CASCADE)
  • progress: CharField(max_length=11, choices=[("Open", "Open"), ("In Progress", "In Progress"), ("Done", "Done")], default="Open")
  • startDate: DateField(default=timezone.now)
  • endDate: DateField()
  • attachment: FileField(null=True, blank=True, upload_to="static/attachments/")
  • description: TextField(blank=True, null=True)
  • timestamp: DateTimeField(default=timezone.now)

TaskAssigned

  • task: ForeignKey(Task, on_delete=models.CASCADE)
  • user: ForeignKey(CustomUsers, on_delete=models.CASCADE)
  • isOwner: BooleanField(default=False)
  • timestamp: DateTimeField(default=timezone.now)

Log

  • type: CharField(max_length=10, default="")
  • task: ForeignKey(Task, on_delete=models.CASCADE, blank=True, null=True)
  • user: ForeignKey(CustomUsers, on_delete=models.CASCADE, blank=True, null=True)
  • timestamp: DateTimeField(default=timezone.now)

Endpoints

  • categories: GET - Retrieve a list of categories.
  • tasks: GET/POST - Retrieve a list of tasks or create a new task.
  • tasks/<pk>: GET/PUT/DELETE - Retrieve, update, or delete a specific task.
  • task_assigned: GET/POST - Retrieve a list of task assignments or create a new assignment.
  • task_assigned/<pk>: GET/PUT/DELETE - Retrieve, update, or delete a specific assignment.
  • log_entries: GET/POST - Retrieve a list of log entries or create a new entry.
  • log_entries/<pk>: GET/PUT/DELETE - Retrieve, update, or delete a specific log entry.

Installation

  1. Clone the repository.
  2. Install dependencies: pip install -r requirements.txt.
  3. Make migrations: python manage.py makemigrations.
  4. Run migrations: python manage.py migrate.
  5. Start the development server: python manage.py runserver.

Tests

The tests in this section are written using Django's TestCase class. They cover the models in the authentication and API apps.

CustomUsersModelTestCase

  • Screenshot: View Task Page

This test case verifies the functionality of the CustomUsers model in the authentication app. It includes the following test methods:

  • test_create_user: Tests the creation of a user and checks if the email and string representation are set correctly.
  • test_unique_email: Tests that creating a user with an existing email raises an exception.
  • test_authentication: Tests if a user with a specific email exists in the database.
  • test_authorization: Tests if a user can be set as staff and superuser.

CategoryModelTestCase

  • Screenshot: View Task Page

This test case verifies the functionality of the Category model in the API app. It includes the following test method:

  • test_category_creation: Tests the creation of a category and checks if the name is set correctly.

TaskModelTestCase

  • Screenshot: View Task Page

This test case verifies the functionality of the Task model in the API app. It includes the following test method:

  • test_task_creation: Tests the creation of a task and checks if the title, priority, category, and progress are set correctly.

TaskAssignedModelTestCase

  • Screenshot: View Task Page

This test case verifies the functionality of the TaskAssigned model in the API app. It includes the following test method:

  • test_task_assigned_creation: Tests the creation of a task assignment and checks if the task, user, and isOwner flag are set correctly.

LogModelTestCase

  • Screenshot: View Task Page

This test case verifies the functionality of the Log model in the API app. It includes the following test method:

  • test_log_creation: Tests the creation of a log entry and checks if the type, task, and user are set correctly.

Deployment

CalenTask is deployed on Heroku using Heroku PostgreSQL as the database. By default, CalenTask uses SQLite3 as the database during development.

  1. Create a Heroku account and install the Heroku CLI.
  2. Log in to Heroku CLI (heroku login) and create a new Heroku app (heroku create).
  3. Set up Heroku PostgreSQL as the database (heroku addons:create heroku-postgresql).
  4. Push your code to the Heroku remote (git push heroku master).
  5. Run migrations and set up the database (heroku run python manage.py migrate).
  6. Your CalenTask application should now be deployed and accessible via the provided Heroku app URL.
  7. Your app should now be deployed and accessible via the provided Heroku URL.

Postman Collection

The Postman collection file for this project is located at "/postman/CalenTask.postman_collection.json". You can import this file into Postman to access the collection of API endpoints and test them.

To import the collection into Postman, follow these steps:

  1. Open Postman.
  2. Click on the "Import" button in the top left corner of the Postman interface.
  3. In the import dialog, select the "File" tab.
  4. Click on the "Choose Files" button and navigate to the location of the "CalenTask.postman_collection.json" file.
  5. Select the file and click on the "Open" button.
  6. Postman will import the collection and display it in the left sidebar under the "Collections" tab.
  7. You can now explore the collection and test the API endpoints by sending requests.

Importing the Postman collection allows you to easily interact with the API endpoints provided by the CalenTask Task Management System and test their functionality.

Variables

  • server_url: http://127.0.0.1:8000 (default value)

Future Functionalities

Logs

In the current implementation, the system saves logs for the creation, updation, and deletion of tasks. However, there is no interaction functionality for users to view these logs or receive notifications.

A future functionality to be added is the ability for users to interact with the logs. This can include features such as:

  • Viewing a log history for each task, displaying the date and time of each action.
  • Notifying users when a task they are assigned to has been modified or deleted.
  • Providing a notification center where users can view all their notifications.

Implementing these functionalities will enhance the user experience and improve the overall usability of the CalenTask Task Management System.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published