Skip to content

Commit

Permalink
feat(server): remove multiple user-members from workspace (#1281)
Browse files Browse the repository at this point in the history
* wip: remove multiple user members

* update reearthx to latest

* go mod tidy

* refactor

* remove removeUserFromWorkspace + refactor

* fix: e2e test
  • Loading branch information
nourbalaha authored Oct 24, 2024
1 parent 2b7ddb3 commit 935ca4d
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 165 deletions.
4 changes: 3 additions & 1 deletion server/e2e/gql_workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strings"
"testing"

"github.com/reearth/reearth-cms/server/internal/app"
Expand Down Expand Up @@ -270,7 +271,8 @@ func TestRemoveUserFromWorkspace(t *testing.T) {
assert.Nil(t, err)
assert.True(t, w.Members().HasUser(uId3))

query := fmt.Sprintf(`mutation { removeUserFromWorkspace(input: {workspaceId: "%s", userId: "%s"}){ workspace{ id } }}`, wId2, uId3)
uIds := accountdomain.UserIDList{uId2, uId3}
query := fmt.Sprintf(`mutation { removeMultipleMembersFromWorkspace(input: {workspaceId: "%s", userIds: ["%s"]}){ workspace{ id } }}`, wId2, strings.Join(uIds.Strings(), "\", \""))
request := GraphQLRequest{
Query: query,
}
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/oapi-codegen/runtime v1.1.1
github.com/paulmach/go.geojson v1.5.0
github.com/ravilushqa/otelgqlgen v0.17.0
github.com/reearth/reearthx v0.0.0-20240308140749-72a08570c19b
github.com/reearth/reearthx v0.0.0-20241023075926-e29bdd6c4ae3
github.com/robbiet480/go.sns v0.0.0-20230523235941-e8d832c79d68
github.com/samber/lo v1.47.0
github.com/sendgrid/sendgrid-go v3.16.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/ravilushqa/otelgqlgen v0.17.0 h1:bLwQfKqtj9P24QpjM2sc1ipBm5Fqv2u7DKN5LIpj3g8=
github.com/ravilushqa/otelgqlgen v0.17.0/go.mod h1:orOIikuYsay1y3CmLgd5gsHcT9EsnXwNKmkAplzzYXQ=
github.com/reearth/reearthx v0.0.0-20240308140749-72a08570c19b h1:wfTQ4SazfN9hYe13PqwnwB/E3Tw9+f99Y97iQRqOjso=
github.com/reearth/reearthx v0.0.0-20240308140749-72a08570c19b/go.mod h1:d1WXkdCVzSoc8pl3vW9/9yKfk4fdoZQZhX8Ot8jqgnc=
github.com/reearth/reearthx v0.0.0-20241023075926-e29bdd6c4ae3 h1:aFm6QNDFs08EKlrWJN9IBqdxlDUuCBIIgBIcPkLHOZY=
github.com/reearth/reearthx v0.0.0-20241023075926-e29bdd6c4ae3/go.mod h1:d1WXkdCVzSoc8pl3vW9/9yKfk4fdoZQZhX8Ot8jqgnc=
github.com/robbiet480/go.sns v0.0.0-20230523235941-e8d832c79d68 h1:Jknsfy5cqCH6qAuoU1qNZ51hfBJfMSJYwsH9j9mdVnw=
github.com/robbiet480/go.sns v0.0.0-20230523235941-e8d832c79d68/go.mod h1:9CDhL7uDVy8vEVDNPJzxq89dPaPBWP6hxQcC8woBHus=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
Expand Down
401 changes: 258 additions & 143 deletions server/internal/adapter/gql/generated.go

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions server/internal/adapter/gql/gqlmodel/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions server/internal/adapter/gql/resolver_workspace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions server/schemas/workspace.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ input AddIntegrationToWorkspaceInput {
role: Role!
}

input RemoveUserFromWorkspaceInput {
input RemoveMultipleMembersFromWorkspaceInput {
workspaceId: ID!
userId: ID!
userIds: [ID!]!
}

input RemoveIntegrationFromWorkspaceInput {
Expand Down Expand Up @@ -99,7 +99,11 @@ type AddUsersToWorkspacePayload {
workspace: Workspace!
}

type RemoveMemberFromWorkspacePayload {
type RemoveIntegrationFromWorkspacePayload {
workspace: Workspace!
}

type RemoveMultipleMembersFromWorkspacePayload {
workspace: Workspace!
}

Expand All @@ -117,8 +121,8 @@ extend type Mutation {
updateWorkspace(input: UpdateWorkspaceInput!): UpdateWorkspacePayload
addUsersToWorkspace(input: AddUsersToWorkspaceInput!): AddUsersToWorkspacePayload
addIntegrationToWorkspace(input: AddIntegrationToWorkspaceInput!): AddUsersToWorkspacePayload
removeUserFromWorkspace(input: RemoveUserFromWorkspaceInput!): RemoveMemberFromWorkspacePayload
removeIntegrationFromWorkspace(input: RemoveIntegrationFromWorkspaceInput!): RemoveMemberFromWorkspacePayload
removeMultipleMembersFromWorkspace(input: RemoveMultipleMembersFromWorkspaceInput!): RemoveMultipleMembersFromWorkspacePayload
removeIntegrationFromWorkspace(input: RemoveIntegrationFromWorkspaceInput!): RemoveIntegrationFromWorkspacePayload
updateUserOfWorkspace(input: UpdateUserOfWorkspaceInput!): UpdateMemberOfWorkspacePayload
updateIntegrationOfWorkspace(input: UpdateIntegrationOfWorkspaceInput!): UpdateMemberOfWorkspacePayload
}

0 comments on commit 935ca4d

Please sign in to comment.