f210d9b749
* feat(projects): add project regions, default to null * feat(multiregion): add projectRegion Db client lookup logic * feat(multiregion): add project region repositories and caching * feat(multiRegion): db initialization and get project db client * feat(docker-compose): add second db for regions testing * feat(multiRegion): initialize region with pubs and subs working * fix(multiRegion): get region client even if it was registered in another pod * feat(workspaces): create workspace resolver split * feat: update server region metadata * feat(projects): rewrite project creation * feat(multiRegion): getRegionDb * fix(workspaces): get projects now can retur null * feat(multiRegion): make local multi region DB-s work * feat: set d efault workspace region * CR changes * tests * feat(multiRegion): bind region properly * fe update * test fixes * feat(multiRegion): automatically create aiven extras plugin * ci(postgres): use published postgres with aiven extras * fix(multiRegion): roll back the aiven extras migration, there is a better way * tests fix * fix(billing): we do not need to add a seat, if the workspace is on a plan, but has no sub --------- Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
266 lines
4.8 KiB
TypeScript
266 lines
4.8 KiB
TypeScript
import gql from 'graphql-tag'
|
|
|
|
export const workspaceFragment = gql`
|
|
fragment TestWorkspace on Workspace {
|
|
id
|
|
name
|
|
slug
|
|
description
|
|
createdAt
|
|
updatedAt
|
|
logo
|
|
}
|
|
`
|
|
|
|
export const workspaceCollaboratorFragment = gql`
|
|
fragment TestWorkspaceCollaborator on WorkspaceCollaborator {
|
|
id
|
|
role
|
|
user {
|
|
name
|
|
}
|
|
projectRoles {
|
|
role
|
|
project {
|
|
id
|
|
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 getWorkspaceBySlugQuery = gql`
|
|
query GetWorkspaceBySlug($workspaceSlug: String!) {
|
|
workspaceBySlug(slug: $workspaceSlug) {
|
|
...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: WorkspaceProjectCreateInput!) {
|
|
workspaceMutations {
|
|
projects {
|
|
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 getWorkspaceSsoQuery = gql`
|
|
query GetWorkspaceSso($id: String!) {
|
|
workspace(id: $id) {
|
|
sso {
|
|
provider {
|
|
id
|
|
name
|
|
}
|
|
session {
|
|
createdAt
|
|
validUntil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const getActiveUserExpiredSsoSessions = gql`
|
|
query ActiveUserExpiredSsoSessions {
|
|
activeUser {
|
|
expiredSsoSessions {
|
|
id
|
|
slug
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const moveProjectToWorkspaceMutation = gql`
|
|
mutation MoveProjectToWorkspace($projectId: String!, $workspaceId: String!) {
|
|
workspaceMutations {
|
|
projects {
|
|
moveToWorkspace(projectId: $projectId, workspaceId: $workspaceId) {
|
|
id
|
|
workspaceId
|
|
team {
|
|
id
|
|
role
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|