Skip to content

Commit c03602a

Browse files
remove implementation for delete_experience
1 parent 7cdf0ba commit c03602a

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

app.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -41,62 +41,6 @@ def hello_world():
4141
return jsonify({"message": "Hello, World!"})
4242

4343

44-
@app.route("/resume/experience", methods=["GET", "POST"])
45-
@app.route("/resume/experience/<int:index>", methods=["GET"])
46-
def experience(index=None):
47-
'''
48-
Handle experience requests
49-
GET: Returns all experiences or a specific experience by index
50-
POST: Creates a new experience
51-
'''
52-
if request.method == "GET":
53-
if index is not None:
54-
try:
55-
return jsonify(data["experience"][index])
56-
except IndexError:
57-
return jsonify({"error": "Experience not found"}), 404
58-
return jsonify(data["experience"]), 200
59-
60-
if request.method == "POST":
61-
try:
62-
new_experience = request.get_json()
63-
if not new_experience:
64-
return jsonify({"error": "No data provided"}), 400
65-
# validate required fields
66-
required_fields = [
67-
"title",
68-
"company",
69-
"start_date",
70-
"end_date",
71-
"description",
72-
"logo",
73-
]
74-
if not all(field in new_experience for field in required_fields):
75-
return jsonify({"error": "Missing required fields"}), 400
76-
77-
experience_obj = Experience(**new_experience)
78-
data["experience"].append(experience_obj)
79-
return jsonify({"id": len(data["experience"]) - 1}), 201
80-
except TypeError as e:
81-
return jsonify({"error": f"Invalid data format: {str(e)}"}), 400
82-
except Exception as e:
83-
return jsonify({"error": f"Internal error: {str(e)}"}), 500
84-
85-
86-
return jsonify({"error": "Method not allowed"}), 405
87-
88-
@app.route('/resume/experience/<int:exp_id>', methods=['DELETE'])
89-
def delete_experience(exp_id):
90-
try:
91-
if exp_id < 0 or exp_id >= len(data["experience"]):
92-
return jsonify({"message": "Resource doesn't exist"}), 404
93-
else:
94-
data['experience'].pop(exp_id)
95-
return jsonify({"message": "Experience Successfully Deleted"}), 200
96-
except Exception as e:
97-
return jsonify({"error": f"An error occurred: {str(e)}"}), 500
98-
99-
10044
@app.route("/resume/education", methods=["GET", "POST"])
10145
def education():
10246
'''

0 commit comments

Comments
 (0)