feat: implement workspace management and member invitations
- Added tenant API for managing workspaces, including listing, creating, and inviting members. - Introduced new models for organizations, workspaces, and workspace memberships in the backend. - Created frontend components for workspace administration, allowing users to manage workspaces and invite members. - Updated document listing to support workspace-specific filtering. - Implemented account settings page for user profile management and password changes. - Added end-to-end tests for workspace administration and dashboard functionalities.
This commit is contained in:
parent
809235e962
commit
bf5cd44dc1
20 changed files with 928 additions and 27 deletions
|
|
@ -40,6 +40,7 @@ def _serialize(doc: dict[str, Any]) -> dict[str, Any]:
|
|||
"owner_id": doc.get("owner_id"),
|
||||
"visibility": doc.get("visibility", "private"),
|
||||
"members": doc.get("members", []),
|
||||
"workspace_id": doc.get("workspace_id"),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -84,6 +85,7 @@ async def create_document(
|
|||
"last_visited_at": now,
|
||||
"visibility": "private",
|
||||
"members": [],
|
||||
"workspace_id": data.workspace_id,
|
||||
}
|
||||
await db[COLLECTION].insert_one(doc)
|
||||
return _serialize(doc)
|
||||
|
|
@ -104,6 +106,7 @@ async def list_documents(
|
|||
doc_type: CreateType | None = None,
|
||||
stead_id: str | None = None,
|
||||
parent_page_id: str | None = None,
|
||||
workspace_id: int | None = None,
|
||||
starred: bool | None = None,
|
||||
sort: SortField = "updated_at",
|
||||
) -> list[dict[str, Any]]:
|
||||
|
|
@ -117,6 +120,8 @@ async def list_documents(
|
|||
extras["parent_page_id"] = parent_page_id
|
||||
if starred is not None:
|
||||
extras["starred"] = starred
|
||||
if workspace_id is not None:
|
||||
extras["workspace_id"] = workspace_id
|
||||
if extras:
|
||||
query = {"$and": [query, extras]}
|
||||
|
||||
|
|
@ -192,6 +197,8 @@ async def update_document(
|
|||
updates["starred"] = data.starred
|
||||
if data.stead_id is not None:
|
||||
updates["stead_id"] = data.stead_id
|
||||
if data.workspace_id is not None:
|
||||
updates["workspace_id"] = data.workspace_id
|
||||
if "parent_page_id" in data.model_fields_set:
|
||||
updates["parent_page_id"] = data.parent_page_id
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue