Last active
October 26, 2020 22:36
-
-
Save agustinustheo/3a4735fb9bf30d9b809ae0bf342b991b to your computer and use it in GitHub Desktop.
To-do helper for Flask-FaunaDB example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from entities.faunadb_entity import get, get_multiple, get_by_ref_id, create, update, delete | |
def get_all_todos(): | |
try: | |
return get_multiple('all_todos') | |
except Exception as ex: | |
raise ex | |
def get_todo_by_ref_id(id): | |
try: | |
return get_by_ref_id('todo', id) | |
except Exception as ex: | |
raise ex | |
def create_todo(data): | |
try: | |
return create('todo', data) | |
except Exception as ex: | |
raise ex | |
def update_todo(id, data): | |
try: | |
return update('todo', id, data) | |
except Exception as ex: | |
raise ex | |
def delete_todo(id): | |
try: | |
return delete('todo', id) | |
except Exception as ex: | |
raise ex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment