- This project is the final project of Udacity's Full Stack Web Developer Nano Degree Course and I have learned a lot of things likes how to write the testing, documentation, implementation from sketch. In this project, I developed by using the knowledge that giving from this course.
Casting Agency - This project is providing the api for casting agency application that include assistant, director and producer roles. Eash of the role has their own authorization.
-
Assistant Role
- Can view actors and movies
-
Director Role
- All permissions a Casting Assistant has and…
- Add or delete an actor from the database
- Modify actors or movies
-
Producer Role
- All permissions a Casting Director has and…
- Add or delete a movie from the database
-
Python 3.7 - Follow instructions to install the latest version of python for your platform in the python docs
-
Virtual Enviornment - We recommend working within a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organaized. Instructions for setting up a virual enviornment for your platform can be found in the python docs
-
PIP Dependencies - Once you have your virtual environment setup and running, install dependencies by naviging to the
/backend
directory and running:
pip install -r requirements.txt
This will install all of the required packages we selected within the requirements.txt
file.
- Key Dependencies
-
Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.
-
SQLAlchemy is the Python SQL toolkit and ORM we'll use handle the lightweight sqlite database. You'll primarily work in app.py and can reference models.py.
-
Flask-CORS is the extension we'll use to handle cross origin requests from our frontend server.
With Postgres running, restore a database using the trivia.psql file provided. From the backend folder in terminal run:
flask db init
flask db migrate
flask db update
$env:FLASK_APP = "app.py"
$env:FLASK_ENV="development"
flask run
The --development
flag will detect file changes and restart the server automatically.
-
Assistant
- Email : [email protected]
- Password : Udacity!23
- Token : eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlUzTTViVTlzZEt3SGZHRE1neHVlTyJ9.eyJpc3MiOiJodHRwczovL2x3aW5hZ2VuY3kudXMuYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDYxMzg4MWQ5NGZlYzZkMDA2ODJhNGQ0MSIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6OTEwMCIsImlhdCI6MTYzMTk1NDE1MSwiZXhwIjoxNjMyMDQwNTUxLCJhenAiOiJ3RVdjSjFWNGQ2NHFDb3Vnc3k5c1o3RTAybm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9TkX_GqytikogGk_VqbP-mIRp_jnp457H4uj8tpow
https://lwinagency.us.auth0.com/authorize?audience=http://localhost:9100&response_type=token&client_id=wEWcJ1V4d64qCougsy9sZ7E02nkXhdDT&redirect_uri=http://localhost:9100/main
https://lwinagency.herokuapp.com/
-
Description: Returns a list movies.
-
Sample:
http://localhost:5000/movies?page=1
{ "movies": [ { "actors": [ { "age": 80, "gender": "Male", "id": 2, "name": "Jack Nicholson" } ], "id": 3, "release_date": "09/2020", "title": "John Wick2" }, { "actors": [ { "age": 65, "gender": "Male", "id": 3, "name": "Jack Nicholson" }, { "age": 80, "gender": "Male", "id": 2, "name": "Jack Nicholson" } ], "id": 4, "release_date": "09/2020", "title": "John Wick2" } ], "success": true, "total_movies": 2 }
-
Description: Returns a list actors.
-
Sample:
http://localhost:5000/actors?page=1
{ "actors": [ { "age": 65, "gender": "Male", "id": 3, "name": "Jack Nicholson" }, { "age": 65, "gender": "Male", "id": 4, "name": "Jack Nicholson" }, { "age": 80, "gender": "Male", "id": 2, "name": "Jack Nicholson" } ], "success": true, "total_actors": 3 }
-
Description:
- Creates a new actor
- Returns JSON object with newly created actor
-
Sample: POST Method`http://localhost:5000/actors'
- Sample Request Body
{ { "name":"Jack Nicholson", "age":65, "gender": "Male" } }
- Sample Response
{ "actor_created": "Jack Nicholson", "actors": [ { "age": 65, "gender": "Male", "id": 2, "name": "Jack Nicholson" }, { "age": 65, "gender": "Male", "id": 3, "name": "Jack Nicholson" }, { "age": 65, "gender": "Male", "id": 4, "name": "Jack Nicholson" } ], "success": true, "total_actors": 3 }
-
Description:
- Creates a new movie
- Returns JSON object with newly created movie
-
Sample: POST Method`http://localhost:5000/movies'
- Sample Request Body
{ "title":"John Wick2", "release_date":"09/2020", "actors":[2,3] }
- Sample Response
{ "movie_created": "John Wick2", "movies": [ { "id": 3, "release_date": "09/2020", "title": "John Wick2" }, { "id": 4, "release_date": "09/2020", "title": "John Wick2" } ], "success": true, "total_movies": 2 }
-
Description:
- Update actor
- Returns JSON object with updated actor
-
Sample: PATCH Method`http://localhost:5000/actors/2'
- Sample Request Body
{ "age":80 }
- Sample Response
{ "actor": { "age": 80, "gender": "Male", "id": 2, "name": "Jack Nicholson" }, "success": true }
-
Description:
- Update movie
- Returns JSON object with updated movie
-
Sample: PATCH Method`http://localhost:5000/movies/3'
- Sample Request Body
{ "actors":[2] }
- Sample Response
{ "movie": { "actors": [ { "age": 80, "gender": "Male", "id": 2, "name": "Jack Nicholson" } ], "id": 3, "release_date": "09/2020", "title": "John Wick2" }, "success": true }
-
Description:
- Deletes a actor by id
- Returns id of deleted actor upon success.
-
Sample: Delete Method
http://localhost:5000/actors/2
{ "actors": 2, "success": true }
-
Description:
- Deletes a actor by id
- Returns id of deleted actor upon success.
-
Sample: Delete Method
http://localhost:5000/movies/2
{ "movies": 2, "success": true }