@@ -35,8 +35,8 @@ class SystemManager {
3535
3636 func watchLists( _ callback: @escaping ( _ lists: [ ListContent ] ) -> Void ) async {
3737 for await lists in self . db. watch< [ ListContent] > (
38- sql : " SELECT * FROM \( LISTS_TABLE) " ,
39- parameters : [ ] ,
38+ " SELECT * FROM \( LISTS_TABLE) " ,
39+ [ ] ,
4040 mapper: { cursor in
4141 ListContent (
4242 id: cursor. getString ( index: 0 ) !,
@@ -52,29 +52,29 @@ class SystemManager {
5252
5353 func insertList( _ list: NewListContent ) async throws {
5454 _ = try await self . db. execute (
55- sql : " INSERT INTO \( LISTS_TABLE) (id, created_at, name, owner_id) VALUES (uuid(), datetime(), ?, ?) " ,
56- parameters : [ list. name, connector. currentUserID]
55+ " INSERT INTO \( LISTS_TABLE) (id, created_at, name, owner_id) VALUES (uuid(), datetime(), ?, ?) " ,
56+ [ list. name, connector. currentUserID]
5757 )
5858 }
5959
6060 func deleteList( id: String ) async throws {
6161 try await db. writeTransaction ( callback: { transaction in
6262 _ = try await transaction. execute (
63- sql : " DELETE FROM \( LISTS_TABLE) WHERE id = ? " ,
64- parameters : [ id]
63+ " DELETE FROM \( LISTS_TABLE) WHERE id = ? " ,
64+ [ id]
6565 )
6666 _ = try await transaction. execute (
67- sql : " DELETE FROM \( TODOS_TABLE) WHERE list_id = ? " ,
68- parameters : [ id]
67+ " DELETE FROM \( TODOS_TABLE) WHERE list_id = ? " ,
68+ [ id]
6969 )
7070 return
7171 } )
7272 }
7373
7474 func watchTodos( _ listId: String , _ callback: @escaping ( _ todos: [ Todo ] ) -> Void ) async {
7575 for await todos in self . db. watch (
76- sql : " SELECT * FROM \( TODOS_TABLE) WHERE list_id = ? " ,
77- parameters : [ listId] ,
76+ " SELECT * FROM \( TODOS_TABLE) WHERE list_id = ? " ,
77+ [ listId] ,
7878 mapper: { cursor in
7979 return Todo (
8080 id: cursor. getString ( index: 0 ) !,
@@ -95,31 +95,31 @@ class SystemManager {
9595
9696 func insertTodo( _ todo: NewTodo , _ listId: String ) async throws {
9797 _ = try await self . db. execute (
98- sql : " INSERT INTO \( TODOS_TABLE) (id, created_at, created_by, description, list_id, completed) VALUES (uuid(), datetime(), ?, ?, ?, ?) " ,
99- parameters : [ connector. currentUserID, todo. description, listId, todo. isComplete]
98+ " INSERT INTO \( TODOS_TABLE) (id, created_at, created_by, description, list_id, completed) VALUES (uuid(), datetime(), ?, ?, ?, ?) " ,
99+ [ connector. currentUserID, todo. description, listId, todo. isComplete]
100100 )
101101 }
102102
103103 func updateTodo( _ todo: Todo ) async throws {
104104 // Do this to avoid needing to handle date time from Swift to Kotlin
105105 if ( todo. isComplete) {
106106 _ = try await self . db. execute (
107- sql : " UPDATE \( TODOS_TABLE) SET description = ?, completed = ?, completed_at = datetime(), completed_by = ? WHERE id = ? " ,
108- parameters : [ todo. description, todo. isComplete, connector. currentUserID, todo. id]
107+ " UPDATE \( TODOS_TABLE) SET description = ?, completed = ?, completed_at = datetime(), completed_by = ? WHERE id = ? " ,
108+ [ todo. description, todo. isComplete, connector. currentUserID, todo. id]
109109 )
110110 } else {
111111 _ = try await self . db. execute (
112- sql : " UPDATE \( TODOS_TABLE) SET description = ?, completed = ?, completed_at = NULL, completed_by = NULL WHERE id = ? " ,
113- parameters : [ todo. description, todo. isComplete, todo. id]
112+ " UPDATE \( TODOS_TABLE) SET description = ?, completed = ?, completed_at = NULL, completed_by = NULL WHERE id = ? " ,
113+ [ todo. description, todo. isComplete, todo. id]
114114 )
115115 }
116116 }
117117
118118 func deleteTodo( id: String ) async throws {
119119 try await db. writeTransaction ( callback: { transaction in
120120 _ = try await transaction. execute (
121- sql : " DELETE FROM \( TODOS_TABLE) WHERE id = ? " ,
122- parameters : [ id]
121+ " DELETE FROM \( TODOS_TABLE) WHERE id = ? " ,
122+ [ id]
123123 )
124124 return
125125 } )
0 commit comments