This project allow students to apply the skills learnt in this program.
- Create data models representing
Movies
,Actors
inmodels.py
. - use
auth.py
to verify permissions of the user role. - perform database migrations.
- API flask server for
CRUD
inapp.py
- Automated tests in
test_app.py
- deploy application to heroku.
- Python/Flask
- Auth0
- SQLAlchemy
- Flask-Migrate
- Flask-Cors
- Flask-Script
$ virtualenv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt
$ source ./setup.sh
$ python3 manage.py db init
$ python3 manage.py db migrate
To run the server, execute:
$ export FLASK_APP=app
$ export FLASK_ENV=development
$ FLASK_AP=app.py flask run
Setting the FLASK_ENV variable to development will detect file changes and restart the server automatically. Setting the FLASK_APP variable to app directs flask to use the app.py file, which contains the main app methods.
$ python3 test_app.py
https://fsndp-capstone.herokuapp.com/
Authentication is done via Auth0 Login with the following:
1.Casting assistant:
- to view actors
GET /actors (get:actors)
- to view movies
GET /movies (get:movies)
2.Casting Director:
- to view actors
GET /actors (get:actors)
- to view movies
GET /movies (get:movies)
- update actors
PATCH /actors (update:actors)
- update movies
PATCH /movies (update:movies)
- add actors
POST /actors (post:actors)
- remove actors
DELETE /actors (delete:actors)
3.Executive Producer:
- to view actors
GET /actors (get:actors)
- to view movies
GET /movies (get:movies)
- update actors
PATCH /actors (update:actors)
- update movies
PATCH /movies (update:movies)
- add actors
POST /actors (post:actors)
- remove actors
DELETE /actors (delete:actors)
- add movies
POST /movies (post:movies)
- remove movies
DELETE /movies (delete:movies)
GET /
- description: simple health check
- request arguments:
None
- returns a status health check of the app
Resource Movies:
GET /movies
- description: list of movies
- required-permission:
get:movies
- request arguments: None
- returns: list of movies
{
"success": True,
"movies": [{
id: 1,
title: "Dwayne Johnson",
release_date: "Tue, 14 July 2020 00:00:00 GMT"
}]
}
POST /movies
-
description: creates movies
-
required-permission:
post:movies
-
request arguments:
- title (required):
string
- release_date (required):
string
- title (required):
-
returns: status and data of newly created movie
{
"success": True,
"movies": [{
id: 2,
title: "MI3",
release_date: "Mon, 13 July 2020 00:00:00 GMT"
}]
}
PATCH /movies/<id>
-
description: updates movie
-
required-permission:
patch:movies
-
request arguments:
- title (optional):
string
- release_date (optional):
date
- title (optional):
-
returns status of updated movie
{
"success": True,
"movies": [{
id: 2,
title: "MI2",
release_date: "Mon, 13 July 2020 00:00:00 GMT"
}]
}
DELETE /movies/<id>
- description: deletes movie
- required-permission:
delete:movies
- request arguments: None
- return status of deleted movie
{
"success": True,
"delete": 2
}
Resource Actors:
GET /actors
- description: list of actors
- required-permission:
get:actors
- request arguments: None
- returns a list of actors
{
"success": True,
"actors": [{
id: 1,
name: "Dwayne Johnson",
age: 53,
gender: "Male"
}]
}
POST /actors
(requires authorization header of post:actors
)
-
description: create actor
-
required-permission:
post:actors
-
request arguments:
- name (required): string
- age (required): number
- gender (required): string
-
returns status of created actor
{
"success": True,
"actors": [{
id: 2,
name: "Mark",
age: 45,
gender: "Male"
}]
}
PATCH /actors/<id>
(requires authorization header of patch:actors
)
-
description: updates actor
-
request arguments:
- name (optional): string
- age (optional): number
- gender (optional): string
-
returns status of updated actor
{
"success": True,
"actors": [{
id: 1,
name: "Mark",
age: 46,
gender: "Male"
}]
}
DELETE /actors/</id>
- description: deletes actor
- required-permission:
delete:actors
- request arguments: None
- return status of deleted actor
{
"success": True,
"delete": 2
}
👤 John Pius
- Github (https://github.com/john4pius)
- Linkedin (https://www.linkedin.com/in/john-pius)
- Twitter (@John4pius)
Contributions, issues and feature requests are welcome!
Give a ⭐️ if you like this project!