(
&self,
question_id: i32,
account_id: &AccountId,
)
| 55 | } |
| 56 | |
| 57 | pub async fn is_question_owner( |
| 58 | &self, |
| 59 | question_id: i32, |
| 60 | account_id: &AccountId, |
| 61 | ) -> Result<bool, Error> { |
| 62 | match sqlx::query("SELECT * from questions where id = $1 and account_id = $2") |
| 63 | .bind(question_id) |
| 64 | .bind(account_id.0) |
| 65 | .fetch_optional(&self.connection) |
| 66 | .await |
| 67 | { |
| 68 | Ok(question) => Ok(question.is_some()), |
| 69 | Err(e) => { |
| 70 | tracing::event!(tracing::Level::ERROR, "{:?}", e); |
| 71 | Err(Error::DatabaseQueryError(e)) |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | pub async fn add_question( |
| 77 | self, |
no outgoing calls
no test coverage detected