ede566eed9
* prep for new resources algo * typescriptifying stuff * minor types fix * migrate to resources col * repo & creation updated, WIP processing/retrieval * WIP invite processing * finished finalization refactor * project invite management * transformed all invites services * fixed up projects & core serverinvites resolvers * test fixes * WIP workspace create GQL & test * basic invite creation test works * a buncha working tests * more tests * cancelation tests * minor invite use refactor * invite retrieval tasks * invite use() works as expected * filtering out broken invites * enabled invite retrieval by token irregardless of who is it for * minor adjustments * tests fix * test config improvements * test env adjustment * extra test case * making resource access limits harder to ignore * linter fixes * eventBus type cleanup * better generic names * refactored serverinvites resource migration * fix(server): better error message in project invite edge case
114 lines
2.3 KiB
TypeScript
114 lines
2.3 KiB
TypeScript
import { gql } from 'apollo-server-express'
|
|
|
|
export const createServerInviteMutation = gql`
|
|
mutation CreateServerInvite($input: ServerInviteCreateInput!) {
|
|
serverInviteCreate(input: $input)
|
|
}
|
|
`
|
|
|
|
export const createStreamInviteMutation = gql`
|
|
mutation CreateStreamInvite($input: StreamInviteCreateInput!) {
|
|
streamInviteCreate(input: $input)
|
|
}
|
|
`
|
|
|
|
export const resendInviteMutation = gql`
|
|
mutation ResendInvite($inviteId: String!) {
|
|
inviteResend(inviteId: $inviteId)
|
|
}
|
|
`
|
|
|
|
export const batchCreateServerInviteMutation = gql`
|
|
mutation BatchCreateServerInvite($input: [ServerInviteCreateInput!]!) {
|
|
serverInviteBatchCreate(input: $input)
|
|
}
|
|
`
|
|
|
|
export const batchCreateStreamInviteMutation = gql`
|
|
mutation BatchCreateStreamInvite($input: [StreamInviteCreateInput!]!) {
|
|
streamInviteBatchCreate(input: $input)
|
|
}
|
|
`
|
|
|
|
export const deleteInviteMutation = gql`
|
|
mutation DeleteInvite($inviteId: String!) {
|
|
inviteDelete(inviteId: $inviteId)
|
|
}
|
|
`
|
|
|
|
export const streamInviteFragment = gql`
|
|
fragment StreamInviteData on PendingStreamCollaborator {
|
|
id
|
|
inviteId
|
|
streamId
|
|
title
|
|
role
|
|
token
|
|
invitedBy {
|
|
id
|
|
name
|
|
bio
|
|
company
|
|
avatar
|
|
verified
|
|
}
|
|
user {
|
|
id
|
|
name
|
|
bio
|
|
company
|
|
avatar
|
|
verified
|
|
}
|
|
}
|
|
`
|
|
|
|
export const streamInviteQuery = gql`
|
|
query GetStreamInvite($streamId: String!, $token: String) {
|
|
streamInvite(streamId: $streamId, token: $token) {
|
|
...StreamInviteData
|
|
}
|
|
}
|
|
|
|
${streamInviteFragment}
|
|
`
|
|
|
|
export const streamInvitesQuery = gql`
|
|
query GetStreamInvites {
|
|
streamInvites {
|
|
...StreamInviteData
|
|
}
|
|
}
|
|
|
|
${streamInviteFragment}
|
|
`
|
|
|
|
export const useStreamInviteMutation = gql`
|
|
mutation UseStreamInvite($accept: Boolean!, $streamId: String!, $token: String!) {
|
|
streamInviteUse(accept: $accept, streamId: $streamId, token: $token)
|
|
}
|
|
`
|
|
|
|
export const cancelStreamInviteMutation = gql`
|
|
mutation CancelStreamInvite($streamId: String!, $inviteId: String!) {
|
|
streamInviteCancel(streamId: $streamId, inviteId: $inviteId)
|
|
}
|
|
`
|
|
|
|
export const streamPendingCollaboratorsQuery = gql`
|
|
query GetStreamPendingCollaborators($streamId: String!) {
|
|
stream(id: $streamId) {
|
|
id
|
|
pendingCollaborators {
|
|
inviteId
|
|
title
|
|
token
|
|
user {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|