lockbook_server_lib/
schema.rs

1use crate::billing::billing_model::SubscriptionProfile;
2use db_rs::{LookupSet, LookupTable};
3use db_rs_derive::Schema;
4use lockbook_shared::file_metadata::Owner;
5use lockbook_shared::server_file::ServerFile;
6use serde::{Deserialize, Serialize};
7use uuid::Uuid;
8
9#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
10pub struct OneKey;
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct Account {
14    pub username: String,
15    pub billing_info: SubscriptionProfile,
16}
17
18pub type ServerDb = ServerV4;
19
20#[derive(Schema)]
21#[cfg_attr(feature = "no-network", derive(Clone))]
22pub struct ServerV4 {
23    pub usernames: LookupTable<String, Owner>,
24    pub metas: LookupTable<Uuid, ServerFile>,
25    pub sizes: LookupTable<Uuid, u64>,
26    pub google_play_ids: LookupTable<String, Owner>,
27    pub stripe_ids: LookupTable<String, Owner>,
28    pub app_store_ids: LookupTable<String, Owner>,
29    pub last_seen: LookupTable<Owner, u64>,
30    pub accounts: LookupTable<Owner, Account>,
31    pub owned_files: LookupSet<Owner, Uuid>,
32    pub shared_files: LookupSet<Owner, Uuid>,
33    pub file_children: LookupSet<Uuid, Uuid>,
34}