@@ -43,20 +43,20 @@ object TodoMvcDbWithLoom extends cask.MainRoutes {
4343
4444 @ transactional
4545 @ cask.get(" /list/:state" )
46- def list (state : String )(using ctx : Txn ) = {
46+ def list (state : String )(txn : Txn ) = {
4747 val filteredTodos = state match {
48- case " all" => ctx .run(Todo .select)
49- case " active" => ctx .run(Todo .select.filter(! _.checked))
50- case " completed" => ctx .run(Todo .select.filter(_.checked))
48+ case " all" => txn .run(Todo .select)
49+ case " active" => txn .run(Todo .select.filter(! _.checked))
50+ case " completed" => txn .run(Todo .select.filter(_.checked))
5151 }
5252 upickle.default.write(filteredTodos)
5353 }
5454
5555 @ transactional
5656 @ cask.post(" /add" )
57- def add (request : cask.Request )(using ctx : Txn ) = {
57+ def add (request : cask.Request )(txn : Txn ) = {
5858 val body = request.text()
59- ctx .run(
59+ txn .run(
6060 Todo
6161 .insert
6262 .columns(_.checked := false , _.text := body)
@@ -69,14 +69,14 @@ object TodoMvcDbWithLoom extends cask.MainRoutes {
6969
7070 @ transactional
7171 @ cask.post(" /toggle/:index" )
72- def toggle (index : Int )(using ctx : Txn ) = {
73- ctx .run(Todo .update(_.id === index).set(p => p.checked := ! p.checked))
72+ def toggle (index : Int )(txn : Txn ) = {
73+ txn .run(Todo .update(_.id === index).set(p => p.checked := ! p.checked))
7474 }
7575
7676 @ transactional
7777 @ cask.post(" /delete/:index" )
78- def delete (index : Int )(using ctx : Txn ) = {
79- ctx .run(Todo .delete(_.id === index))
78+ def delete (index : Int )(txn : Txn ) = {
79+ txn .run(Todo .delete(_.id === index))
8080 }
8181
8282 initialize()
0 commit comments