mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
add type-safe accessors to account_data service
This commit is contained in:
parent
b82458a460
commit
88ad596e8d
12 changed files with 202 additions and 179 deletions
|
|
@ -16,7 +16,7 @@ pub(crate) async fn set_global_account_data_route(
|
|||
) -> Result<Ra<set_global_account_data::v3::Response>> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
services().account_data.update_global(
|
||||
services().account_data.update_global_any(
|
||||
sender_user,
|
||||
&body.event_type,
|
||||
&body.data,
|
||||
|
|
@ -33,7 +33,7 @@ pub(crate) async fn set_room_account_data_route(
|
|||
) -> Result<Ra<set_room_account_data::v3::Response>> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
services().account_data.update_room(
|
||||
services().account_data.update_room_any(
|
||||
&body.room_id,
|
||||
sender_user,
|
||||
&body.event_type,
|
||||
|
|
@ -53,7 +53,7 @@ pub(crate) async fn get_global_account_data_route(
|
|||
|
||||
let account_data = services()
|
||||
.account_data
|
||||
.get_global(sender_user, &body.event_type)?
|
||||
.get_global_any(sender_user, &body.event_type)?
|
||||
.ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?;
|
||||
|
||||
Ok(Ra(get_global_account_data::v3::Response {
|
||||
|
|
@ -71,7 +71,7 @@ pub(crate) async fn get_room_account_data_route(
|
|||
|
||||
let account_data = services()
|
||||
.account_data
|
||||
.get_room(&body.room_id, sender_user, &body.event_type)?
|
||||
.get_room_any(&body.room_id, sender_user, &body.event_type)?
|
||||
.ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?;
|
||||
|
||||
Ok(Ra(get_room_account_data::v3::Response {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue