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