Fix misuse of bang

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-19 17:23:50 +01:00
parent 397baaea9f
commit 0c79bf4b9b
4 changed files with 411 additions and 750 deletions

View File

@@ -59,73 +59,73 @@ type Query {
} }
type Mutation { type Mutation {
signIn(input: SignInInput!): SignInPayload! @session(required: OPTIONAL) signIn(input: SignInInput!): SignInPayload @session(required: OPTIONAL)
signUp(input: SignUpInput!): SignUpPayload! @session(required: NONE) signUp(input: SignUpInput!): SignUpPayload @session(required: NONE)
signOut: SignOutPayload! @session(required: PRESENT) signOut: SignOutPayload @session(required: PRESENT)
signUpFromInvitation( signUpFromInvitation(
input: SignUpFromInvitationInput! input: SignUpFromInvitationInput!
): SignUpFromInvitationPayload! @session(required: NONE) ): SignUpFromInvitationPayload @session(required: NONE)
forgotPassword(input: ForgotPasswordInput!): ForgotPasswordPayload! forgotPassword(input: ForgotPasswordInput!): ForgotPasswordPayload
@session(required: NONE) @session(required: NONE)
resetPassword(input: ResetPasswordInput!): ResetPasswordPayload! resetPassword(input: ResetPasswordInput!): ResetPasswordPayload
@session(required: NONE) @session(required: NONE)
verifyEmail(input: VerifyEmailInput!): VerifyEmailPayload! verifyEmail(input: VerifyEmailInput!): VerifyEmailPayload
@session(required: OPTIONAL) @session(required: OPTIONAL)
changePassword(input: ChangePasswordInput!): ChangePasswordPayload! changePassword(input: ChangePasswordInput!): ChangePasswordPayload
@session(required: PRESENT) @session(required: PRESENT)
changeEmail(input: ChangeEmailInput!): ChangeEmailPayload! changeEmail(input: ChangeEmailInput!): ChangeEmailPayload
@session(required: PRESENT) @session(required: PRESENT)
assumeOrganizationSession( assumeOrganizationSession(
input: AssumeOrganizationSessionInput! input: AssumeOrganizationSessionInput!
): AssumeOrganizationSessionPayload! @session(required: PRESENT) ): AssumeOrganizationSessionPayload @session(required: PRESENT)
updateIdentityProfile( updateIdentityProfile(
input: UpdateIdentityProfileInput! input: UpdateIdentityProfileInput!
): UpdateIdentityProfilePayload! @session(required: PRESENT) ): UpdateIdentityProfilePayload @session(required: PRESENT)
revokeSession(input: RevokeSessionInput!): RevokeSessionPayload! revokeSession(input: RevokeSessionInput!): RevokeSessionPayload!
@session(required: PRESENT) @session(required: PRESENT)
revokeAllSessions: RevokeAllSessionsPayload! @session(required: PRESENT) revokeAllSessions: RevokeAllSessionsPayload @session(required: PRESENT)
createPersonalAPIKey( createPersonalAPIKey(
input: CreatePersonalAPIKeyInput! input: CreatePersonalAPIKeyInput!
): CreatePersonalAPIKeyPayload! @session(required: PRESENT) ): CreatePersonalAPIKeyPayload @session(required: PRESENT)
updatePersonalAPIKey( updatePersonalAPIKey(
input: UpdatePersonalAPIKeyInput! input: UpdatePersonalAPIKeyInput!
): UpdatePersonalAPIKeyPayload! @session(required: PRESENT) ): UpdatePersonalAPIKeyPayload @session(required: PRESENT)
revokePersonalAPIKey( revokePersonalAPIKey(
input: RevokePersonalAPIKeyInput! input: RevokePersonalAPIKeyInput!
): RevokePersonalAPIKeyPayload! @session(required: PRESENT) ): RevokePersonalAPIKeyPayload @session(required: PRESENT)
createOrganization( createOrganization(
input: CreateOrganizationInput! input: CreateOrganizationInput!
): CreateOrganizationPayload! @session(required: PRESENT) ): CreateOrganizationPayload @session(required: PRESENT)
updateOrganization( updateOrganization(
input: UpdateOrganizationInput! input: UpdateOrganizationInput!
): UpdateOrganizationPayload! @session(required: PRESENT) ): UpdateOrganizationPayload @session(required: PRESENT)
deleteOrganization( deleteOrganization(
input: DeleteOrganizationInput! input: DeleteOrganizationInput!
): DeleteOrganizationPayload! @session(required: PRESENT) ): DeleteOrganizationPayload @session(required: PRESENT)
inviteMember(input: InviteMemberInput!): InviteMemberPayload! inviteMember(input: InviteMemberInput!): InviteMemberPayload
@session(required: PRESENT) @session(required: PRESENT)
deleteInvitation(input: DeleteInvitationInput!): DeleteInvitationPayload! deleteInvitation(input: DeleteInvitationInput!): DeleteInvitationPayload
@session(required: PRESENT) @session(required: PRESENT)
removeMember(input: RemoveMemberInput!): RemoveMemberPayload! removeMember(input: RemoveMemberInput!): RemoveMemberPayload
@session(required: PRESENT) @session(required: PRESENT)
acceptInvitation(input: AcceptInvitationInput!): AcceptInvitationPayload! acceptInvitation(input: AcceptInvitationInput!): AcceptInvitationPayload
@session(required: PRESENT) @session(required: PRESENT)
createSAMLConfiguration( createSAMLConfiguration(
input: CreateSAMLConfigurationInput! input: CreateSAMLConfigurationInput!
): CreateSAMLConfigurationPayload! @session(required: PRESENT) ): CreateSAMLConfigurationPayload @session(required: PRESENT)
updateSAMLConfiguration( updateSAMLConfiguration(
input: UpdateSAMLConfigurationInput! input: UpdateSAMLConfigurationInput!
): UpdateSAMLConfigurationPayload! @session(required: PRESENT) ): UpdateSAMLConfigurationPayload @session(required: PRESENT)
deleteSAMLConfiguration( deleteSAMLConfiguration(
input: DeleteSAMLConfigurationInput! input: DeleteSAMLConfigurationInput!
): DeleteSAMLConfigurationPayload! @session(required: PRESENT) ): DeleteSAMLConfigurationPayload @session(required: PRESENT)
} }
type Identity implements Node { type Identity implements Node {
@@ -141,7 +141,7 @@ type Identity implements Node {
last: Int last: Int
before: CursorKey before: CursorKey
orderBy: MembershipOrder orderBy: MembershipOrder
): MembershipConnection! @goField(forceResolver: true) @isViewer ): MembershipConnection @goField(forceResolver: true) @isViewer
pendingInvitations( pendingInvitations(
first: Int first: Int
@@ -149,7 +149,7 @@ type Identity implements Node {
last: Int last: Int
before: CursorKey before: CursorKey
orderBy: InvitationOrder orderBy: InvitationOrder
): InvitationConnection! @goField(forceResolver: true) @isViewer ): InvitationConnection @goField(forceResolver: true) @isViewer
sessions( sessions(
first: Int first: Int
@@ -157,14 +157,14 @@ type Identity implements Node {
last: Int last: Int
before: CursorKey before: CursorKey
orderBy: SessionOrder orderBy: SessionOrder
): SessionConnection! @goField(forceResolver: true) @isViewer ): SessionConnection @goField(forceResolver: true) @isViewer
personalAPIKeys( personalAPIKeys(
first: Int first: Int
after: CursorKey after: CursorKey
last: Int last: Int
before: CursorKey before: CursorKey
): PersonalAPIKeyConnection! @goField(forceResolver: true) @isViewer ): PersonalAPIKeyConnection @goField(forceResolver: true) @isViewer
profileFor(organizationId: ID!): IdentityProfile @isViewer profileFor(organizationId: ID!): IdentityProfile @isViewer
} }
@@ -208,7 +208,7 @@ type Organization implements Node {
after: CursorKey after: CursorKey
last: Int last: Int
before: CursorKey before: CursorKey
): MembershipConnection! @goField(forceResolver: true) ): MembershipConnection @goField(forceResolver: true)
invitations( invitations(
first: Int first: Int
@@ -216,14 +216,14 @@ type Organization implements Node {
last: Int last: Int
before: CursorKey before: CursorKey
status: InvitationStatus status: InvitationStatus
): InvitationConnection! @goField(forceResolver: true) ): InvitationConnection @goField(forceResolver: true)
samlConfigurations( samlConfigurations(
first: Int first: Int
after: CursorKey after: CursorKey
last: Int last: Int
before: CursorKey before: CursorKey
): SAMLConfigurationConnection! @goField(forceResolver: true) ): SAMLConfigurationConnection @goField(forceResolver: true)
availableApplications: [Application!]! availableApplications: [Application!]!
} }
@@ -244,8 +244,8 @@ type Membership implements Node {
identityId: ID! identityId: ID!
createdAt: Datetime! createdAt: Datetime!
profile: IdentityProfile! profile: IdentityProfile!
identity: Identity! @goField(forceResolver: true) identity: Identity @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true) organization: Organization @goField(forceResolver: true)
role: MembershipRole! role: MembershipRole!
permissions: [Permission!]! permissions: [Permission!]!
provisionedBy: ProvisioningSource! provisionedBy: ProvisioningSource!
@@ -263,7 +263,7 @@ type Invitation implements Node {
acceptedAt: Datetime acceptedAt: Datetime
createdAt: Datetime! createdAt: Datetime!
status: InvitationStatus! status: InvitationStatus!
organization: Organization! @goField(forceResolver: true) organization: Organization @goField(forceResolver: true)
} }
type Session implements Node { type Session implements Node {
@@ -450,7 +450,7 @@ type MembershipConnection
) { ) {
edges: [MembershipEdge!]! edges: [MembershipEdge!]!
pageInfo: PageInfo! pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true) totalCount: Int @goField(forceResolver: true)
} }
type MembershipEdge { type MembershipEdge {
@@ -492,7 +492,7 @@ type InvitationConnection
) { ) {
edges: [InvitationEdge!]! edges: [InvitationEdge!]!
pageInfo: PageInfo! pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true) totalCount: Int @goField(forceResolver: true)
} }
type InvitationEdge { type InvitationEdge {
@@ -506,7 +506,7 @@ type SessionConnection
) { ) {
edges: [SessionEdge!]! edges: [SessionEdge!]!
pageInfo: PageInfo! pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true) totalCount: Int @goField(forceResolver: true)
} }
type SessionEdge { type SessionEdge {
@@ -520,7 +520,7 @@ type PersonalAPIKeyConnection
) { ) {
edges: [PersonalAPIKeyEdge!]! edges: [PersonalAPIKeyEdge!]!
pageInfo: PageInfo! pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true) totalCount: Int @goField(forceResolver: true)
} }
type PersonalAPIKeyEdge { type PersonalAPIKeyEdge {
@@ -534,7 +534,7 @@ type SAMLConfigurationConnection
) { ) {
edges: [SAMLConfigurationEdge!]! edges: [SAMLConfigurationEdge!]!
pageInfo: PageInfo! pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true) totalCount: Int @goField(forceResolver: true)
} }
type SAMLConfigurationEdge { type SAMLConfigurationEdge {

File diff suppressed because it is too large Load Diff

View File

@@ -170,10 +170,10 @@ type Identity struct {
EmailVerified bool `json:"emailVerified"` EmailVerified bool `json:"emailVerified"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"` UpdatedAt time.Time `json:"updatedAt"`
Memberships *MembershipConnection `json:"memberships"` Memberships *MembershipConnection `json:"memberships,omitempty"`
PendingInvitations *InvitationConnection `json:"pendingInvitations"` PendingInvitations *InvitationConnection `json:"pendingInvitations,omitempty"`
Sessions *SessionConnection `json:"sessions"` Sessions *SessionConnection `json:"sessions,omitempty"`
PersonalAPIKeys *PersonalAPIKeyConnection `json:"personalAPIKeys"` PersonalAPIKeys *PersonalAPIKeyConnection `json:"personalAPIKeys,omitempty"`
ProfileFor *IdentityProfile `json:"profileFor,omitempty"` ProfileFor *IdentityProfile `json:"profileFor,omitempty"`
} }
@@ -212,7 +212,7 @@ 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"`
Organization *Organization `json:"organization"` Organization *Organization `json:"organization,omitempty"`
} }
func (Invitation) IsNode() {} func (Invitation) IsNode() {}
@@ -238,8 +238,8 @@ type Membership struct {
IdentityID gid.GID `json:"identityId"` IdentityID gid.GID `json:"identityId"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
Profile *IdentityProfile `json:"profile"` Profile *IdentityProfile `json:"profile"`
Identity *Identity `json:"identity"` Identity *Identity `json:"identity,omitempty"`
Organization *Organization `json:"organization"` Organization *Organization `json:"organization,omitempty"`
Role coredata.MembershipRole `json:"role"` Role coredata.MembershipRole `json:"role"`
Permissions []*Permission `json:"permissions"` Permissions []*Permission `json:"permissions"`
ProvisionedBy ProvisioningSource `json:"provisionedBy"` ProvisionedBy ProvisioningSource `json:"provisionedBy"`
@@ -266,9 +266,9 @@ type Organization struct {
HorizontalLogoURL *string `json:"horizontalLogoUrl,omitempty"` HorizontalLogoURL *string `json:"horizontalLogoUrl,omitempty"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"` UpdatedAt time.Time `json:"updatedAt"`
Members *MembershipConnection `json:"members"` Members *MembershipConnection `json:"members,omitempty"`
Invitations *InvitationConnection `json:"invitations"` Invitations *InvitationConnection `json:"invitations,omitempty"`
SamlConfigurations *SAMLConfigurationConnection `json:"samlConfigurations"` SamlConfigurations *SAMLConfigurationConnection `json:"samlConfigurations,omitempty"`
AvailableApplications []*Application `json:"availableApplications"` AvailableApplications []*Application `json:"availableApplications"`
} }

View File

@@ -114,21 +114,21 @@ func (r *invitationResolver) Organization(ctx context.Context, obj *types.Invita
} }
// TotalCount is the resolver for the totalCount field. // TotalCount is the resolver for the totalCount field.
func (r *invitationConnectionResolver) TotalCount(ctx context.Context, obj *types.InvitationConnection) (int, error) { func (r *invitationConnectionResolver) TotalCount(ctx context.Context, obj *types.InvitationConnection) (*int, error) {
switch obj.Resolver.(type) { switch obj.Resolver.(type) {
case *organizationResolver: case *organizationResolver:
count, err := r.iam.OrganizationService.CountInvitations(ctx, obj.ParentID, obj.Filters) count, err := r.iam.OrganizationService.CountInvitations(ctx, obj.ParentID, obj.Filters)
if err != nil { if err != nil {
panic(fmt.Errorf("cannot count invitations: %w", err)) panic(fmt.Errorf("cannot count invitations: %w", err))
} }
return count, nil return &count, nil
case *identityResolver: case *identityResolver:
count, err := r.iam.AccountService.CountPendingInvitations(ctx, obj.ParentID) count, err := r.iam.AccountService.CountPendingInvitations(ctx, obj.ParentID)
if err != nil { if err != nil {
panic(fmt.Errorf("cannot count invitations: %w", err)) panic(fmt.Errorf("cannot count invitations: %w", err))
} }
return count, nil return &count, nil
} }
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
@@ -164,11 +164,10 @@ func (r *membershipResolver) LastSession(ctx context.Context, obj *types.Members
} }
return types.NewSession(childSession), nil return types.NewSession(childSession), nil
} }
// TotalCount is the resolver for the totalCount field. // TotalCount is the resolver for the totalCount field.
func (r *membershipConnectionResolver) TotalCount(ctx context.Context, obj *types.MembershipConnection) (int, error) { func (r *membershipConnectionResolver) TotalCount(ctx context.Context, obj *types.MembershipConnection) (*int, error) {
switch obj.Resolver.(type) { switch obj.Resolver.(type) {
case *identityResolver: case *identityResolver:
count, err := r.iam.AccountService.CountMemberships(ctx, obj.ParentID) count, err := r.iam.AccountService.CountMemberships(ctx, obj.ParentID)
@@ -176,7 +175,7 @@ func (r *membershipConnectionResolver) TotalCount(ctx context.Context, obj *type
panic(fmt.Errorf("cannot count memberships: %w", err)) panic(fmt.Errorf("cannot count memberships: %w", err))
} }
return count, nil return &count, nil
} }
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
@@ -871,7 +870,7 @@ func (r *organizationResolver) SamlConfigurations(ctx context.Context, obj *type
} }
// TotalCount is the resolver for the totalCount field. // TotalCount is the resolver for the totalCount field.
func (r *personalAPIKeyConnectionResolver) TotalCount(ctx context.Context, obj *types.PersonalAPIKeyConnection) (int, error) { func (r *personalAPIKeyConnectionResolver) TotalCount(ctx context.Context, obj *types.PersonalAPIKeyConnection) (*int, error) {
switch obj.Resolver.(type) { switch obj.Resolver.(type) {
case *identityResolver: case *identityResolver:
count, err := r.iam.AccountService.CountPersonalAPIKeys(ctx, obj.ParentID) count, err := r.iam.AccountService.CountPersonalAPIKeys(ctx, obj.ParentID)
@@ -879,7 +878,7 @@ func (r *personalAPIKeyConnectionResolver) TotalCount(ctx context.Context, obj *
panic(fmt.Errorf("cannot count personal api keys: %w", err)) panic(fmt.Errorf("cannot count personal api keys: %w", err))
} }
return count, nil return &count, nil
} }
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
@@ -1010,21 +1009,21 @@ func (r *queryResolver) CheckSSOAvailability(ctx context.Context, email string)
} }
// TotalCount is the resolver for the totalCount field. // TotalCount is the resolver for the totalCount field.
func (r *sAMLConfigurationConnectionResolver) TotalCount(ctx context.Context, obj *types.SAMLConfigurationConnection) (int, error) { func (r *sAMLConfigurationConnectionResolver) TotalCount(ctx context.Context, obj *types.SAMLConfigurationConnection) (*int, error) {
switch obj.Resolver.(type) { switch obj.Resolver.(type) {
case *organizationResolver: case *organizationResolver:
count, err := r.iam.OrganizationService.CountSAMLConfigurations(ctx, obj.ParentID) count, err := r.iam.OrganizationService.CountSAMLConfigurations(ctx, obj.ParentID)
if err != nil { if err != nil {
panic(fmt.Errorf("cannot count saml configurations: %w", err)) panic(fmt.Errorf("cannot count saml configurations: %w", err))
} }
return count, nil return &count, nil
} }
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
} }
// TotalCount is the resolver for the totalCount field. // TotalCount is the resolver for the totalCount field.
func (r *sessionConnectionResolver) TotalCount(ctx context.Context, obj *types.SessionConnection) (int, error) { func (r *sessionConnectionResolver) TotalCount(ctx context.Context, obj *types.SessionConnection) (*int, error) {
switch obj.Resolver.(type) { switch obj.Resolver.(type) {
case *identityResolver: case *identityResolver:
count, err := r.iam.AccountService.CountSessions(ctx, obj.ParentID) count, err := r.iam.AccountService.CountSessions(ctx, obj.ParentID)
@@ -1032,7 +1031,7 @@ func (r *sessionConnectionResolver) TotalCount(ctx context.Context, obj *types.S
panic(fmt.Errorf("cannot count sessions: %w", err)) panic(fmt.Errorf("cannot count sessions: %w", err))
} }
return count, nil return &count, nil
} }
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))