-
Notifications
You must be signed in to change notification settings - Fork 0
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
Public terminal management #6
base: master
Are you sure you want to change the base?
Conversation
…the PATCH & PUT methods.
… to add implementation with the command (shutdown, restart, etc.) and later add the authentication(?) with the jwt.
… public-terminal-management
…only works if the client sends the values down, locked, up and logged_in. Also later I will have to implement the communication with the agent of the terminal for the command execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too shabby!
return terminal_result.serialize() | ||
|
||
# Checks if the client sends a (not-empty-also) json | ||
def empty_json_body(f): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice, but maybe rename it to something like @require_json_body?
|
||
# PATCH: Update only the parameters we are given | ||
if request.method == 'PATCH': | ||
if changes['ip'] == None: # IP is not nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe run this check in the model? We should check if validations are supported by SQAlchemy.
return {"message": "Update successful"} | ||
|
||
def update(self, changes): | ||
madeChanges = 204 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep status codes out of the model classes, and reply inside the API classes!
No description provided.