diff --git a/README.md b/README.md index 5c1edc7..df6f778 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,82 @@ -# todo-list-api -A web app that leverages a RESTful API to allow users to manage their to-do list while storing tasks in a Postgres database. +# Peak Performer + +**Tagline**: Because you're always on top of the mountain (or at least your to-do list). + +## Introduction + +Peak Performer is a simple yet robust to-do list application designed to keep you organized and productive. Built with Python and Flask, it leverages best practices in software design, including the Model-View-Controller (MVC) and Repository design patterns, ensuring scalability and maintainability. + +## Table of Contents + +- [Introduction](#introduction) +- [Features](#features) +- [Installation](#installation) +- [Usage](#usage) +- [Architecture](#architecture) + - [Model-View-Controller (MVC)](#model-view-controller-mvc) + - [Repository Design Pattern](#repository-design-pattern) +- [Dependencies](#dependencies) +- [Configuration](#configuration) +- [Troubleshooting](#troubleshooting) +- [Contributors](#contributors) +- [License](#license) + +## Features + +- User authentication (register, login, logout). +- Create, view, edit, and delete tasks. +- Role-based task management. +- API endpoint to fetch task details. +- Persistent data storage using PostgreSQL. + +## Installation + +1. Clone the repository: + ```bash + git clone https://github.com/your-repo/peak-performer.git + cd peak-performer + +2. Use the provided `run.sh` script to deploy application: + - Run `initial-setup` to: + - Create/load the virtual environment + - Insall depenencies + - Build PostgreSQL database + - + +Load environment variables: +bash +Copy code +./run.sh load-env +Set up a virtual environment and install dependencies: +bash +Copy code +./run.sh install-deps +Initialize the database: +bash +Copy code +./run.sh create-db + + +## Architecture +### Model-View-Controller (MVC) +- **Model:** + - Defined in `models.py`, representing `Users` and `Tasks` with SQLAlchemy. +- **View:** + - HTML templates (e.g., `login.html`, `view_tasks.html`) extend `base.html` for a consistent UI. + - Built with Bootstrap for responsive and elegant styling. +- **Controller:** + - Route handling and logic in `auth_controller.py` and `tasks_controller.py`. + +#### Benefits: +- Clear separation of concerns. +- Improved maintainability and scalability. + +## Repository Design Pattern +- **Repositories:** + - `UsersRepository`: Handles CRUD operations for user accounts. + - `TasksRepository`: Abstracts database logic for task management. +- **Advantages:** + - Centralized data access logic. + - Simplified testing by isolating database operations. +Centralized data access logic. +Simplified testing by isolating database operations. \ No newline at end of file diff --git a/src/api.py b/src/api.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/controller/tasks_controller.py b/src/controller/tasks_controller.py index c06ef3f..acce62f 100644 --- a/src/controller/tasks_controller.py +++ b/src/controller/tasks_controller.py @@ -23,7 +23,6 @@ def view_tasks(user_id): task_repo = TasksRespository(session) tasks = task_repo.find_tasks_by_user(user_id) session.close() - print("Tasks:", tasks) return render_template("view_tasks.html", tasks=tasks) @@ -111,7 +110,7 @@ def delete_task(user_id): task_repo = TasksRespository(session) tasks = task_repo.find_tasks_by_user(user_id) all_ids = [task.id for task in tasks] - print("All IDs: ", all_ids) + # Check if task belongs to the user if task_id not in all_ids: flash( diff --git a/src/services.py b/src/services.py deleted file mode 100644 index e69de29..0000000