1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-08-04 11:43:58 +00:00
continuwuity/src/service/rooms/user/mod.rs

44 lines
1.2 KiB
Rust
Raw Normal View History

mod data;
pub use data::Data;
use ruma::{RoomId, UserId};
use crate::service::*;
pub struct Service<D: Data> {
db: D,
}
2021-04-13 15:00:45 +02:00
impl Service<_> {
pub fn reset_notification_counts(&self, user_id: &UserId, room_id: &RoomId) -> Result<()> {
self.db.reset_notification_counts(user_id, room_id)
2021-04-13 15:00:45 +02:00
}
2022-06-19 22:56:14 +02:00
pub fn notification_count(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64> {
self.db.notification_count(user_id, room_id)
2020-05-25 23:24:13 +02:00
}
2022-06-19 22:56:14 +02:00
pub fn highlight_count(&self, user_id: &UserId, room_id: &RoomId) -> Result<u64> {
self.db.highlight_count(user_id, room_id)
}
2022-06-19 22:56:14 +02:00
pub fn associate_token_shortstatehash(
&self,
2020-08-18 12:15:27 +02:00
room_id: &RoomId,
2022-06-19 22:56:14 +02:00
token: u64,
shortstatehash: u64,
) -> Result<()> {
self.db.associate_token_shortstatehash(user_id, room_id)
2022-06-19 22:56:14 +02:00
}
2022-06-19 22:56:14 +02:00
pub fn get_token_shortstatehash(&self, room_id: &RoomId, token: u64) -> Result<Option<u64>> {
self.db.get_token_shortstatehash(room_id, token)
}
2020-08-18 12:15:27 +02:00
pub fn get_shared_rooms<'a>(
&'a self,
2021-11-26 20:36:40 +01:00
users: Vec<Box<UserId>>,
) -> Result<impl Iterator<Item = Result<Box<RoomId>>> + 'a> {
self.db.get_shared_rooms(users)
2020-08-18 12:15:27 +02:00
}
}