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
@@ -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)
|
||||
: {}
|
||||
|
||||
Reference in New Issue
Block a user