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 {
signIn(input: SignInInput!): SignInPayload! @session(required: OPTIONAL)
signUp(input: SignUpInput!): SignUpPayload! @session(required: NONE)
signOut: SignOutPayload! @session(required: PRESENT)
signIn(input: SignInInput!): SignInPayload @session(required: OPTIONAL)
signUp(input: SignUpInput!): SignUpPayload @session(required: NONE)
signOut: SignOutPayload @session(required: PRESENT)
signUpFromInvitation(
input: SignUpFromInvitationInput!
): SignUpFromInvitationPayload! @session(required: NONE)
forgotPassword(input: ForgotPasswordInput!): ForgotPasswordPayload!
): SignUpFromInvitationPayload @session(required: NONE)
forgotPassword(input: ForgotPasswordInput!): ForgotPasswordPayload
@session(required: NONE)
resetPassword(input: ResetPasswordInput!): ResetPasswordPayload!
resetPassword(input: ResetPasswordInput!): ResetPasswordPayload
@session(required: NONE)
verifyEmail(input: VerifyEmailInput!): VerifyEmailPayload!
verifyEmail(input: VerifyEmailInput!): VerifyEmailPayload
@session(required: OPTIONAL)
changePassword(input: ChangePasswordInput!): ChangePasswordPayload!
changePassword(input: ChangePasswordInput!): ChangePasswordPayload
@session(required: PRESENT)
changeEmail(input: ChangeEmailInput!): ChangeEmailPayload!
changeEmail(input: ChangeEmailInput!): ChangeEmailPayload
@session(required: PRESENT)
assumeOrganizationSession(
input: AssumeOrganizationSessionInput!
): AssumeOrganizationSessionPayload! @session(required: PRESENT)
): AssumeOrganizationSessionPayload @session(required: PRESENT)
updateIdentityProfile(
input: UpdateIdentityProfileInput!
): UpdateIdentityProfilePayload! @session(required: PRESENT)
): UpdateIdentityProfilePayload @session(required: PRESENT)
revokeSession(input: RevokeSessionInput!): RevokeSessionPayload!
@session(required: PRESENT)
revokeAllSessions: RevokeAllSessionsPayload! @session(required: PRESENT)
revokeAllSessions: RevokeAllSessionsPayload @session(required: PRESENT)
createPersonalAPIKey(
input: CreatePersonalAPIKeyInput!
): CreatePersonalAPIKeyPayload! @session(required: PRESENT)
): CreatePersonalAPIKeyPayload @session(required: PRESENT)
updatePersonalAPIKey(
input: UpdatePersonalAPIKeyInput!
): UpdatePersonalAPIKeyPayload! @session(required: PRESENT)
): UpdatePersonalAPIKeyPayload @session(required: PRESENT)
revokePersonalAPIKey(
input: RevokePersonalAPIKeyInput!
): RevokePersonalAPIKeyPayload! @session(required: PRESENT)
): RevokePersonalAPIKeyPayload @session(required: PRESENT)
createOrganization(
input: CreateOrganizationInput!
): CreateOrganizationPayload! @session(required: PRESENT)
): CreateOrganizationPayload @session(required: PRESENT)
updateOrganization(
input: UpdateOrganizationInput!
): UpdateOrganizationPayload! @session(required: PRESENT)
): UpdateOrganizationPayload @session(required: PRESENT)
deleteOrganization(
input: DeleteOrganizationInput!
): DeleteOrganizationPayload! @session(required: PRESENT)
): DeleteOrganizationPayload @session(required: PRESENT)
inviteMember(input: InviteMemberInput!): InviteMemberPayload!
inviteMember(input: InviteMemberInput!): InviteMemberPayload
@session(required: PRESENT)
deleteInvitation(input: DeleteInvitationInput!): DeleteInvitationPayload!
deleteInvitation(input: DeleteInvitationInput!): DeleteInvitationPayload
@session(required: PRESENT)
removeMember(input: RemoveMemberInput!): RemoveMemberPayload!
removeMember(input: RemoveMemberInput!): RemoveMemberPayload
@session(required: PRESENT)
acceptInvitation(input: AcceptInvitationInput!): AcceptInvitationPayload!
acceptInvitation(input: AcceptInvitationInput!): AcceptInvitationPayload
@session(required: PRESENT)
createSAMLConfiguration(
input: CreateSAMLConfigurationInput!
): CreateSAMLConfigurationPayload! @session(required: PRESENT)
): CreateSAMLConfigurationPayload @session(required: PRESENT)
updateSAMLConfiguration(
input: UpdateSAMLConfigurationInput!
): UpdateSAMLConfigurationPayload! @session(required: PRESENT)
): UpdateSAMLConfigurationPayload @session(required: PRESENT)
deleteSAMLConfiguration(
input: DeleteSAMLConfigurationInput!
): DeleteSAMLConfigurationPayload! @session(required: PRESENT)
): DeleteSAMLConfigurationPayload @session(required: PRESENT)
}
type Identity implements Node {
@@ -141,7 +141,7 @@ type Identity implements Node {
last: Int
before: CursorKey
orderBy: MembershipOrder
): MembershipConnection! @goField(forceResolver: true) @isViewer
): MembershipConnection @goField(forceResolver: true) @isViewer
pendingInvitations(
first: Int
@@ -149,7 +149,7 @@ type Identity implements Node {
last: Int
before: CursorKey
orderBy: InvitationOrder
): InvitationConnection! @goField(forceResolver: true) @isViewer
): InvitationConnection @goField(forceResolver: true) @isViewer
sessions(
first: Int
@@ -157,14 +157,14 @@ type Identity implements Node {
last: Int
before: CursorKey
orderBy: SessionOrder
): SessionConnection! @goField(forceResolver: true) @isViewer
): SessionConnection @goField(forceResolver: true) @isViewer
personalAPIKeys(
first: Int
after: CursorKey
last: Int
before: CursorKey
): PersonalAPIKeyConnection! @goField(forceResolver: true) @isViewer
): PersonalAPIKeyConnection @goField(forceResolver: true) @isViewer
profileFor(organizationId: ID!): IdentityProfile @isViewer
}
@@ -208,7 +208,7 @@ type Organization implements Node {
after: CursorKey
last: Int
before: CursorKey
): MembershipConnection! @goField(forceResolver: true)
): MembershipConnection @goField(forceResolver: true)
invitations(
first: Int
@@ -216,14 +216,14 @@ type Organization implements Node {
last: Int
before: CursorKey
status: InvitationStatus
): InvitationConnection! @goField(forceResolver: true)
): InvitationConnection @goField(forceResolver: true)
samlConfigurations(
first: Int
after: CursorKey
last: Int
before: CursorKey
): SAMLConfigurationConnection! @goField(forceResolver: true)
): SAMLConfigurationConnection @goField(forceResolver: true)
availableApplications: [Application!]!
}
@@ -244,8 +244,8 @@ type Membership implements Node {
identityId: ID!
createdAt: Datetime!
profile: IdentityProfile!
identity: Identity! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
identity: Identity @goField(forceResolver: true)
organization: Organization @goField(forceResolver: true)
role: MembershipRole!
permissions: [Permission!]!
provisionedBy: ProvisioningSource!
@@ -263,7 +263,7 @@ type Invitation implements Node {
acceptedAt: Datetime
createdAt: Datetime!
status: InvitationStatus!
organization: Organization! @goField(forceResolver: true)
organization: Organization @goField(forceResolver: true)
}
type Session implements Node {
@@ -450,7 +450,7 @@ type MembershipConnection
) {
edges: [MembershipEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
totalCount: Int @goField(forceResolver: true)
}
type MembershipEdge {
@@ -492,7 +492,7 @@ type InvitationConnection
) {
edges: [InvitationEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
totalCount: Int @goField(forceResolver: true)
}
type InvitationEdge {
@@ -506,7 +506,7 @@ type SessionConnection
) {
edges: [SessionEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
totalCount: Int @goField(forceResolver: true)
}
type SessionEdge {
@@ -520,7 +520,7 @@ type PersonalAPIKeyConnection
) {
edges: [PersonalAPIKeyEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
totalCount: Int @goField(forceResolver: true)
}
type PersonalAPIKeyEdge {
@@ -534,7 +534,7 @@ type SAMLConfigurationConnection
) {
edges: [SAMLConfigurationEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
totalCount: Int @goField(forceResolver: true)
}
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"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Memberships *MembershipConnection `json:"memberships"`
PendingInvitations *InvitationConnection `json:"pendingInvitations"`
Sessions *SessionConnection `json:"sessions"`
PersonalAPIKeys *PersonalAPIKeyConnection `json:"personalAPIKeys"`
Memberships *MembershipConnection `json:"memberships,omitempty"`
PendingInvitations *InvitationConnection `json:"pendingInvitations,omitempty"`
Sessions *SessionConnection `json:"sessions,omitempty"`
PersonalAPIKeys *PersonalAPIKeyConnection `json:"personalAPIKeys,omitempty"`
ProfileFor *IdentityProfile `json:"profileFor,omitempty"`
}
@@ -212,7 +212,7 @@ type Invitation struct {
AcceptedAt *time.Time `json:"acceptedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
Status coredata.InvitationStatus `json:"status"`
Organization *Organization `json:"organization"`
Organization *Organization `json:"organization,omitempty"`
}
func (Invitation) IsNode() {}
@@ -238,8 +238,8 @@ type Membership struct {
IdentityID gid.GID `json:"identityId"`
CreatedAt time.Time `json:"createdAt"`
Profile *IdentityProfile `json:"profile"`
Identity *Identity `json:"identity"`
Organization *Organization `json:"organization"`
Identity *Identity `json:"identity,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Role coredata.MembershipRole `json:"role"`
Permissions []*Permission `json:"permissions"`
ProvisionedBy ProvisioningSource `json:"provisionedBy"`
@@ -266,9 +266,9 @@ type Organization struct {
HorizontalLogoURL *string `json:"horizontalLogoUrl,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Members *MembershipConnection `json:"members"`
Invitations *InvitationConnection `json:"invitations"`
SamlConfigurations *SAMLConfigurationConnection `json:"samlConfigurations"`
Members *MembershipConnection `json:"members,omitempty"`
Invitations *InvitationConnection `json:"invitations,omitempty"`
SamlConfigurations *SAMLConfigurationConnection `json:"samlConfigurations,omitempty"`
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.
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) {
case *organizationResolver:
count, err := r.iam.OrganizationService.CountInvitations(ctx, obj.ParentID, obj.Filters)
if err != nil {
panic(fmt.Errorf("cannot count invitations: %w", err))
}
return count, nil
return &count, nil
case *identityResolver:
count, err := r.iam.AccountService.CountPendingInvitations(ctx, obj.ParentID)
if err != nil {
panic(fmt.Errorf("cannot count invitations: %w", err))
}
return count, nil
return &count, nil
}
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
}
// 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) {
case *identityResolver:
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))
}
return count, nil
return &count, nil
}
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.
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) {
case *identityResolver:
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))
}
return count, nil
return &count, nil
}
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.
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) {
case *organizationResolver:
count, err := r.iam.OrganizationService.CountSAMLConfigurations(ctx, obj.ParentID)
if err != nil {
panic(fmt.Errorf("cannot count saml configurations: %w", err))
}
return count, nil
return &count, nil
}
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
}
// 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) {
case *identityResolver:
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))
}
return count, nil
return &count, nil
}
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))