skillbox/server/books/tests/queries.py

168 lines
2.7 KiB
Python

MODULE_QUERY = """
query ModulesQuery($slug: String, $id: ID) {
module(slug: $slug, id: $id) {
id
title
objectiveGroups {
objectives {
id
text
hiddenFor {
name
}
visibleFor {
name
}
}
}
chapters {
id
titleHiddenFor { name }
descriptionHiddenFor { name }
contentBlocks {
id
title
originalCreator {
id
fullName
avatarUrl
}
visibleFor {
name
}
hiddenFor {
name
}
}
}
}
}
"""
CREATE_SNAPSHOT_MUTATION = """
mutation CreateSnapshot($input: CreateSnapshotInput!) {
createSnapshot(input: $input) {
snapshot {
id
created
creator
objectiveGroups {
objectives {
text
hidden
}
}
chapters {
id
descriptionHidden
titleHidden
title
description
contentBlocks {
id
title
hidden
}
}
}
success
}
}
"""
APPLY_SNAPSHOT_MUTATION = """
mutation ApplySnapshot($input: ApplySnapshotInput!) {
applySnapshot(input: $input) {
success
}
}
"""
SNAPSHOT_MODULE_QUERY = """
query SnapshotDetail($id: ID!) {
snapshot(id: $id) {
id
changes {
newContentBlocks
newObjectives
hiddenContentBlocks
hiddenObjectives
}
objectiveGroups {
title
id
hidden
objectives {
hidden
id
text
}
}
chapters {
id
description
title
titleHidden
descriptionHidden
contentBlocks {
id
title
hidden
}
}
}
}
"""
MODULE_SNAPSHOTS_QUERY = """
query SnapshotQuery($slug: String!) {
module(slug: $slug) {
snapshots {
id
title
created
creator
}
}
}
"""
SHARE_SNAPSHOT_MUTATION = """
mutation ShareSnapshot($input: ShareSnapshotInput!) {
shareSnapshot(input: $input) {
success
snapshot {
shared
}
}
}
"""
UPDATE_SNAPSHOT_MUTATION = """
mutation UpdateSnapshot($input: UpdateSnapshotInput!) {
updateSnapshot(input: $input) {
snapshot {
...on SnapshotNode {
title
id
}
...on NotOwner {
reason
}
}
}
}
"""
DELETE_SNAPSHOT_MUTATION = """
mutation DeleteSnapshot($id: ID!) {
deleteSnapshot(id: $id) {
result {
success
...on NotOwner {
reason
}
}
}
}
"""