Skip to content

Commit f84e8ad

Browse files
simplify
1 parent d2d3caa commit f84e8ad

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

packages/server/api/src/app/authentication/new-user/organization-assignment.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,12 @@ export async function assignDefaultOrganization(user: User): Promise<void> {
3232
});
3333

3434
const updatedUser = await userService.getOneOrFail({ id: user.id });
35-
const project = await projectService.getOneForUser(updatedUser);
35+
const project = await projectService.getUserProjectOrThrow(updatedUser.id);
3636

37-
if (!isNil(project)) {
38-
await addUserToDefaultWorkspace({
39-
email: user.email,
40-
workspaceId: project.tablesWorkspaceId,
41-
});
42-
} else {
43-
throw new ApplicationError({
44-
code: ErrorCode.ENTITY_NOT_FOUND,
45-
params: {
46-
message: 'No project found for user',
47-
},
48-
});
49-
}
37+
await addUserToDefaultWorkspace({
38+
email: user.email,
39+
workspaceId: project.tablesWorkspaceId,
40+
});
5041
}
5142

5243
async function addUserToDefaultWorkspace(values: {

0 commit comments

Comments
 (0)