Skip to content

snake_case convention for better readibility #382

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

Merged
merged 2 commits into from
Mar 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions examples/todomvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def delete(self, id):
self.todos.remove(todo)


DAO = TodoDAO()
DAO.create({"task": "Build an API"})
DAO.create({"task": "?????"})
DAO.create({"task": "profit!"})
todo_dao = TodoDAO()
todo_dao.create({"task": "Build an API"})
todo_dao.create({"task": "?????"})
todo_dao.create({"task": "profit!"})


@ns.route("/")
Expand All @@ -63,14 +63,14 @@ class TodoList(Resource):
@ns.marshal_list_with(todo)
def get(self):
"""List all tasks"""
return DAO.todos
return todo_dao.todos

@ns.doc("create_todo")
@ns.expect(todo)
@ns.marshal_with(todo, code=201)
def post(self):
"""Create a new task"""
return DAO.create(api.payload), 201
return todo_dao.create(api.payload), 201


@ns.route("/<int:id>")
Expand All @@ -83,20 +83,20 @@ class Todo(Resource):
@ns.marshal_with(todo)
def get(self, id):
"""Fetch a given resource"""
return DAO.get(id)
return todo_dao.get(id)

@ns.doc("delete_todo")
@ns.response(204, "Todo deleted")
def delete(self, id):
"""Delete a task given its identifier"""
DAO.delete(id)
todo_dao.delete(id)
return "", 204

@ns.expect(todo)
@ns.marshal_with(todo)
def put(self, id):
"""Update a task given its identifier"""
return DAO.update(id, api.payload)
return todo_dao.update(id, api.payload)


if __name__ == "__main__":
Expand Down