mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: reload UI (#2999)
* chore: reload folder * chore: reload folder * chore: init sync * chore: update tables * chore: update database * chore: load row * chore: update * chore: reload row * test: fit test * chore: retry * chore: support batch fetch * chore: enable sync * chore: sync switch * chore: sync switch * chore: migration user data * chore: migrate data * chore: migrate folder * chore: save user email * chore: refresh user profile * chore: fix test * chore: delete translation files * test: clippy format
This commit is contained in:
@ -2,7 +2,6 @@ use appflowy_integrate::config::AWSDynamoDBConfig;
|
||||
|
||||
use flowy_derive::ProtoBuf;
|
||||
use flowy_error::FlowyError;
|
||||
use flowy_server::supabase::{PostgresConfiguration, SupabaseConfiguration};
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
pub struct KeyValuePB {
|
||||
@ -19,38 +18,6 @@ pub struct KeyPB {
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
pub struct SupabaseConfigPB {
|
||||
#[pb(index = 1)]
|
||||
supabase_url: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
anon_key: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
key: String,
|
||||
|
||||
#[pb(index = 4)]
|
||||
jwt_secret: String,
|
||||
|
||||
#[pb(index = 5)]
|
||||
pub postgres_config: PostgresConfigurationPB,
|
||||
}
|
||||
|
||||
impl TryFrom<SupabaseConfigPB> for SupabaseConfiguration {
|
||||
type Error = FlowyError;
|
||||
|
||||
fn try_from(config: SupabaseConfigPB) -> Result<Self, Self::Error> {
|
||||
let postgres_config = PostgresConfiguration::try_from(config.postgres_config)?;
|
||||
Ok(SupabaseConfiguration {
|
||||
url: config.supabase_url,
|
||||
key: config.key,
|
||||
jwt_secret: config.jwt_secret,
|
||||
postgres_config,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
pub struct CollabPluginConfigPB {
|
||||
#[pb(index = 1, one_of)]
|
||||
@ -81,31 +48,3 @@ impl TryFrom<AWSDynamoDBConfigPB> for AWSDynamoDBConfig {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
pub struct PostgresConfigurationPB {
|
||||
#[pb(index = 1)]
|
||||
pub url: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub user_name: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub password: String,
|
||||
|
||||
#[pb(index = 4)]
|
||||
pub port: u32,
|
||||
}
|
||||
|
||||
impl TryFrom<PostgresConfigurationPB> for PostgresConfiguration {
|
||||
type Error = FlowyError;
|
||||
|
||||
fn try_from(config: PostgresConfigurationPB) -> Result<Self, Self::Error> {
|
||||
Ok(Self {
|
||||
url: config.url,
|
||||
user_name: config.user_name,
|
||||
password: config.password,
|
||||
port: config.port as u16,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use appflowy_integrate::config::AWSDynamoDBConfig;
|
||||
|
||||
use flowy_error::{FlowyError, FlowyResult};
|
||||
use flowy_server::supabase::SupabaseConfiguration;
|
||||
use flowy_sqlite::kv::KV;
|
||||
use lib_dispatch::prelude::{data_result_ok, AFPluginData, DataResult};
|
||||
|
||||
use crate::entities::{CollabPluginConfigPB, KeyPB, KeyValuePB, SupabaseConfigPB};
|
||||
use crate::entities::{CollabPluginConfigPB, KeyPB, KeyValuePB};
|
||||
|
||||
pub(crate) async fn set_key_value_handler(data: AFPluginData<KeyValuePB>) -> FlowyResult<()> {
|
||||
let data = data.into_inner();
|
||||
@ -35,14 +34,6 @@ pub(crate) async fn remove_key_value_handler(data: AFPluginData<KeyPB>) -> Flowy
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn set_supabase_config_handler(
|
||||
data: AFPluginData<SupabaseConfigPB>,
|
||||
) -> FlowyResult<()> {
|
||||
let config = SupabaseConfiguration::try_from(data.into_inner())?;
|
||||
config.write_env();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn set_collab_plugin_config_handler(
|
||||
data: AFPluginData<CollabPluginConfigPB>,
|
||||
) -> FlowyResult<()> {
|
||||
|
@ -11,7 +11,6 @@ pub fn init() -> AFPlugin {
|
||||
.event(ConfigEvent::SetKeyValue, set_key_value_handler)
|
||||
.event(ConfigEvent::GetKeyValue, get_key_value_handler)
|
||||
.event(ConfigEvent::RemoveKeyValue, remove_key_value_handler)
|
||||
.event(ConfigEvent::SetSupabaseConfig, set_supabase_config_handler)
|
||||
.event(
|
||||
ConfigEvent::SetCollabPluginConfig,
|
||||
set_collab_plugin_config_handler,
|
||||
@ -30,11 +29,6 @@ pub enum ConfigEvent {
|
||||
#[event(input = "KeyPB")]
|
||||
RemoveKeyValue = 2,
|
||||
|
||||
/// Set the supabase config. It will be written to the environment variables.
|
||||
/// Check out the `write_to_env` of [SupabaseConfigPB].
|
||||
#[event(input = "SupabaseConfigPB")]
|
||||
SetSupabaseConfig = 3,
|
||||
|
||||
#[event(input = "CollabPluginConfigPB")]
|
||||
SetCollabPluginConfig = 4,
|
||||
}
|
||||
|
Reference in New Issue
Block a user