Skip to content

Commit

Permalink
Merge pull request #90 from ssi-dk/fix/create-workspace
Browse files Browse the repository at this point in the history
fix: set default workspace samples to empty list
  • Loading branch information
allanhvam committed Aug 19, 2024
2 parents 12be822 + 9dcd499 commit ff6a4cc
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 ff6a4cc

Please sign in to comment.