Skip to content

Commit

Permalink
Update get-default-workspace.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed May 19, 2024
1 parent 452e31d commit c76512b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/web/lib/middleware/utils/get-default-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ export async function getDefaultWorkspace(user: UserProps) {
where: {
id: user.id,
},
select: {
defaultWorkspace: true,
projects: {
select: {
project: {
select: {
slug: true,
},
},
},
take: 1,
},
},
});
defaultWorkspace = refereshedUser?.defaultWorkspace || undefined;
defaultWorkspace =
refereshedUser?.defaultWorkspace ||
refereshedUser?.projects[0]?.project?.slug ||
undefined;
}

return defaultWorkspace;
Expand Down

0 comments on commit c76512b

Please sign in to comment.