mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: workspace invite (#4827)
* feat: add rename and change icon for workspace cloud api * feat: added created at field for UserWorkspacePB * test: added view check after creating workspace * fix: allow new_icon to be empty string * feat: add invitation api cloud services * chore: cargo clippy * chore: merge conflict * feat: add workspace invitation test * fix: use back old role and af role * chore: use 1.75 channel rust toolchain * chore: added error for test case * chore: added ci var * chore: cargo clippy
This commit is contained in:
@ -14,7 +14,7 @@ use uuid::Uuid;
|
||||
|
||||
use crate::entities::{
|
||||
AuthResponse, Authenticator, Role, UpdateUserProfileParams, UserCredentials, UserProfile,
|
||||
UserTokenState, UserWorkspace, WorkspaceMember,
|
||||
UserTokenState, UserWorkspace, WorkspaceInvitation, WorkspaceInvitationStatus, WorkspaceMember,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -180,6 +180,7 @@ pub trait UserCloudService: Send + Sync + 'static {
|
||||
/// Deletes a workspace owned by the user.
|
||||
fn delete_workspace(&self, workspace_id: &str) -> FutureResult<(), FlowyError>;
|
||||
|
||||
// Deprecated, use invite instead
|
||||
fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
@ -188,6 +189,26 @@ pub trait UserCloudService: Send + Sync + 'static {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn invite_workspace_member(
|
||||
&self,
|
||||
invitee_email: String,
|
||||
workspace_id: String,
|
||||
role: Role,
|
||||
) -> FutureResult<(), FlowyError> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn list_workspace_invitations(
|
||||
&self,
|
||||
filter: Option<WorkspaceInvitationStatus>,
|
||||
) -> FutureResult<Vec<WorkspaceInvitation>, FlowyError> {
|
||||
FutureResult::new(async { Ok(vec![]) })
|
||||
}
|
||||
|
||||
fn accept_workspace_invitations(&self, invite_id: String) -> FutureResult<(), FlowyError> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn remove_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
|
@ -383,6 +383,7 @@ pub enum UserTokenState {
|
||||
Invalid,
|
||||
}
|
||||
|
||||
// Workspace Role
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Role {
|
||||
Owner,
|
||||
@ -403,3 +404,20 @@ pub fn user_awareness_object_id(user_uuid: &Uuid, workspace_id: &str) -> Uuid {
|
||||
format!("user_awareness:{}", workspace_id).as_bytes(),
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum WorkspaceInvitationStatus {
|
||||
Pending,
|
||||
Accepted,
|
||||
Rejected,
|
||||
}
|
||||
|
||||
pub struct WorkspaceInvitation {
|
||||
pub invite_id: Uuid,
|
||||
pub workspace_id: Uuid,
|
||||
pub workspace_name: Option<String>,
|
||||
pub inviter_email: Option<String>,
|
||||
pub inviter_name: Option<String>,
|
||||
pub status: WorkspaceInvitationStatus,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
Reference in New Issue
Block a user