robespierre_models/
sync.rs1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::id::{ChannelId, MessageId, UserId};
6
7#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
14#[serde(transparent)]
15pub struct UserSettings(pub HashMap<String, SettingTuple>);
16
17#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
20#[serde(deny_unknown_fields)]
21pub struct ChannelCompositeKey {
22 pub channel: ChannelId,
23 pub user: UserId,
24}
25
26#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
29#[serde(deny_unknown_fields)]
30pub struct ChannelUnread {
31 #[serde(rename = "_id")]
32 pub id: ChannelCompositeKey,
33 pub last_id: MessageId,
34 #[serde(default, skip_serializing_if = "Vec::is_empty")]
35 pub mentions: Vec<MessageId>,
36}
37
38#[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
41#[serde(deny_unknown_fields)]
42pub struct WebPushSubscription {
43 pub endpoint: String,
44 pub p256dh: String,
45 pub auth: String,
46}
47
48pub type SettingTuple = (usize, String);