Skip to content

gabrielcnunez/text-notification-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NotifyMe, a RESTful Python API

Smartphone with Notification Alerts

NotifyMe was designed and developed to simulate a text notification service. The application contains seven endpoints for creating, reading, and updating templates and notifications, as well as a robust testing suite exploring both happy and sad user paths.


Table of Contents


Planning and Design

database schema


Design Decisions:

  • In place of an Object Relational Mapper, raw SQL queries were used to obtain appropriate database information
  • All endpoints methods contained in single app.py file to reflect simplicity of application

Developer Setup

  1. Clone this repository
  2. cd into the root directory
  3. Create virtual environment python3 -m venv .venv
  4. Activate virtual environment source .venv/bin/activate
  5. To install requirements run: pip3 install -r requirements.txt
  6. To run locally and request endpoints: flask --app app run

How to Run Test Suite

  • cd into the root directory
  • While in an active virtual environment, run pytest in the command line

Available Endpoints

Get all Templates
  • GET "/template"
  • Sample response body:
    [
        {
            "body": "Hello, (personal). How are you today, (personal)?",
            "id": 1
        },
        {
            "id": "Goodbye, (personal). Have a great day, (personal)!",
            "id": 2
        }
    ]
    
Get one Template
  • GET "/template/1"
  • Sample response body:
    {
        "body": "Hello, (personal). How are you today, (personal)?",
        "id": 1,
    }
    
Create a Template
  • POST "/template"
  • Sample request body:
    {
        "body": "Happy birthday, (personal)!"
    }
    
  • Sample response body:
    {
        "body": "Happy birthday, (personal)!",
        "id": 3
    }
    
Update a Template
  • PUT "/template/3"
  • Sample request body:
    {
        "body": "Many happy returns, (personal)!"
    }
    
  • Sample response body:
    {
        "body": "Many happy returns, (personal)!",
        "id": 3
    }
    
Get all Notifications
  • GET "/notification"
  • Sample response body:
    [
        {
            "id": "1",
            "personalization": "Jenny",
            "phone_number": "+15208675309",
            "template_id": 1
        },
        {
            "id": "2",
            "personalization": "Linda",
            "phone_number": "+12125554444",
            "template_id": 2
        },
        {
            "id": "3",
            "personalization": "Joe",
            "phone_number": "+12022051600",
            "template_id": 1
        }
    ]
    
Get one Notification
  • GET "/notification/1"
  • Sample response body:
    {
        "content": "Hello, Jenny. How are you today, Jenny?"
        "id": "1",
        "personalization": "Jenny",
        "phone_number": "+15208675309",
        "template_body": "Hello, (personal). How are you today, (personal)?"
    }
    
Create a Notification
  • POST "/api/v1/favorites"
  • Sample request body:
    {
        "phone_number": "+15709876543",
        "personalization": "Michael Scott",
        "template_id": 2
    }
    
  • Sample response body:
    {
        "content": "Goodbye, Michael Scott. Have a great day, Michael Scott!"
        "id": "4",
        "personalization": "Michael Scott",
        "phone_number": "+15709876543",
        "template_body": "Goodbye, (personal). Have a great day, (personal)!"
    }
    

Stretch Goals and Refactors

  • Coverage reports
  • Containerization using Docker
  • Creating YAML file to display user endpoints graphically with Swagger UI
  • DRY-ing up code in app.py file to slim down methods
  • Mocking test data using factories
  • Using an ORM (such as SQLAlchemy) to convert information into objects for easier data manipulation
  • Abstracting models, routes, and controllers into an MVC-style architecture

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published