Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Endpoint for Editing Developer Application Names #142

Open
fisher60 opened this issue Jun 20, 2024 · 4 comments
Open

Add Endpoint for Editing Developer Application Names #142

fisher60 opened this issue Jun 20, 2024 · 4 comments
Labels
backend Relates to backend enhancement New feature or request good first issue Good for newcomers

Comments

@fisher60
Copy link
Member

Summary

Developer application names should be editable, we should add a way to modify a developer application name. This could possibly be done with a generic patch endpoint for /developer_application. This endpoint will only be able to modify the name, in the future we may want to add additional fields that can be edited here.

@fisher60 fisher60 added enhancement New feature or request good first issue Good for newcomers backend Relates to backend labels Jun 20, 2024
@ShubhamKalsekar
Copy link

Implement the PATCH Endpoint:

from flask import Flask, request, jsonify

app = Flask(name)

Example data storage(Dummy Data)
developer_applications = {
1: {'name': 'App One'},
2: {'name': 'App Two'}
}

@app.route('/developer_application/int:app_id', methods=['PATCH']) #here Route Decorator and indicates a dynamic part of the URL, capturing the application ID
def update_app_name(app_id):
if app_id in developer_applications:
data = request.get_json()
if 'name' in data:
developer_applications[app_id]['name'] = data['name']
return jsonify({'message': 'Application name updated successfully'}), 200
else:
return jsonify({'error': 'No name provided'}), 400
else:
return jsonify({'error': 'Application not found'}), 404

if name == 'main':
app.run(debug=True)

reference:
here

@fisher60
Copy link
Member Author

Thank you, this was overwhelmingly unhelpful and my day was made worse because of it.

@ShubhamKalsekar
Copy link

ShubhamKalsekar commented Jun 24, 2024 via email

@fisher60
Copy link
Member Author

Hello, I originally assumed your comment was created by a bot/AI.
My comment was mostly a joke as your comment was very irrelevant to this repo and this issue, so I did not suspect a real human was on the other end.

This project uses FastAPI, we do not use Flask, so your suggestion is not helpful. Furthermore, your suggestion appears to be closer to pseudo-code or perhaps an example to what an endpoint could look like in Flask.

We do not store our persistent data in a dictionary, so this suggestion is not relevant developer_applications[app_id]['name'] = data['name']. Instead, we write persistent data to a database, and it would be bad practice to maintain a dictionary like this. Your return message is also misleading/incorrect as nothing would be updated since the change would be discarded on application restart (since the dictionary is only stored in memory, the persistent developer_application would not be updated).

You also have multiple else statements on your if condition for error handling. This syntax is not correct, nor would the logic make sense as there is not check for the 404 response.

I do genuinely appreciate your contribution and attempt to help, though this comment was misguided and not actionable. If you would like to contribute to open-source, I would highly recommend simply creating a pull request with your proposed changes, we always appreciate that! Though, ensure that you are using the correct language and frameworks and following the repo guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Relates to backend enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants