-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organizations can now own projects. The frontend presents this as a one-to-many relationship, where each project is owned by just one org. In the backend, it's really a many-to-many relationship, so that we can make it possible for projects to belong to more than one org if we decide to go that route in the future. Commit summary below. * Add OrgProjects table and GQL config No DB migrations yet; those will go in their own commit. * DB migration for OrgProjects table * GraphQL changes for orgs to own projects Projects can be created with an optional owning org, and already-created projects can be acquired and released by an org. * Don't throw if added org member already exists * Restrict AddProjectToOrg GQL: must be org member and project manager Only users who are an org member *and* a project manager can add that project to that org. Removing projects follows same permissions as adding them: must be a manager of that project, and must be a member of the org you're removing it from. * Add second test organization * Make sena-3 be owned by test org in seeding data The elawa project will remain unowned, so that we can test that orgs with no projects acquiring their first project (e.g., second test org acquiring elawa) work just as well. * Org page now shows projects owned * Remove UTF-8 BOM from files that don't need it --------- Co-authored-by: Kevin Hahn <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,698 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
backend/LexBoxApi/GraphQL/CustomTypes/OrgProjectsGqlConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using LexCore.Entities; | ||
|
||
namespace LexBoxApi.GraphQL.CustomTypes; | ||
|
||
[ObjectType] | ||
public class OrgProjectsGqlConfiguration : ObjectType<OrgProjects> | ||
{ | ||
protected override void Configure(IObjectTypeDescriptor<OrgProjects> descriptor) | ||
{ | ||
descriptor.Field(op => op.Org).Type<NonNullType<OrgGqlConfiguration>>(); | ||
descriptor.Field(op => op.Project).Type<NonNullType<ProjectGqlConfiguration>>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace LexCore.Entities; | ||
|
||
public class OrgProjects : EntityBase | ||
{ | ||
public Guid OrgId { get; set; } | ||
public Guid ProjectId { get; set; } | ||
public Organization? Org { get; set; } | ||
public Project? Project { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
backend/LexData/Entities/OrgProjectsEntityConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using LexCore.Entities; | ||
using LexData.Configuration; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace LexData.Entities; | ||
|
||
public class OrgProjectsEntityConfiguration : EntityBaseConfiguration<OrgProjects> | ||
{ | ||
public override void Configure(EntityTypeBuilder<OrgProjects> builder) | ||
{ | ||
base.Configure(builder); | ||
builder.HasIndex(op => new { op.OrgId, op.ProjectId }).IsUnique(); | ||
builder.HasQueryFilter(op => op.Project!.DeletedDate == null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.