bbd5146e5a
* fix(workspaces): a suggestion of paginated teams * fix(workspaces): workspace team pagination (?) * fix(workspaces): pagination based on acl createdAt * fix(workspaces): fix some roles-related tests * fix(workspaces): improve query and tests * fix(workspaces): collaborators query without incorrect groupBy * fix(workspaces): add default values to migration * Fixed queries and fragments * Merged main * Remove comment * chore(workspaces): update WorkspaceCollaboratorCollection mocks * chore(workspaces): fix role test * chore(workspaces); ope * fix(workspaces): move workspace acl timestamps to separate table * Merge? * fix(workspaces) drop that table * fix(workspaces): cursor * fix(workspaceInvites): undo merge borkage * fix(workspaces): rework workspace member pagination * fix(workspaces): fix test * fix(workspaces): test test * fix(workspaces): literally garbage --------- Co-authored-by: Mike Tasset <mike.tasset@gmail.com> Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
196 lines
3.6 KiB
TypeScript
196 lines
3.6 KiB
TypeScript
import { gql } from 'apollo-server-express'
|
|
|
|
export const workspaceFragment = gql`
|
|
fragment TestWorkspace on Workspace {
|
|
id
|
|
name
|
|
description
|
|
createdAt
|
|
updatedAt
|
|
logo
|
|
}
|
|
`
|
|
|
|
export const workspaceCollaboratorFragment = gql`
|
|
fragment TestWorkspaceCollaborator on WorkspaceCollaborator {
|
|
id
|
|
role
|
|
user {
|
|
name
|
|
}
|
|
}
|
|
`
|
|
|
|
export const workspaceProjectFragment = gql`
|
|
fragment TestWorkspaceProject on Project {
|
|
id
|
|
name
|
|
createdAt
|
|
updatedAt
|
|
team {
|
|
id
|
|
role
|
|
}
|
|
}
|
|
`
|
|
|
|
export const createWorkspaceQuery = gql`
|
|
mutation CreateWorkspace($input: WorkspaceCreateInput!) {
|
|
workspaceMutations {
|
|
create(input: $input) {
|
|
...TestWorkspace
|
|
}
|
|
}
|
|
}
|
|
${workspaceFragment}
|
|
`
|
|
|
|
export const deleteWorkspaceQuery = gql`
|
|
mutation DeleteWorkspace($workspaceId: String!) {
|
|
workspaceMutations {
|
|
delete(workspaceId: $workspaceId)
|
|
}
|
|
}
|
|
`
|
|
|
|
export const getWorkspaceQuery = gql`
|
|
query GetWorkspace($workspaceId: String!) {
|
|
workspace(id: $workspaceId) {
|
|
...TestWorkspace
|
|
team {
|
|
items {
|
|
...TestWorkspaceCollaborator
|
|
}
|
|
}
|
|
}
|
|
}
|
|
${workspaceFragment}
|
|
${workspaceCollaboratorFragment}
|
|
`
|
|
|
|
export const getActiveUserDiscoverableWorkspacesQuery = gql`
|
|
query getActiveUserDiscoverableWorkspaces {
|
|
activeUser {
|
|
discoverableWorkspaces {
|
|
id
|
|
name
|
|
description
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const updateWorkspaceQuery = gql`
|
|
mutation UpdateWorkspace($input: WorkspaceUpdateInput!) {
|
|
workspaceMutations {
|
|
update(input: $input) {
|
|
...TestWorkspace
|
|
}
|
|
}
|
|
}
|
|
${workspaceFragment}
|
|
`
|
|
|
|
export const getActiveUserWorkspacesQuery = gql`
|
|
query GetActiveUserWorkspaces {
|
|
activeUser {
|
|
workspaces {
|
|
items {
|
|
...TestWorkspace
|
|
}
|
|
}
|
|
}
|
|
}
|
|
${workspaceFragment}
|
|
`
|
|
|
|
export const updateWorkspaceRoleQuery = gql`
|
|
mutation UpdateWorkspaceRole($input: WorkspaceRoleUpdateInput!) {
|
|
workspaceMutations {
|
|
updateRole(input: $input) {
|
|
team {
|
|
items {
|
|
...TestWorkspaceCollaborator
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
${workspaceCollaboratorFragment}
|
|
`
|
|
|
|
export const createWorkspaceProjectQuery = gql`
|
|
mutation CreateWorkspaceProject($input: ProjectCreateInput!) {
|
|
projectMutations {
|
|
create(input: $input) {
|
|
...TestWorkspaceProject
|
|
}
|
|
}
|
|
}
|
|
${workspaceProjectFragment}
|
|
`
|
|
|
|
export const getWorkspaceProjectsQuery = gql`
|
|
query GetWorkspaceProjects(
|
|
$id: String!
|
|
$limit: Int
|
|
$cursor: String
|
|
$filter: WorkspaceProjectsFilter
|
|
) {
|
|
workspace(id: $id) {
|
|
projects(limit: $limit, cursor: $cursor, filter: $filter) {
|
|
items {
|
|
...TestWorkspaceProject
|
|
}
|
|
cursor
|
|
totalCount
|
|
}
|
|
}
|
|
}
|
|
${workspaceProjectFragment}
|
|
`
|
|
|
|
export const getWorkspaceTeamQuery = gql`
|
|
query GetWorkspaceTeam(
|
|
$workspaceId: String!
|
|
$filter: WorkspaceTeamFilter
|
|
$limit: Int
|
|
$cursor: String
|
|
) {
|
|
workspace(id: $workspaceId) {
|
|
team(filter: $filter, limit: $limit, cursor: $cursor) {
|
|
items {
|
|
...TestWorkspaceCollaborator
|
|
}
|
|
cursor
|
|
totalCount
|
|
}
|
|
}
|
|
}
|
|
${workspaceCollaboratorFragment}
|
|
`
|
|
|
|
export const leaveWorkspaceMutation = gql`
|
|
mutation ActiveUserLeaveWorkspace($id: ID!) {
|
|
workspaceMutations {
|
|
leave(id: $id)
|
|
}
|
|
}
|
|
`
|
|
|
|
export const getProjectWorkspaceQuery = gql`
|
|
query ActiveUserProjectsWorkspace {
|
|
activeUser {
|
|
projects {
|
|
items {
|
|
id
|
|
workspace {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|