Files
speckle-server/packages/server/modules/viewer/tests/helpers/graphql.ts
T
Kristaps Fabians Geikins a6287fc06d feat(fe2 & server): saved views foundation (list & view) + bits n bobs (#5163)
* init db migration

* WIP store view

* create service call

* WIP insertion

* insert sort of works

* moving code arounmd

* creation tests

* avoid duplicate entries

* fixes from main

* basic group retrieval works

* group filtering works

* WIP view listing

* filter by acl

* fixes + WIP single group retrieval

* wip pivot

* more pivot query fixes

* tests fixed after pivot

* views list tests

* fixing test command

* business plan only checks

* more tests for coverage

* .dts import fix

* cli fix

* anutha one

* auth policy tests for business plan access

* WIP saved views panel base

* BE listing adjustments

* WIP group rendering

* group render done

* WIP post create cache updates

* listing fine?

* my vs theirs

* auto open

* minor fixes

* click load omg

* nicely loading views

* type fix

* less spammy loading

* another type fix:

* more lint fix

* test fix

* codecov disable

* moar coverage

* fix sidebar flashin

* more test coverage

* more test cvoverage

* minor adfjustments

* adj

* saved view wipe fixes

* CSR viewer

* more improvements

* extra feature flag checks

* lint fix

* feature flags fix

* more test fixes
2025-08-05 11:52:50 +03:00

136 lines
2.6 KiB
TypeScript

import gql from 'graphql-tag'
const basicSavedViewFragment = gql`
fragment BasicSavedView on SavedView {
id
name
description
author {
id
}
groupId
group {
id
title
isUngroupedViewsGroup
}
createdAt
updatedAt
resourceIdString
resourceIds
isHomeView
visibility
viewerState
screenshot
position
projectId
}
`
const basicSavedViewGroupFragment = gql`
fragment BasicSavedViewGroup on SavedViewGroup {
id
projectId
resourceIds
title
isUngroupedViewsGroup
views(input: $viewsInput) {
totalCount
cursor
items {
...BasicSavedView
}
}
}
`
export const createSavedViewMutation = gql`
mutation CreateSavedView($input: CreateSavedViewInput!) {
projectMutations {
savedViewMutations {
createView(input: $input) {
...BasicSavedView
}
}
}
}
${basicSavedViewFragment}
`
export const createSavedGroupMutation = gql`
mutation CreateSavedViewGroup(
$input: CreateSavedViewGroupInput!
$viewsInput: SavedViewGroupViewsInput! = { limit: 10 }
) {
projectMutations {
savedViewMutations {
createGroup(input: $input) {
...BasicSavedViewGroup
}
}
}
}
`
export const getProjectSavedViewGroupsQuery = gql`
query GetProjectSavedViewGroups(
$projectId: String!
$input: SavedViewGroupsInput!
$viewsInput: SavedViewGroupViewsInput! = { limit: 10 }
) {
project(id: $projectId) {
savedViewGroups(input: $input) {
totalCount
cursor
items {
...BasicSavedViewGroup
}
}
}
}
${basicSavedViewGroupFragment}
`
export const getProjectSavedViewGroupQuery = gql`
query GetProjectSavedViewGroup(
$projectId: String!
$groupId: ID!
$viewsInput: SavedViewGroupViewsInput! = { limit: 10 }
) {
project(id: $projectId) {
savedViewGroup(id: $groupId) {
...BasicSavedViewGroup
}
}
}
${basicSavedViewGroupFragment}
`
export const getProjectUngroupedViewGroupQuery = gql`
query GetProjectUngroupedViewGroup(
$projectId: String!
$input: GetUngroupedViewGroupInput!
$viewsInput: SavedViewGroupViewsInput! = { limit: 10 }
) {
project(id: $projectId) {
ungroupedViewGroup(input: $input) {
...BasicSavedViewGroup
}
}
}
`
export const getProjectSavedViewQuery = gql`
query GetProjectSavedView($projectId: String!, $viewId: ID!) {
project(id: $projectId) {
savedView(id: $viewId) {
...BasicSavedView
}
}
}
${basicSavedViewFragment}
`