Skip to content

Commit

Permalink
snake_case convention for better readibility (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandtripathi5 authored Mar 4, 2023
1 parent f755aeb commit e876292
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit e876292

Please sign in to comment.