diff --git a/app/src/app/workspaces/create-workspace.tsx b/app/src/app/workspaces/create-workspace.tsx index 60a21e5..e9aabe2 100644 --- a/app/src/app/workspaces/create-workspace.tsx +++ b/app/src/app/workspaces/create-workspace.tsx @@ -12,7 +12,7 @@ export function CreateWorkspace() { const [ createWorkspaceQueryState, createWorkspaceMutation, - ] = useMutation((name: string) => createWorkspace({ name })); + ] = useMutation((name: string) => createWorkspace({ name, samples: [] })); const [needsNotify, setNeedsNotify] = useState(true); diff --git a/web/src/SAP/src/repositories/workspaces.py b/web/src/SAP/src/repositories/workspaces.py index 5f8e342..4ef5e21 100644 --- a/web/src/SAP/src/repositories/workspaces.py +++ b/web/src/SAP/src/repositories/workspaces.py @@ -62,6 +62,10 @@ def create_workspace(user: str, workspace: CreateWorkspace): conn = get_connection() db = conn[DB_NAME] workspaces = db[WORKSPACES_COL_NAME] + + if workspace.samples is None: + workspace.samples = [] + record = {**workspace.to_dict(), "created_by": user} return workspaces.update_one({'created_by': user, 'name': workspace.name}, {"$set": record}, upsert=True)