File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -86,21 +86,29 @@ def spell_check():
86
86
})
87
87
88
88
@app .route ("/resume/education" , methods = ["GET" , "POST" ])
89
- def education ():
89
+ @app .route ("/resume/education/<int:index>" , methods = ["GET" ])
90
+ def education (index = None ):
90
91
'''
91
- Handles education requests
92
+ GET /resume/ education/<int:index> - Returns the education at the given index
92
93
'''
93
-
94
- if request .method == 'GET' :
95
- return jsonify (data ['education' ]), 200
96
-
94
+ if request .method == 'GET' and index is not None :
95
+ if index < 0 :
96
+ return jsonify ({"error" : "Index must be a positive integer" })
97
+
98
+ try :
99
+ return jsonify (data ["education" ][index ])
100
+ except IndexError :
101
+ return jsonify ({"error" : "Index out of range" })
102
+
97
103
if request .method == 'POST' :
98
104
json_data = request .json
99
105
try :
100
106
validated_data = validate_education (json_data )
101
107
return jsonify (validated_data )
102
108
except ValueError as e :
103
109
return jsonify ({"error" : str (e )}), 400
110
+
111
+ return jsonify ({})
104
112
105
113
@app .route ('/resume/reword_description' , methods = ['GET' ])
106
114
def reword_description ():
You can’t perform that action at this time.
0 commit comments