Skip to content

Commit

Permalink
feat: Implement API route to add new "Experience"
Browse files Browse the repository at this point in the history
Resolves Implement API route to add new "Experience" #22
  • Loading branch information
byhlel committed Sep 24, 2024
1 parent c66f2b0 commit 60971ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ def experience():
return jsonify({"experience": [exp.__dict__ for exp in data["experience"]]})

if request.method == 'POST':
return jsonify({})
new_experience = request.json
experience_instance = Experience(
new_experience["title"],
new_experience["company"],
new_experience["start_date"],
new_experience["end_date"],
new_experience["description"],
new_experience["logo"]
)
data["experience"].append(experience_instance)
return jsonify({"id": len(data["experience"]) - 1})

return jsonify({})

Expand Down
2 changes: 1 addition & 1 deletion test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_experience():
item_id = app.test_client().post('/resume/experience',
json=example_experience).json['id']
response = app.test_client().get('/resume/experience')
assert response.json[item_id] == example_experience
assert response.json["experience"][item_id] == example_experience


def test_education():
Expand Down

0 comments on commit 60971ab

Please sign in to comment.