mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: add icon_url in migration
This commit is contained in:
@ -0,0 +1 @@
|
||||
ALTER TABLE user_table DROP COLUMN icon_url;
|
@ -0,0 +1 @@
|
||||
ALTER TABLE user_table ADD COLUMN icon_url TEXT NOT NULL DEFAULT '';
|
@ -87,8 +87,8 @@ table! {
|
||||
name -> Text,
|
||||
token -> Text,
|
||||
email -> Text,
|
||||
icon -> Text,
|
||||
workspace -> Text,
|
||||
icon_url -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ pub struct UserProfilePB {
|
||||
pub token: String,
|
||||
|
||||
#[pb(index = 5)]
|
||||
pub icon: String,
|
||||
pub icon_url: String,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default)]
|
||||
@ -45,7 +45,7 @@ pub struct UpdateUserProfilePayloadPB {
|
||||
pub password: Option<String>,
|
||||
|
||||
#[pb(index = 5, one_of)]
|
||||
pub icon: Option<String>,
|
||||
pub icon_url: Option<String>,
|
||||
}
|
||||
|
||||
impl UpdateUserProfilePayloadPB {
|
||||
@ -71,8 +71,8 @@ impl UpdateUserProfilePayloadPB {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn icon(mut self, icon: &str) -> Self {
|
||||
self.icon = Some(icon.to_owned());
|
||||
pub fn icon_url(mut self, icon_url: &str) -> Self {
|
||||
self.icon_url = Some(icon_url.to_owned());
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ pub struct UpdateUserProfileParams {
|
||||
pub password: Option<String>,
|
||||
|
||||
#[pb(index = 5, one_of)]
|
||||
pub icon: Option<String>,
|
||||
pub icon_url: Option<String>,
|
||||
}
|
||||
|
||||
impl UpdateUserProfileParams {
|
||||
@ -102,7 +102,7 @@ impl UpdateUserProfileParams {
|
||||
name: None,
|
||||
email: None,
|
||||
password: None,
|
||||
icon: None,
|
||||
icon_url: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +121,8 @@ impl UpdateUserProfileParams {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn icon(mut self, icon: &str) -> Self {
|
||||
self.icon = Some(icon.to_owned());
|
||||
pub fn icon_url(mut self, icon_url: &str) -> Self {
|
||||
self.icon_url = Some(icon_url.to_owned());
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -148,9 +148,9 @@ impl TryInto<UpdateUserProfileParams> for UpdateUserProfilePayloadPB {
|
||||
Some(password) => Some(UserPassword::parse(password)?.0),
|
||||
};
|
||||
|
||||
let icon = match self.icon {
|
||||
let icon_url = match self.icon_url {
|
||||
None => None,
|
||||
Some(icon) => Some(UserIcon::parse(icon)?.0),
|
||||
Some(icon_url) => Some(UserIcon::parse(icon_url)?.0),
|
||||
};
|
||||
|
||||
Ok(UpdateUserProfileParams {
|
||||
@ -158,7 +158,7 @@ impl TryInto<UpdateUserProfileParams> for UpdateUserProfilePayloadPB {
|
||||
name,
|
||||
email,
|
||||
password,
|
||||
icon,
|
||||
icon_url,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -81,8 +81,8 @@ pub struct UserTable {
|
||||
pub(crate) name: String,
|
||||
pub(crate) token: String,
|
||||
pub(crate) email: String,
|
||||
pub(crate) icon: String,
|
||||
pub(crate) workspace: String, // deprecated
|
||||
pub(crate) icon_url: String,
|
||||
}
|
||||
|
||||
impl UserTable {
|
||||
@ -92,7 +92,7 @@ impl UserTable {
|
||||
name,
|
||||
email,
|
||||
token,
|
||||
icon: "".to_owned(),
|
||||
icon_url: "".to_owned(),
|
||||
workspace: "".to_owned(),
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ impl std::convert::From<UserTable> for UserProfilePB {
|
||||
email: table.email,
|
||||
name: table.name,
|
||||
token: table.token,
|
||||
icon: table.icon,
|
||||
icon_url: table.icon_url,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -134,7 +134,7 @@ pub struct UserTableChangeset {
|
||||
pub workspace: Option<String>, // deprecated
|
||||
pub name: Option<String>,
|
||||
pub email: Option<String>,
|
||||
pub icon: Option<String>,
|
||||
pub icon_url: Option<String>,
|
||||
}
|
||||
|
||||
impl UserTableChangeset {
|
||||
@ -144,7 +144,7 @@ impl UserTableChangeset {
|
||||
workspace: None,
|
||||
name: params.name,
|
||||
email: params.email,
|
||||
icon: params.icon,
|
||||
icon_url: params.icon_url,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user