|
|
|
|
@ -106,11 +106,14 @@ class UserProfile(Resource):
|
|
|
|
|
if 'major' in data:
|
|
|
|
|
major = data['major']
|
|
|
|
|
|
|
|
|
|
if not isinstance(major, str):
|
|
|
|
|
return {"success": False, "message": "Major must be a string value"}, 400
|
|
|
|
|
if len(major) > 50:
|
|
|
|
|
# Allow None as a valid value (to clear the field)
|
|
|
|
|
if major is None:
|
|
|
|
|
validated_data['major'] = None
|
|
|
|
|
elif not isinstance(major, str):
|
|
|
|
|
return {"success": False, "message": "Major must be a string value or null"}, 400
|
|
|
|
|
elif len(major) > 50:
|
|
|
|
|
return {"success": False, "message": "Major exceeds maximum length of 50"}, 400
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
validated_data['major'] = major
|
|
|
|
|
|
|
|
|
|
# Use the service to update user profile
|
|
|
|
|
|