Skip to content

Commit

Permalink
Better way to get project IDs in org
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Hahn <[email protected]>
  • Loading branch information
rmunn and hahn-kev authored Oct 18, 2024
1 parent f4ff428 commit 3cd0c53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/LexBoxApi/GraphQL/OrgMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public async Task<IQueryable<Organization>> AddProjectsToOrg(
await permissionService.AssertCanManageProject(projectId);
}
// Now exclude any projects that don't actually exist or the org already has or that don't exist
var alreadyInOrg = dbContext.OrgProjects.Where(op => op.OrgId == orgId).Select(op => op.ProjectId).ToHashSet() ?? [];
var alreadyInOrg = org.Projects.Select(o => o.Id).ToHashSet();
var filteredIds = projectIds.Where(id => !alreadyInOrg.Contains(id));
// Also filter out any project IDs that don't really exist
var existingIds = await dbContext.Projects.Where(p => filteredIds.Contains(p.Id)).Select(p => p.Id).ToListAsync() ?? [];
Expand Down

0 comments on commit 3cd0c53

Please sign in to comment.