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.
- Planning and Design
- Developer Setup
- How to Run Test Suite
- Available Endpoints
- Stretch Goals and Refactors
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
- Clone this repository
cd
into the root directory- Create virtual environment
python3 -m venv .venv
- Activate virtual environment
source .venv/bin/activate
- To install requirements run:
pip3 install -r requirements.txt
- To run locally and request endpoints:
flask --app app run
cd
into the root directory- While in an active virtual environment, run
pytest
in the command line
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)!" }
- 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