Fix invite user dialog create people + connection prepend edge
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -90,6 +90,12 @@ type (
|
||||
AttributeRole *string
|
||||
AutoSignupEnabled *bool
|
||||
}
|
||||
|
||||
CreateInvitationRequest struct {
|
||||
Email mail.Addr
|
||||
FullName string
|
||||
Role coredata.MembershipRole
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -350,9 +356,7 @@ func (s *OrganizationService) CountInvitations(
|
||||
func (s *OrganizationService) InviteMember(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
emailAddress mail.Addr,
|
||||
fullName string,
|
||||
role coredata.MembershipRole,
|
||||
req *CreateInvitationRequest,
|
||||
) (*coredata.Invitation, error) {
|
||||
var (
|
||||
scope = coredata.NewScopeFromObjectID(organizationID)
|
||||
@@ -360,9 +364,9 @@ func (s *OrganizationService) InviteMember(
|
||||
invitation = &coredata.Invitation{
|
||||
ID: gid.New(organizationID.TenantID(), coredata.InvitationEntityType),
|
||||
OrganizationID: organizationID,
|
||||
Email: emailAddress,
|
||||
FullName: fullName,
|
||||
Role: role,
|
||||
Email: req.Email,
|
||||
FullName: req.FullName,
|
||||
Role: req.Role,
|
||||
Status: coredata.InvitationStatusPending,
|
||||
ExpiresAt: now.Add(s.invitationTokenValidity),
|
||||
CreatedAt: now,
|
||||
@@ -383,7 +387,7 @@ func (s *OrganizationService) InviteMember(
|
||||
}
|
||||
|
||||
identity := &coredata.Identity{}
|
||||
err = identity.LoadByEmail(ctx, tx, emailAddress)
|
||||
err = identity.LoadByEmail(ctx, tx, invitation.Email)
|
||||
if err != nil && err != coredata.ErrResourceNotFound {
|
||||
return fmt.Errorf("cannot load identity: %w", err)
|
||||
}
|
||||
|
||||
@@ -608,7 +608,6 @@ input InviteMemberInput {
|
||||
email: EmailAddr!
|
||||
fullName: String!
|
||||
role: MembershipRole!
|
||||
createPeople: Boolean!
|
||||
}
|
||||
|
||||
input UpdateMembershipInput {
|
||||
|
||||
@@ -2615,7 +2615,6 @@ input InviteMemberInput {
|
||||
email: EmailAddr!
|
||||
fullName: String!
|
||||
role: MembershipRole!
|
||||
createPeople: Boolean!
|
||||
}
|
||||
|
||||
input UpdateMembershipInput {
|
||||
@@ -12795,7 +12794,7 @@ func (ec *executionContext) unmarshalInputInviteMemberInput(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"organizationId", "email", "fullName", "role", "createPeople"}
|
||||
fieldsInOrder := [...]string{"organizationId", "email", "fullName", "role"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
@@ -12830,13 +12829,6 @@ func (ec *executionContext) unmarshalInputInviteMemberInput(ctx context.Context,
|
||||
return it, err
|
||||
}
|
||||
it.Role = data
|
||||
case "createPeople":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("createPeople"))
|
||||
data, err := ec.unmarshalNBoolean2bool(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.CreatePeople = data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,6 @@ type InviteMemberInput struct {
|
||||
Email mail.Addr `json:"email"`
|
||||
FullName string `json:"fullName"`
|
||||
Role coredata.MembershipRole `json:"role"`
|
||||
CreatePeople bool `json:"createPeople"`
|
||||
}
|
||||
|
||||
type InviteMemberPayload struct {
|
||||
|
||||
@@ -884,9 +884,11 @@ func (r *mutationResolver) InviteMember(ctx context.Context, input types.InviteM
|
||||
invitation, err := r.iam.OrganizationService.InviteMember(
|
||||
ctx,
|
||||
input.OrganizationID,
|
||||
input.Email,
|
||||
input.FullName,
|
||||
coredata.MembershipRoleViewer,
|
||||
&iam.CreateInvitationRequest{
|
||||
Email: input.Email,
|
||||
FullName: input.FullName,
|
||||
Role: input.Role,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
var errOrganizationNotFound *iam.ErrOrganizationNotFound
|
||||
|
||||
Reference in New Issue
Block a user