feat(core): add project field on invites (#4588)
* feat(core): add project field on invites * chore(workspaces): add workspaceSlug on invite
This commit is contained in:
committed by
GitHub
parent
d4e326e89e
commit
437ee6d20b
@@ -1955,7 +1955,10 @@ export type PendingStreamCollaborator = {
|
||||
id: Scalars['String']['output'];
|
||||
inviteId: Scalars['String']['output'];
|
||||
invitedBy: LimitedUser;
|
||||
project: Project;
|
||||
/** @deprecated Use project instead */
|
||||
projectId: Scalars['String']['output'];
|
||||
/** @deprecated Use project instead */
|
||||
projectName: Scalars['String']['output'];
|
||||
role: Scalars['String']['output'];
|
||||
/** @deprecated Use projectId instead */
|
||||
@@ -8266,6 +8269,7 @@ export type PendingStreamCollaboratorFieldArgs = {
|
||||
id: {},
|
||||
inviteId: {},
|
||||
invitedBy: {},
|
||||
project: {},
|
||||
projectId: {},
|
||||
projectName: {},
|
||||
role: {},
|
||||
|
||||
@@ -16,3 +16,7 @@ extend type ProjectCollaborator {
|
||||
"""
|
||||
workspaceRole: String
|
||||
}
|
||||
|
||||
extend type PendingStreamCollaborator {
|
||||
workspaceSlug: String
|
||||
}
|
||||
|
||||
@@ -1991,6 +1991,7 @@ export type PendingStreamCollaborator = {
|
||||
token?: Maybe<Scalars['String']['output']>;
|
||||
/** Set only if user is registered */
|
||||
user?: Maybe<LimitedUser>;
|
||||
workspaceSlug?: Maybe<Scalars['String']['output']>;
|
||||
};
|
||||
|
||||
export type PendingWorkspaceCollaborator = {
|
||||
@@ -6609,6 +6610,7 @@ export type PendingStreamCollaboratorResolvers<ContextType = GraphQLContext, Par
|
||||
title?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
token?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
user?: Resolver<Maybe<ResolversTypes['LimitedUser']>, ParentType, ContextType>;
|
||||
workspaceSlug?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1971,6 +1971,7 @@ export type PendingStreamCollaborator = {
|
||||
token?: Maybe<Scalars['String']['output']>;
|
||||
/** Set only if user is registered */
|
||||
user?: Maybe<LimitedUser>;
|
||||
workspaceSlug?: Maybe<Scalars['String']['output']>;
|
||||
};
|
||||
|
||||
export type PendingWorkspaceCollaborator = {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { db } from '@/db/knex'
|
||||
import { StreamNotFoundError } from '@/modules/core/errors/stream'
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
import { getPaginatedItemsFactory } from '@/modules/shared/services/paginatedItems'
|
||||
import { WorkspaceTeamMember } from '@/modules/workspaces/domain/types'
|
||||
import { WorkspaceNotFoundError } from '@/modules/workspaces/errors/workspace'
|
||||
import { intersectProjectCollaboratorsAndWorkspaceCollaboratorsFactory } from '@/modules/workspaces/repositories/projects'
|
||||
import {
|
||||
countInvitableCollaboratorsByProjectIdFactory,
|
||||
@@ -68,6 +70,28 @@ export default FF_WORKSPACES_MODULE_ENABLED
|
||||
addedToWorkspaceTotalCount: async (parent) => {
|
||||
return parent.length
|
||||
}
|
||||
},
|
||||
PendingStreamCollaborator: {
|
||||
workspaceSlug: async (parent, _args, ctx) => {
|
||||
const project = await ctx.loaders.streams.getStream.load(parent.streamId)
|
||||
if (!project) {
|
||||
throw new StreamNotFoundError(null, {
|
||||
info: { projectId: parent.streamId }
|
||||
})
|
||||
}
|
||||
if (!project.workspaceId) {
|
||||
return null
|
||||
}
|
||||
const workspace = await ctx.loaders.workspaces?.getWorkspace.load(
|
||||
project.workspaceId
|
||||
)
|
||||
if (!workspace) {
|
||||
throw new WorkspaceNotFoundError(null, {
|
||||
info: { workspaceId: project.workspaceId }
|
||||
})
|
||||
}
|
||||
return workspace.slug
|
||||
}
|
||||
}
|
||||
} as Resolvers)
|
||||
: {}
|
||||
|
||||
@@ -1972,6 +1972,7 @@ export type PendingStreamCollaborator = {
|
||||
token?: Maybe<Scalars['String']['output']>;
|
||||
/** Set only if user is registered */
|
||||
user?: Maybe<LimitedUser>;
|
||||
workspaceSlug?: Maybe<Scalars['String']['output']>;
|
||||
};
|
||||
|
||||
export type PendingWorkspaceCollaborator = {
|
||||
|
||||
Reference in New Issue
Block a user