Skip to content

Commit

Permalink
fix: set default workspace samples to empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
allanhvam committed Aug 19, 2024
1 parent 12be822 commit 9dcd499
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/app/workspaces/create-workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions web/src/SAP/src/repositories/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9dcd499

Please sign in to comment.