Simplify return type of most route handlers

This commit is contained in:
Jonas Platte 2022-01-22 16:58:32 +01:00
parent 77a87881c9
commit 5fa9190117
No known key found for this signature in database
GPG key ID: 7D261D771D915378
38 changed files with 358 additions and 414 deletions

View file

@ -1,4 +1,4 @@
use crate::{database::DatabaseGuard, ConduitResult, Error, Ruma};
use crate::{database::DatabaseGuard, Error, Result, Ruma};
use ruma::{
api::client::{
error::ErrorKind,
@ -20,7 +20,7 @@ use std::collections::BTreeMap;
pub async fn set_read_marker_route(
db: DatabaseGuard,
body: Ruma<set_read_marker::Request<'_>>,
) -> ConduitResult<set_read_marker::Response> {
) -> Result<set_read_marker::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let fully_read_event = ruma::events::fully_read::FullyReadEvent {
@ -76,7 +76,7 @@ pub async fn set_read_marker_route(
db.flush()?;
Ok(set_read_marker::Response {}.into())
Ok(set_read_marker::Response {})
}
/// # `POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}`
@ -86,7 +86,7 @@ pub async fn set_read_marker_route(
pub async fn create_receipt_route(
db: DatabaseGuard,
body: Ruma<create_receipt::Request<'_>>,
) -> ConduitResult<create_receipt::Response> {
) -> Result<create_receipt::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
db.rooms.edus.private_read_set(
@ -128,5 +128,5 @@ pub async fn create_receipt_route(
db.flush()?;
Ok(create_receipt::Response {}.into())
Ok(create_receipt::Response {})
}