generated from MLH-Fellowship/orientation-project-python
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from ZeyadTarekk/delete-education
feat: Implement API route to delete education
- Loading branch information
Showing
5 changed files
with
1,327 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ | |
''' | ||
from spellchecker import SpellChecker | ||
from flask import Flask, jsonify, request, abort, Response | ||
from models import Experience, Education, Skill | ||
from models import Experience, Education, Skill, PersonalInfo | ||
from helpers.education_api import * | ||
from helpers.personal_info_api import * | ||
|
||
app = Flask(__name__) | ||
spell = SpellChecker(distance=2) | ||
|
@@ -30,7 +31,9 @@ | |
Skill("Python", | ||
"1-2 Years", | ||
"example-logo.png") | ||
] | ||
], | ||
"pesronal_info": PersonalInfo("Zeyad Tarek","[email protected]","+201111111111") | ||
|
||
} | ||
|
||
|
||
|
@@ -105,6 +108,29 @@ def education(): | |
new_education_data = request.json | ||
data, response = handle_education_put_request(data, new_education_data, index) | ||
return response | ||
if request.method == 'DELETE': | ||
index = request.args.get("id") | ||
data, response = handle_education_delete_request(data, index) | ||
return response | ||
|
||
return jsonify({}) | ||
|
||
# To Get, Add, and update personal info | ||
@app.route('/resume/personal-info/', methods=['GET', 'POST', 'PUT']) | ||
def personal_info(): | ||
''' | ||
Handles personal info requests | ||
''' | ||
if request.method == 'GET': | ||
return get_personal_data(data) | ||
if request.method == 'POST': | ||
new_personal_data = request.json | ||
data, response = add_personal_data(data, new_personal_data) | ||
return response | ||
if request.method == 'PUT': | ||
updated_personal_data = request.json | ||
data, response = update_personal_data(data, updated_personal_data) | ||
return response | ||
|
||
return jsonify({}) | ||
|
||
|
Oops, something went wrong.