https://github.com/mammet-tech/lateshow-edwin-mammet
A Flask REST API to manage late show episodes, guests, and appearances. Built with SQLAlchemy, Flask-Migrate, and SQLite.
https://github.com/mammet-tech/lateshow-edwin-mammet
flask flask-migrate flask-sqlalchemy postman python sqlite
Last synced: 8 months ago
JSON representation
A Flask REST API to manage late show episodes, guests, and appearances. Built with SQLAlchemy, Flask-Migrate, and SQLite.
- Host: GitHub
- URL: https://github.com/mammet-tech/lateshow-edwin-mammet
- Owner: Mammet-tech
- Created: 2025-06-21T20:48:24.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-06-26T11:01:14.000Z (9 months ago)
- Last Synced: 2025-06-26T11:47:53.840Z (9 months ago)
- Topics: flask, flask-migrate, flask-sqlalchemy, postman, python, sqlite
- Language: Python
- Homepage:
- Size: 12.6 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐บ Late Show API
This is a RESTful API built with Flask for tracking guests and episodes on a late night show.
---
## ๐ Project Structure
```
.
โโโ __pycache__/
โโโ instance/
โ โโโ app.db
โโโ migrations/
โ โโโ versions/
โ โโโ env.py
โ โโโ README
โ โโโ script.py.mako
โโโ venv/
โโโ app.py
โโโ models.py
โโโ README.md
โโโ requirements.txt
```
---
## โ๏ธ Technologies Used
- Python 3.8+
- Flask
- Flask-SQLAlchemy
- Flask-Migrate
- SQLite
- Postman (for API testing)
---
## ๐ Setup Instructions
### 1. Clone the Repository
```bash
git clone https://git@github.com:Mammet-tech/lateshow-edwin-mammet.git
cd lateshow-edwin-mammet
```
### 2. Create Virtual Environment
```bash
pipenv install
pipenv shell
```
### 3. Set Flask Environment Variables
```bash
export FLASK_APP=app.py
export FLASK_RUN_PORT=5555
```
### 4. Run Migrations
```bash
flask db init
flask db migrate -m "Create tables"
flask db upgrade
```
### 5. Seed the Database
You may run your own `seed.py` or import the provided CSV file to populate the database.
---
## ๐งช API Endpoints
### โ
GET /episodes
Returns all episodes:
```json
[
{
"id": 1,
"date": "1/11/99",
"number": 1
},
]
```
---
### โ
GET /episodes/
Returns a single episode with its appearances:
```json
{
"id": 1,
"date": "1/11/99",
"number": 1,
"appearances": [
{
"id": 1,
"rating": 4,
"guest_id": 1,
"episode_id": 1,
"guest": {
"id": 1,
"name": "Michael J. Fox",
"occupation": "actor"
}
}
]
}
```
If not found:
```json
{
"error": "Episode not found"
}
```
---
### โ
GET /guests
Returns all guests.
---
### โ
POST /appearances
Creates a new guest appearance.
**Request Body**:
```json
{
"rating": 5,
"episode_id": 2,
"guest_id": 3
}
```
**Valid Response**:
```json
{
"id": 162,
"rating": 5,
"guest_id": 3,
"episode_id": 2,
"episode": {
"date": "1/12/99",
"id": 2,
"number": 2
},
"guest": {
"id": 3,
"name": "Tracey Ullman",
"occupation": "television actress"
}
}
```
**Validation Error**:
```json
{
"errors": ["validation errors"]
}
```
---
## ๐ฌ Testing in Postman
1. Open Postman
2. Import the provided Postman collection:
`challenge-4-lateshow.postman_collection.json`
3. Test all the endpoints using real or seed data.
---
## ๐ง Author
**Edwin Mammet**
---
## ๐ License
This project is licensed under the MIT License.