(id, title, created_at, write_id)
| 37 | // using the `db` client. |
| 38 | |
| 39 | const createTodo = async (id, title, created_at, write_id) => { |
| 40 | const sql = ` |
| 41 | INSERT INTO todos (id, title, completed, created_at, write_id) |
| 42 | VALUES ($1, $2, false, $3, $4) |
| 43 | ` |
| 44 | |
| 45 | const params = [id, title, created_at, write_id || null] |
| 46 | |
| 47 | await pool.query(sql, params) |
| 48 | } |
| 49 | |
| 50 | const updateTodo = async (id, completed, write_id) => { |
| 51 | const sql = ` |