| 133 | } |
| 134 | |
| 135 | pub async fn delete_question(self, id: i32, account_id: AccountId) -> Result<bool, Error> { |
| 136 | match sqlx::query("DELETE FROM questions WHERE id = $1 AND account_id = $2") |
| 137 | .bind(id) |
| 138 | .bind(account_id.0) |
| 139 | .execute(&self.connection) |
| 140 | .await |
| 141 | { |
| 142 | Ok(_) => Ok(true), |
| 143 | Err(e) => { |
| 144 | tracing::event!(tracing::Level::ERROR, "{:?}", e); |
| 145 | Err(Error::DatabaseQueryError(e)) |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | pub async fn add_answer(self, answer: Answer, account_id: AccountId) -> Result<bool, Error> { |
| 151 | match sqlx::query( |