(
&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( |
| 63 | "SELECT * from questions where id = $1 and account_id = $2", |
| 64 | ) |
| 65 | .bind(question_id) |
| 66 | .bind(account_id.0) |
| 67 | .fetch_optional(&self.connection) |
| 68 | .await |
| 69 | { |
| 70 | Ok(question) => Ok(question.is_some()), |
| 71 | Err(e) => { |
| 72 | tracing::event!(tracing::Level::ERROR, "{:?}", e); |
| 73 | Err(Error::DatabaseQueryError(e)) |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | pub async fn add_question( |
| 79 | self, |
no outgoing calls
no test coverage detected