Integrate unfinished server-rs refactor worklists
This commit is contained in:
66
server-rs/crates/spacetime-module/src/auth/tables.rs
Normal file
66
server-rs/crates/spacetime-module/src/auth/tables.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
use crate::Timestamp;
|
||||
|
||||
#[spacetimedb::table(accessor = auth_store_snapshot)]
|
||||
pub struct AuthStoreSnapshot {
|
||||
#[primary_key]
|
||||
pub(crate) snapshot_id: String,
|
||||
pub(crate) snapshot_json: String,
|
||||
pub(crate) updated_at: Timestamp,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = user_account,
|
||||
index(accessor = by_user_account_username, btree(columns = [username])),
|
||||
index(accessor = by_user_account_public_code, btree(columns = [public_user_code]))
|
||||
)]
|
||||
pub struct UserAccount {
|
||||
#[primary_key]
|
||||
pub(crate) user_id: String,
|
||||
pub(crate) public_user_code: String,
|
||||
pub(crate) username: String,
|
||||
pub(crate) display_name: String,
|
||||
pub(crate) phone_number_masked: Option<String>,
|
||||
pub(crate) phone_number_e164: Option<String>,
|
||||
pub(crate) login_method: String,
|
||||
pub(crate) binding_status: String,
|
||||
pub(crate) wechat_bound: bool,
|
||||
pub(crate) password_hash: String,
|
||||
pub(crate) password_login_enabled: bool,
|
||||
pub(crate) token_version: u64,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = auth_identity,
|
||||
index(accessor = by_auth_identity_user_id, btree(columns = [user_id])),
|
||||
index(accessor = by_auth_identity_provider_uid, btree(columns = [provider, provider_uid]))
|
||||
)]
|
||||
pub struct AuthIdentity {
|
||||
#[primary_key]
|
||||
pub(crate) identity_id: String,
|
||||
pub(crate) user_id: String,
|
||||
pub(crate) provider: String,
|
||||
pub(crate) provider_uid: String,
|
||||
pub(crate) provider_union_id: Option<String>,
|
||||
pub(crate) phone_e164: Option<String>,
|
||||
pub(crate) display_name: Option<String>,
|
||||
pub(crate) avatar_url: Option<String>,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = refresh_session,
|
||||
index(accessor = by_refresh_session_user_id, btree(columns = [user_id])),
|
||||
index(accessor = by_refresh_session_token_hash, btree(columns = [refresh_token_hash]))
|
||||
)]
|
||||
pub struct RefreshSession {
|
||||
#[primary_key]
|
||||
pub(crate) session_id: String,
|
||||
pub(crate) user_id: String,
|
||||
pub(crate) refresh_token_hash: String,
|
||||
pub(crate) issued_by_provider: String,
|
||||
pub(crate) client_info_json: String,
|
||||
pub(crate) expires_at: String,
|
||||
pub(crate) revoked_at: Option<String>,
|
||||
pub(crate) created_at: String,
|
||||
pub(crate) updated_at: String,
|
||||
pub(crate) last_seen_at: String,
|
||||
}
|
||||
Reference in New Issue
Block a user