Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Late Show API

The **Late Show API** is a Flask-based RESTful API designed to manage episodes, guests, and their appearances on a late-night talk show. It provides endpoints to create, read, update, and delete data for episodes, guests, and their appearances, along with database seeding and migrations.

## Features

- **Episodes Management**: Create, retrieve, update, and delete episodes.
- **Guests Management**: Manage guest information, including their name and occupation.
- **Appearances Management**: Track guest appearances on specific episodes with ratings.
- **Database Seeding**: Populate the database with sample data using the `Faker` library.
- **Database Migrations**: Manage schema changes using Alembic and Flask-Migrate.
- **RESTful API**: Fully RESTful endpoints for CRUD operations.

## Project Structure

late-show/ ├── app/ │ ├── init.py # App factory and initialization │ ├── models/ # Models for database tables │ │ ├── init.py # Import all models here │ │ ├── episode.py # Episode model │ │ ├── guest.py # Guest model │ │ ├── appearance.py # Appearance model │ ├── routes/ # API routes │ │ ├── init.py # Import all routes here │ │ ├── episode.py # Episode routes │ │ ├── guest.py # Guest routes │ │ ├── appearance.py # Appearance routes │ ├── extensions.py # Extensions like db, migrate │ ├── config.py # Configuration for the app │ ├── seed.py # Database seeding script ├── migrations/ # Alembic migrations ├── instances/ │ ├── lateShowDb.sqlite3 # SQLite database ├── run.py # Entry point for the app ├── Pipfile # Dependencies


## Installation

1. Clone the repository:
   ```bash
   git clone <repository-url>
   cd late-show
  1. Install dependencies using pipenv:

    pipenv install
  2. Activate the virtual environment:

    pipenv shell
  3. Set up the database:

    flask db upgrade
  4. Seed the database with sample data:

    python app/seed.py
  5. Run the application:

    python run.py

API Endpoints

Episodes

  • GET /episodes: Retrieve all episodes.
  • GET /episodes/<id>: Retrieve a specific episode by ID.
  • POST /episodes: Create a new episode.
  • PUT /episodes/<id>: Update an existing episode.
  • PATCH /episodes/<id>: Partially update an episode.
  • DELETE /episodes/<id>: Delete an episode.

Guests

  • GET /guests: Retrieve all guests.
  • GET /guests/<id>: Retrieve a specific guest by ID.
  • POST /guests: Create a new guest.
  • PUT /guests/<id>: Update an existing guest.
  • PATCH /guests/<id>: Partially update a guest.
  • DELETE /guests/<id>: Delete a guest.

Appearances

  • GET /appearances: Retrieve all appearances.
  • GET /appearances/<id>: Retrieve a specific appearance by ID.
  • POST /appearances: Create a new appearance.
  • PUT /appearances/<id>: Update an existing appearance.
  • PATCH /appearances/<id>: Partially update an appearance.
  • DELETE /appearances/<id>: Delete an appearance.

Configuration

The application uses a SQLite database by default. You can configure the database URI in app/config.py:

SQLALCHEMY_DATABASE_URI = 'sqlite:///instances/lateShowDb.sqlite3'

Database Migrations

To manage database schema changes, use Flask-Migrate:

  • Create a new migration:
    flask db migrate -m "Migration message"
  • Apply migrations:
    flask db upgrade

Seeding the Database

To populate the database with sample data, run:

python seed.py

Dependencies

  • Flask: Web framework.
  • Flask-SQLAlchemy: ORM for database interactions.
  • Flask-Migrate: Database migrations.
  • Flask-RESTful: RESTful API support.
  • SQLAlchemy-Serializer: Serialization for models.
  • Faker: Generate fake data for seeding.

Development

To contribute to this project:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Email me: jeyceejeyka635@gmail.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages