Skip to content

xaviermarquez-alba/casting-agency

Repository files navigation

Casting Agency API

Final project from Udacity Full Stack Nanodegree.

Live Host Heroku

URL: https://casting-agency-xaviermm.herokuapp.com

Casting Assist Token

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InhPR1JhQkdoNGRJVURMTXlMM3RiSiJ9.eyJpc3MiOiJodHRwczovL3hhdmllcm1tLmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw1ZWE2MThiOTZiNjliYzBjMTJkODFjOGUiLCJhdWQiOiJjYXN0aW5nLWFnZW5jeSIsImlhdCI6MTU4Nzk0NTkzMiwiZXhwIjoxNTg4NjM3MTMyLCJhenAiOiIwVzdJWWhuWmR3c1ptOHJDRWVESFQ4UGthUW5vZHFQdiIsImd0eSI6InBhc3N3b3JkIiwicGVybWlzc2lvbnMiOlsiZ2V0OmFjdG9ycyIsImdldDptb3ZpZXMiXX0.g2yRXA84xVaZTIpZxgggOeyKoU3A89bb2oqaYrJW4cDEoMwrHEW-6D4dJgOsPJPbwgWwIFpsvu4qPN7AhN-8XrFgNgZ3HfTal0p2Dt0gSmVtTzE11Ol1pRtuRqOK87-LXOFq99PXNyci8AvREeIlM4wET8GU3GxdxtwsCicSg26W-xYsTOMEg0YYOu6oxiCeEHssxeewiqsd9uqF6HIED8MlZOhiTlfDTL_reAF1h2nu4E6J9n6zvb3gkXZGtalJ8pL0WgDTI9ewwXnS69OQJZXsuG131N86eTwzPexCRpbH5QG8sxm4h8OvoamBFXTNAmESH7xS236vSwasz2OrPw

Casting Director Token

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InhPR1JhQkdoNGRJVURMTXlMM3RiSiJ9.eyJpc3MiOiJodHRwczovL3hhdmllcm1tLmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw1ZWE2MjMzMDZiNjliYzBjMTJkODMwNWQiLCJhdWQiOiJjYXN0aW5nLWFnZW5jeSIsImlhdCI6MTU4Nzk0NjQxM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WN0b3JzIiwicG9zdDptb3ZpZXMiXX0.NFzA-Mc7S8GrScsSk8uOgswCtVaxpndKQDHGT5-gprAXu3aW6m3AU93Li4qYZ9NvcB6K8rfGk2dERkZ62Erzr4OILfmj05IeIbSGlf1PFh-GakfkslC8ATOTh0x-3Bmcs5MNV9rbIVLdIQrmAIMfGezhMzGMd12DGRh2MX6k47Bw6lZVCuQfjlJmtJegZ7wTdYJ3me585qW8NRTjYKhNtKAxpZX-7brMc9nWhVwsgyFBigEYtudErULPGh2ZvaPlCMZn4PyqJHzciBmrTAlKrrl66tC3rl4wU1lu_0Xh-5SRKIq0SkG8c4j2siFU6ScDnPCzK695GpCQ2MKhDkEFdw

Local Deployment

1. Install Python

2. Setup Virtual Enviroment

virtualenv -p python3.7 venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Setup Environment Variables

The env variables can be set running setup.sh. Before running the script set the database URI string to your local database

sudo chmod +x setup.sh 
source ./setup.sh

5. Database Manage & Migrations

python manage.py db init
python manage.py db migrate
python manage.py db upgrade

Running the server

Finally to run the server:

flask run

Endpoints

GET '/movies'
GET '/actors'
POST '/movies'
POST '/actors'
POST '/movies/actors'
PATCH '/movies/<int:movie_id>'
PATCH '/actors/<int:actor_id>'
DELETE '/movies/<int:movie_id>'
DELETE '/movies/<int:actor_id>'

GET '/movies'

  • Fetches a list for all available movies
  • Request Arguments: None
  • Returns:
{
 'success': True,               # request status 
 'movies':                      # List of dicts { 'tile', 'release_date' }
}

GET '/actors'

  • Fetches a list for all available actors
  • Request Arguments: None
  • Returns:
{
 'success': True,               # request status 
 'actors':                      # List of dicts { 'name', 'age', 'gender' }
}

POST '/movies'

  • Create a new movie, require the title and release date

  • Request Arguments:

    • title: string
    • release_date: string, date format (YYYY-MM-DD)
  • Returns:

{
    'success': True,
    'movie_id':                          # ID of the new created movie
}

POST '/actors'

  • Create a new actor, require the name, age and gender

  • Request Arguments:

    • name: string
    • gender: string
    • age: int
  • Returns:

{
    'success': True,
    'actor_id':                          # ID of the new created actor
}

POST '/movies/actors'

  • Create a new relation movie-actor require the movie and actor id

  • Request Arguments:

    • movie_id: int
    • actor_id: int
  • Returns:

{
    'success': True,
    'actor_id':                          # ID of the actor
    'movie_id':                          # ID of the movie
}

PATCH '/movie/movie_id'

  • Update the title and/or release date

  • Request Arguments:

    • movie_id: int
    • tile: new movie title
    • release_date: new release date
  • Returns:

{
    'success': True,
    'movie_id':                 # ID of the updated movie
} 

PATCH '/actors/actor_id'

  • Update the name, age, gender of an actor

  • Request Arguments:

    • actor_id: int
    • name: string
    • age: int
    • gender: string
  • Returns:

{
    'success': True,
    'actor_id':                 # ID of the updated actor
} 

DELETE '/movie/movie_id'

  • Delete a movie

  • Request Arguments:

    • movie_id: int
  • Returns:

{
    'success': True,
    'movie_id':                 # ID of the deleted movie
} 

DELETE '/actors/actor_id'

  • Delete an actor

  • Request Arguments:

    • actor_id: int
  • Returns:

{
    'success': True,
    'actor_id':                 # ID of the deleted actor
} 

Testing

To run the Test Cases:

python test_app.py

About

Final Project Udacity Fullstack Nanodegree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published