Remove unused schema fields
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -48,8 +48,6 @@ export async function execute(
|
|||||||
expiresAt
|
expiresAt
|
||||||
status
|
status
|
||||||
createdAt
|
createdAt
|
||||||
user { id fullName emailAddress }
|
|
||||||
organization { id name }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1163,45 +1163,6 @@ func (s *OrganizationService) GetOrganizationForMembership(ctx context.Context,
|
|||||||
return organization, nil
|
return organization, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *OrganizationService) GetOrganizationForInvitation(ctx context.Context, invitationID gid.GID) (*coredata.Organization, error) {
|
|
||||||
var (
|
|
||||||
scope = coredata.NewScopeFromObjectID(invitationID)
|
|
||||||
organization = &coredata.Organization{}
|
|
||||||
)
|
|
||||||
|
|
||||||
err := s.pg.WithConn(
|
|
||||||
ctx,
|
|
||||||
func(conn pg.Conn) error {
|
|
||||||
invitation := &coredata.Invitation{}
|
|
||||||
err := invitation.LoadByID(ctx, conn, scope, invitationID)
|
|
||||||
if err != nil {
|
|
||||||
if err == coredata.ErrResourceNotFound {
|
|
||||||
return NewInvitationNotFoundError(invitationID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("cannot load invitation: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = organization.LoadByID(ctx, conn, scope, invitation.OrganizationID)
|
|
||||||
if err != nil {
|
|
||||||
if err == coredata.ErrResourceNotFound {
|
|
||||||
return NewOrganizationNotFoundError(invitation.OrganizationID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("cannot load organization: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return organization, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s OrganizationService) GenerateLogoURL(
|
func (s OrganizationService) GenerateLogoURL(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
|
|||||||
@@ -291,9 +291,6 @@ type Invitation implements Node {
|
|||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
status: InvitationStatus!
|
status: InvitationStatus!
|
||||||
|
|
||||||
user: Profile @goField(forceResolver: true)
|
|
||||||
organization: Organization @goField(forceResolver: true)
|
|
||||||
|
|
||||||
permission(action: String!): Boolean!
|
permission(action: String!): Boolean!
|
||||||
@goField(forceResolver: true)
|
@goField(forceResolver: true)
|
||||||
@session(required: PRESENT)
|
@session(required: PRESENT)
|
||||||
|
|||||||
@@ -165,10 +165,8 @@ type ComplexityRoot struct {
|
|||||||
CreatedAt func(childComplexity int) int
|
CreatedAt func(childComplexity int) int
|
||||||
ExpiresAt func(childComplexity int) int
|
ExpiresAt func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
Organization func(childComplexity int) int
|
|
||||||
Permission func(childComplexity int, action string) int
|
Permission func(childComplexity int, action string) int
|
||||||
Status func(childComplexity int) int
|
Status func(childComplexity int) int
|
||||||
User func(childComplexity int) int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvitationConnection struct {
|
InvitationConnection struct {
|
||||||
@@ -502,8 +500,6 @@ type IdentityResolver interface {
|
|||||||
Permission(ctx context.Context, obj *types.Identity, action string) (bool, error)
|
Permission(ctx context.Context, obj *types.Identity, action string) (bool, error)
|
||||||
}
|
}
|
||||||
type InvitationResolver interface {
|
type InvitationResolver interface {
|
||||||
User(ctx context.Context, obj *types.Invitation) (*types.Profile, error)
|
|
||||||
Organization(ctx context.Context, obj *types.Invitation) (*types.Organization, error)
|
|
||||||
Permission(ctx context.Context, obj *types.Invitation, action string) (bool, error)
|
Permission(ctx context.Context, obj *types.Invitation, action string) (bool, error)
|
||||||
}
|
}
|
||||||
type MembershipResolver interface {
|
type MembershipResolver interface {
|
||||||
@@ -913,12 +909,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Invitation.ID(childComplexity), true
|
return e.complexity.Invitation.ID(childComplexity), true
|
||||||
case "Invitation.organization":
|
|
||||||
if e.complexity.Invitation.Organization == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Invitation.Organization(childComplexity), true
|
|
||||||
case "Invitation.permission":
|
case "Invitation.permission":
|
||||||
if e.complexity.Invitation.Permission == nil {
|
if e.complexity.Invitation.Permission == nil {
|
||||||
break
|
break
|
||||||
@@ -936,12 +926,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Invitation.Status(childComplexity), true
|
return e.complexity.Invitation.Status(childComplexity), true
|
||||||
case "Invitation.user":
|
|
||||||
if e.complexity.Invitation.User == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Invitation.User(childComplexity), true
|
|
||||||
|
|
||||||
case "InvitationConnection.edges":
|
case "InvitationConnection.edges":
|
||||||
if e.complexity.InvitationConnection.Edges == nil {
|
if e.complexity.InvitationConnection.Edges == nil {
|
||||||
@@ -2763,9 +2747,6 @@ type Invitation implements Node {
|
|||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
status: InvitationStatus!
|
status: InvitationStatus!
|
||||||
|
|
||||||
user: Profile @goField(forceResolver: true)
|
|
||||||
organization: Organization @goField(forceResolver: true)
|
|
||||||
|
|
||||||
permission(action: String!): Boolean!
|
permission(action: String!): Boolean!
|
||||||
@goField(forceResolver: true)
|
@goField(forceResolver: true)
|
||||||
@session(required: PRESENT)
|
@session(required: PRESENT)
|
||||||
@@ -5753,132 +5734,6 @@ func (ec *executionContext) fieldContext_Invitation_status(_ context.Context, fi
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Invitation_user(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
|
||||||
return graphql.ResolveField(
|
|
||||||
ctx,
|
|
||||||
ec.OperationContext,
|
|
||||||
field,
|
|
||||||
ec.fieldContext_Invitation_user,
|
|
||||||
func(ctx context.Context) (any, error) {
|
|
||||||
return ec.resolvers.Invitation().User(ctx, obj)
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
ec.marshalOProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconnectᚋv1ᚋtypesᚐProfile,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Invitation_user(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "Invitation",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: true,
|
|
||||||
IsResolver: true,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
switch field.Name {
|
|
||||||
case "id":
|
|
||||||
return ec.fieldContext_Profile_id(ctx, field)
|
|
||||||
case "fullName":
|
|
||||||
return ec.fieldContext_Profile_fullName(ctx, field)
|
|
||||||
case "emailAddress":
|
|
||||||
return ec.fieldContext_Profile_emailAddress(ctx, field)
|
|
||||||
case "source":
|
|
||||||
return ec.fieldContext_Profile_source(ctx, field)
|
|
||||||
case "state":
|
|
||||||
return ec.fieldContext_Profile_state(ctx, field)
|
|
||||||
case "additionalEmailAddresses":
|
|
||||||
return ec.fieldContext_Profile_additionalEmailAddresses(ctx, field)
|
|
||||||
case "kind":
|
|
||||||
return ec.fieldContext_Profile_kind(ctx, field)
|
|
||||||
case "position":
|
|
||||||
return ec.fieldContext_Profile_position(ctx, field)
|
|
||||||
case "contractStartDate":
|
|
||||||
return ec.fieldContext_Profile_contractStartDate(ctx, field)
|
|
||||||
case "contractEndDate":
|
|
||||||
return ec.fieldContext_Profile_contractEndDate(ctx, field)
|
|
||||||
case "createdAt":
|
|
||||||
return ec.fieldContext_Profile_createdAt(ctx, field)
|
|
||||||
case "updatedAt":
|
|
||||||
return ec.fieldContext_Profile_updatedAt(ctx, field)
|
|
||||||
case "identity":
|
|
||||||
return ec.fieldContext_Profile_identity(ctx, field)
|
|
||||||
case "organization":
|
|
||||||
return ec.fieldContext_Profile_organization(ctx, field)
|
|
||||||
case "membership":
|
|
||||||
return ec.fieldContext_Profile_membership(ctx, field)
|
|
||||||
case "pendingInvitations":
|
|
||||||
return ec.fieldContext_Profile_pendingInvitations(ctx, field)
|
|
||||||
case "permission":
|
|
||||||
return ec.fieldContext_Profile_permission(ctx, field)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("no field named %q was found under type Profile", field.Name)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _Invitation_organization(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
|
||||||
return graphql.ResolveField(
|
|
||||||
ctx,
|
|
||||||
ec.OperationContext,
|
|
||||||
field,
|
|
||||||
ec.fieldContext_Invitation_organization,
|
|
||||||
func(ctx context.Context) (any, error) {
|
|
||||||
return ec.resolvers.Invitation().Organization(ctx, obj)
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
ec.marshalOOrganization2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconnectᚋv1ᚋtypesᚐOrganization,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Invitation_organization(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "Invitation",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: true,
|
|
||||||
IsResolver: true,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
switch field.Name {
|
|
||||||
case "id":
|
|
||||||
return ec.fieldContext_Organization_id(ctx, field)
|
|
||||||
case "name":
|
|
||||||
return ec.fieldContext_Organization_name(ctx, field)
|
|
||||||
case "logoUrl":
|
|
||||||
return ec.fieldContext_Organization_logoUrl(ctx, field)
|
|
||||||
case "horizontalLogoUrl":
|
|
||||||
return ec.fieldContext_Organization_horizontalLogoUrl(ctx, field)
|
|
||||||
case "email":
|
|
||||||
return ec.fieldContext_Organization_email(ctx, field)
|
|
||||||
case "description":
|
|
||||||
return ec.fieldContext_Organization_description(ctx, field)
|
|
||||||
case "websiteUrl":
|
|
||||||
return ec.fieldContext_Organization_websiteUrl(ctx, field)
|
|
||||||
case "headquarterAddress":
|
|
||||||
return ec.fieldContext_Organization_headquarterAddress(ctx, field)
|
|
||||||
case "createdAt":
|
|
||||||
return ec.fieldContext_Organization_createdAt(ctx, field)
|
|
||||||
case "updatedAt":
|
|
||||||
return ec.fieldContext_Organization_updatedAt(ctx, field)
|
|
||||||
case "profiles":
|
|
||||||
return ec.fieldContext_Organization_profiles(ctx, field)
|
|
||||||
case "samlConfigurations":
|
|
||||||
return ec.fieldContext_Organization_samlConfigurations(ctx, field)
|
|
||||||
case "scimConfiguration":
|
|
||||||
return ec.fieldContext_Organization_scimConfiguration(ctx, field)
|
|
||||||
case "viewer":
|
|
||||||
return ec.fieldContext_Organization_viewer(ctx, field)
|
|
||||||
case "permission":
|
|
||||||
return ec.fieldContext_Organization_permission(ctx, field)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _Invitation_permission(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Invitation_permission(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
||||||
return graphql.ResolveField(
|
return graphql.ResolveField(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -6046,10 +5901,6 @@ func (ec *executionContext) fieldContext_InvitationEdge_node(_ context.Context,
|
|||||||
return ec.fieldContext_Invitation_createdAt(ctx, field)
|
return ec.fieldContext_Invitation_createdAt(ctx, field)
|
||||||
case "status":
|
case "status":
|
||||||
return ec.fieldContext_Invitation_status(ctx, field)
|
return ec.fieldContext_Invitation_status(ctx, field)
|
||||||
case "user":
|
|
||||||
return ec.fieldContext_Invitation_user(ctx, field)
|
|
||||||
case "organization":
|
|
||||||
return ec.fieldContext_Invitation_organization(ctx, field)
|
|
||||||
case "permission":
|
case "permission":
|
||||||
return ec.fieldContext_Invitation_permission(ctx, field)
|
return ec.fieldContext_Invitation_permission(ctx, field)
|
||||||
}
|
}
|
||||||
@@ -17618,72 +17469,6 @@ func (ec *executionContext) _Invitation(ctx context.Context, sel ast.SelectionSe
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
case "user":
|
|
||||||
field := field
|
|
||||||
|
|
||||||
innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
ec.Error(ctx, ec.Recover(ctx, r))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
res = ec._Invitation_user(ctx, field, obj)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
if field.Deferrable != nil {
|
|
||||||
dfs, ok := deferred[field.Deferrable.Label]
|
|
||||||
di := 0
|
|
||||||
if ok {
|
|
||||||
dfs.AddField(field)
|
|
||||||
di = len(dfs.Values) - 1
|
|
||||||
} else {
|
|
||||||
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
|
|
||||||
deferred[field.Deferrable.Label] = dfs
|
|
||||||
}
|
|
||||||
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
|
|
||||||
return innerFunc(ctx, dfs)
|
|
||||||
})
|
|
||||||
|
|
||||||
// don't run the out.Concurrently() call below
|
|
||||||
out.Values[i] = graphql.Null
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
|
||||||
case "organization":
|
|
||||||
field := field
|
|
||||||
|
|
||||||
innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
ec.Error(ctx, ec.Recover(ctx, r))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
res = ec._Invitation_organization(ctx, field, obj)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
if field.Deferrable != nil {
|
|
||||||
dfs, ok := deferred[field.Deferrable.Label]
|
|
||||||
di := 0
|
|
||||||
if ok {
|
|
||||||
dfs.AddField(field)
|
|
||||||
di = len(dfs.Values) - 1
|
|
||||||
} else {
|
|
||||||
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
|
|
||||||
deferred[field.Deferrable.Label] = dfs
|
|
||||||
}
|
|
||||||
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
|
|
||||||
return innerFunc(ctx, dfs)
|
|
||||||
})
|
|
||||||
|
|
||||||
// don't run the out.Concurrently() call below
|
|
||||||
out.Values[i] = graphql.Null
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
|
||||||
case "permission":
|
case "permission":
|
||||||
field := field
|
field := field
|
||||||
|
|
||||||
|
|||||||
@@ -68,11 +68,5 @@ func NewInvitation(invitation *coredata.Invitation) *Invitation {
|
|||||||
AcceptedAt: invitation.AcceptedAt,
|
AcceptedAt: invitation.AcceptedAt,
|
||||||
CreatedAt: invitation.CreatedAt,
|
CreatedAt: invitation.CreatedAt,
|
||||||
Status: invitation.Status,
|
Status: invitation.Status,
|
||||||
User: &Profile{
|
|
||||||
ID: invitation.UserID,
|
|
||||||
},
|
|
||||||
Organization: &Organization{
|
|
||||||
ID: invitation.OrganizationID,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,8 +213,6 @@ type Invitation struct {
|
|||||||
AcceptedAt *time.Time `json:"acceptedAt,omitempty"`
|
AcceptedAt *time.Time `json:"acceptedAt,omitempty"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Status coredata.InvitationStatus `json:"status"`
|
Status coredata.InvitationStatus `json:"status"`
|
||||||
User *Profile `json:"user,omitempty"`
|
|
||||||
Organization *Organization `json:"organization,omitempty"`
|
|
||||||
Permission bool `json:"permission"`
|
Permission bool `json:"permission"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,32 +189,6 @@ func (r *identityResolver) Permission(ctx context.Context, obj *types.Identity,
|
|||||||
return r.Resolver.Permission(ctx, obj, action)
|
return r.Resolver.Permission(ctx, obj, action)
|
||||||
}
|
}
|
||||||
|
|
||||||
// User is the resolver for the user field.
|
|
||||||
func (r *invitationResolver) User(ctx context.Context, obj *types.Invitation) (*types.Profile, error) {
|
|
||||||
panic(fmt.Errorf("not implemented: User - user"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Organization is the resolver for the organization field.
|
|
||||||
func (r *invitationResolver) Organization(ctx context.Context, obj *types.Invitation) (*types.Organization, error) {
|
|
||||||
if err := r.authorize(ctx, obj.Organization.ID, iam.ActionOrganizationGet, authz.WithSkipAssumptionCheck()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if gqlutils.OnlyIDSelected(ctx) {
|
|
||||||
return &types.Organization{
|
|
||||||
ID: obj.Organization.ID,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
organization, err := r.iam.OrganizationService.GetOrganizationForInvitation(ctx, obj.ID)
|
|
||||||
if err != nil {
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot get organization for invitation", log.Error(err))
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
return types.NewOrganization(organization), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Permission is the resolver for the permission field.
|
// Permission is the resolver for the permission field.
|
||||||
func (r *invitationResolver) Permission(ctx context.Context, obj *types.Invitation, action string) (bool, error) {
|
func (r *invitationResolver) Permission(ctx context.Context, obj *types.Invitation, action string) (bool, error) {
|
||||||
return r.Resolver.Permission(ctx, obj, action)
|
return r.Resolver.Permission(ctx, obj, action)
|
||||||
|
|||||||
Reference in New Issue
Block a user