Skip to content

Abellybaba/proj2-reservation-python-api

Repository files navigation

  1. Introduction:

Overview of the Project: Our project is a restaurant reservation system aimed at facilitating the booking process for both customers and restaurant owners. It allows users to view available restaurants, make reservations, and manage their bookings. Restaurant owners can manage their establishments, tables, and reservations through an intuitive interface.

Purpose of the Documentation: This documentation serves as a comprehensive guide to the development process, design decisions, testing strategy, and deployment methodology of the restaurant reservation system. It provides insights into the technical and strategic choices made throughout the project, serving as a detailed record for stakeholders and future reference.

  1. Design Decisions:

Choice of Technologies:

Backend: Python with Flask framework for RESTful API development Frontend: React.js for interactive user interface Database: SQLite for local development and PostgreSQL for production Authentication: JWT (JSON Web Tokens) for secure user authentication Architecture Overview:

Client-server architecture with a RESTful API for communication Separation of concerns using MVC (Model-View-Controller) design pattern Frontend and backend hosted separately for scalability and maintainability Database Design:

Tables for users, restaurants, reservations, and related entities Relationships defined using foreign key constraints Normalization to minimize data redundancy and ensure data integrity Security Considerations:

Hashing and salting of passwords for secure storage JWT tokens with expiration and signature verification Input validation and sanitization to prevent SQL injection and XSS attacks Next, we'll continue with the Development Process section.

  1. Development Process:

Methodology: We adopted an Agile development approach, with iterative cycles and frequent feedback loops. This allowed us to adapt to changing requirements and deliver incremental updates. Daily stand-up meetings were held to discuss progress, address any issues, and plan the day's tasks.

Tools and Frameworks Used:

Backend: Python, Flask, SQLite Frontend: React.js, Axios for API calls Version Control: Git, hosted on GitHub IDE: Visual Studio Code for development Postman for API testing Docker for containerization Continuous Integration: GitHub Actions Collaboration and Communication:

Communication primarily through Slack and Zoom meetings GitHub issues and project boards used for task tracking and assignment Regular code reviews and pull requests to maintain code quality Now, let's proceed with the Testing Strategy section.

  1. Testing Strategy:

Types of Testing Performed:

Unit Testing: Individual components and functions tested in isolation to ensure correctness. Integration Testing: Interaction between different modules and components tested to verify seamless integration. End-to-End Testing: Entire system tested from the user's perspective to validate functionality and user experience. Tools and Techniques Used:

Unit Testing: Pytest framework for backend testing, Jest for frontend testing Integration Testing: Custom test suites using Pytest End-to-End Testing: Cypress.io for automated UI testing Test Data Generation: Faker library used to create realistic test data Test Coverage: Coverage.py for measuring code coverage and identifying areas for improvement Test Coverage and Results:

Aimed for high test coverage to ensure robustness and reliability of the system Regular test runs conducted during development and before deployment Test results monitored and analyzed to identify and fix any issues promptly Moving on to the Deployment Methodology section.

  1. Deployment Methodology:

Deployment Environment:

Local Development: Docker-compose for local development environment setup with Docker containers for backend, frontend, and database. Production: Deployed on cloud platform (e.g., AWS, Heroku) using container orchestration (e.g., Kubernetes) for scalability and reliability. Continuous Integration and Deployment:

GitHub Actions used for continuous integration and deployment pipeline Automated build and test runs triggered on each commit to the main branch Deployment to production environment after successful testing and approval Monitoring and Maintenance Approach:

Logging: Utilized logging libraries (e.g., Python logging module) for capturing runtime information and errors Monitoring: Set up monitoring tools (e.g., Prometheus, Grafana) to track system performance and uptime Maintenance: Regular updates and patches applied to keep the system secure and up-to-date Finally, we'll conclude with the Conclusion section.

  1. Conclusion:

Summary of Key Points:

The restaurant reservation system provides a seamless booking experience for users and restaurant owners. Design decisions were made to ensure scalability, security, and maintainability of the system. Agile development methodology facilitated iterative development and quick adaptation to changing requirements. Testing strategy ensured the reliability and correctness of the system through comprehensive test coverage. Deployment methodology focused on automation, scalability, and monitoring for efficient operation in production. Lessons Learned:

Importance of clear communication and collaboration within the development team. Continuous integration and deployment streamline the development process and ensure consistent quality. Rigorous testing is essential to catch bugs and issues early in the development lifecycle. Regular monitoring and maintenance are crucial for keeping the system healthy and responsive. Future Improvements:

Enhance user experience with additional features such as user reviews, ratings, and recommendations. Implement advanced security measures to protect against emerging threats and vulnerabilities. Optimize performance and scalability for handling increased traffic and user load. Expand platform compatibility by developing mobile applications for iOS and Android devices. This concludes the documentation for the restaurant reservation system, providing insights into its design, development process, testing strategy, and deployment methodology.

Endpoints

  1. Register User Endpoint POST /register Description Registers a new user in the system.

Request Body { "username": "example", "password": "password123", "email": "example@example.com", "fullname": "John Doe" }

Curl Example curl -X POST -H "Content-Type: application/json" -d '{"username":"example","password":"password123","email":"example@example.com","fullname":"John Doe"}' http://localhost:8000/register

  1. Login User Endpoint

POST /login Description Logs in an existing user and returns a JWT token for authentication.

Request Body json

{ "username": "example", "password": "password123" }

Curl Example curl -X POST -H "Content-Type: application/json" -d '{"username":"example","password":"password123"}' http://localhost:8000/login

  1. Get All Restaurants Endpoint GET /restaurants Description Returns a list of all restaurants in the system.

Curl Example curl http://localhost:8000/restaurants

  1. Add Restaurant Endpoint POST /add_restaurant Description Adds a new restaurant to the system. Request Body json

{ "name": "Example Restaurant", "address": "123 Main St, City", "contact": "123-456-7890", "opening_hours": "Mon-Sat: 10AM-8PM, Sun: 12PM-6PM", "img": "example.jpg", "desc": "A description of the restaurant.", "menu_items": "Menu items in JSON format." }

Curl Example curl -X POST -H "Content-Type: application/json" -d '{"name":"Example Restaurant","address":"123 Main St, City","contact":"123-456-7890","opening_hours":"Mon-Sat: 10AM-8PM, Sun: 12PM-6PM","img":"example.jpg","desc":"A description of the restaurant.","menu_items":"Menu items in JSON format."}' http://localhost:8000/add_restaurant

  1. Update Restaurant Endpoint PUT /update_restaurant/{restaurant_id} Description Updates an existing restaurant in the system.

Request Body json { "name": "Updated Restaurant Name", "address": "Updated Address", "contact": "Updated Contact", "opening_hours": "Updated Hours", "img": "updated.jpg", "desc": "Updated Description", "menu_items": "Updated Menu Items" } Curl Example curl -X PUT -H "Content-Type: application/json" -d '{"name":"Updated Restaurant Name","address":"Updated Address","contact":"Updated Contact","opening_hours":"Updated Hours","img":"updated.jpg","desc":"Updated Description","menu_items":"Updated Menu Items"}' http://localhost:8000/update_restaurant/1

  1. Delete Restaurant Endpoint DELETE /delete_restaurant/{restaurant_id} Description Deletes an existing restaurant from the system.

Curl Example curl -X DELETE http://localhost:8000/delete_restaurant/1

  1. Get Reservation Endpoint GET /reservation/{reservation_id} Description Returns details of a specific reservation.

Curl Example curl http://localhost:8000/reservation/1 8. Add Reservation Endpoint

POST /add_reservation Description Adds a new reservation to the system. Request Body json

{ "user_id": 1, "restaurant_id": 1, "date": "2022-04-11", "time": "20:00", "party_size": 4, "status": "confirmed", "special_requests": "Special requests for the reservation." }

Curl Example curl -X POST -H "Content-Type: application/json" -d '{"user_id":1,"restaurant_id":1,"date":"2022-04-11","time":"20:00","party_size":4,"status":"confirmed","special_requests":"Special requests for the reservation."}' http://localhost:8000/add_reservation 9. Update Reservation Endpoint

PUT /update_reservation/{reservation_id} Description Updates an existing reservation in the system. Request Body json

{ "user_id": 1, "restaurant_id": 1, "date": "2022-04-11", "time": "20:00", "party_size": 4, "status": "confirmed", "special_requests": "Special requests for the reservation." }

Curl Example curl -X PUT -H "Content-Type: application/json" -d '{"user_id":1,"restaurant_id":1,"date":"2022-04-11","time":"20:00","party_size":4,"status":"confirmed","special_requests":"Special requests for the reservation."}' http://localhost:8000/update_reservation/1 10. Delete Reservation Endpoint

DELETE /delete_reservation/{reservation_id} Description Deletes an existing reservation from the system.

Curl Example curl -X DELETE http://localhost:8000/delete_reservation/1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages