Update and add to GraphQL typing in client and on server
This commit is contained in:
parent
4daf2946d2
commit
1927036610
|
|
@ -1,3 +1,5 @@
|
|||
import { ContentBlockNode } from '@/__generated__/graphql';
|
||||
|
||||
export type numberOrUndefined = number | undefined;
|
||||
|
||||
type types = 'task' | 'normal' | 'base_communication' | 'base_society' | 'base_interdisciplinary' | 'instrument';
|
||||
|
|
@ -17,8 +19,8 @@ export interface InstrumentCategory {
|
|||
|
||||
export interface Hideable {
|
||||
userCreated: boolean;
|
||||
hiddenFor: any[];
|
||||
visibleFor: any[];
|
||||
// hiddenFor: any[];
|
||||
// visibleFor: any[];
|
||||
titleHiddenFor: any[];
|
||||
descriptionHiddenFor: any[];
|
||||
hidden: boolean;
|
||||
|
|
@ -30,12 +32,17 @@ export interface ContentBlock extends Hideable, Page {
|
|||
type: types;
|
||||
notes: any[];
|
||||
bookmarks: any[];
|
||||
indent?: boolean;
|
||||
instrumentCategory: InstrumentCategory;
|
||||
mine: boolean;
|
||||
root: string;
|
||||
}
|
||||
|
||||
export interface ExtendedContentBlockNode extends ContentBlockNode {
|
||||
indent?: boolean;
|
||||
notes: any[];
|
||||
root: string;
|
||||
}
|
||||
|
||||
export interface Chapter extends Hideable, Page {
|
||||
contentBlocks: ContentBlock[];
|
||||
bookmark: any;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -119,19 +119,17 @@ import DUPLICATE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/duplicateC
|
|||
import CHAPTER_QUERY from '@/graphql/gql/queries/chapterQuery.gql';
|
||||
import DELETE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/deleteContentBlock.gql';
|
||||
|
||||
import type { ContentBlock } from '@/@types';
|
||||
import type { ExtendedContentBlockNode } from '@/@types';
|
||||
import type { Modal } from '@/plugins/modal.types';
|
||||
import { PAGE_LOAD_TIMEOUT } from '@/consts/navigation.consts';
|
||||
|
||||
export interface Props {
|
||||
contentBlock: ContentBlock;
|
||||
contentBlock: ExtendedContentBlockNode;
|
||||
parent?: any;
|
||||
editMode?: boolean;
|
||||
}
|
||||
|
||||
const ContentComponent = defineAsyncComponent(
|
||||
() => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ContentComponent.vue')
|
||||
);
|
||||
const ContentComponent = defineAsyncComponent(() => import('@/components/content-blocks/ContentComponent.vue'));
|
||||
|
||||
const { me, schoolClass } = getMe();
|
||||
|
||||
|
|
@ -167,7 +165,9 @@ const { mutate: duplicateContentBlock } = useMutation(DUPLICATE_CONTENT_BLOCK_MU
|
|||
id,
|
||||
};
|
||||
const { chapter }: any = store.readQuery({ query, variables });
|
||||
const index = chapter.contentBlocks.findIndex((contentBlock: ContentBlock) => contentBlock.id === contentBlockId);
|
||||
const index = chapter.contentBlocks.findIndex(
|
||||
(contentBlock: ExtendedContentBlockNode) => contentBlock.id === contentBlockId
|
||||
);
|
||||
const contentBlocks = insertAtIndex(chapter.contentBlocks, index, contentBlock);
|
||||
const data = {
|
||||
chapter: {
|
||||
|
|
@ -201,7 +201,7 @@ const { mutate: doDeleteContentBlock } = useMutation(DELETE_CONTENT_BLOCK_MUTATI
|
|||
};
|
||||
const { chapter }: any = store.readQuery({ query, variables });
|
||||
const index = chapter.contentBlocks.findIndex(
|
||||
(contentBlock: ContentBlock) => contentBlock.id === props.contentBlock.id
|
||||
(contentBlock: ExtendedContentBlockNode) => contentBlock.id === props.contentBlock.id
|
||||
);
|
||||
if (index < 0) {
|
||||
throw Error('ContentBlock not found');
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ export const hidden: (options: {
|
|||
userCreated: boolean;
|
||||
visibleFor: any[];
|
||||
hiddenFor: any[];
|
||||
titleHiddenFor: any[];
|
||||
descriptionHiddenFor: any[];
|
||||
hidden: boolean;
|
||||
titleHiddenFor?: any[];
|
||||
descriptionHiddenFor?: any[];
|
||||
hidden?: boolean;
|
||||
};
|
||||
schoolClass: any;
|
||||
}) => boolean = ({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from api.graphene_wagtail import GenericStreamFieldType
|
|||
class ContentBlockInterface(graphene.Interface):
|
||||
title = graphene.String()
|
||||
contents = GenericStreamFieldType()
|
||||
type = graphene.String()
|
||||
type = graphene.String(required=True)
|
||||
|
||||
@staticmethod
|
||||
def resolve_type(parent, info, **kwargs):
|
||||
|
|
|
|||
|
|
@ -3,10 +3,89 @@ schema {
|
|||
mutation: PublicMutation
|
||||
}
|
||||
|
||||
input BetaLoginInput {
|
||||
usernameInput: String
|
||||
passwordInput: String
|
||||
clientMutationId: String
|
||||
type PublicQuery {
|
||||
node(
|
||||
"""The ID of the object"""
|
||||
id: ID!
|
||||
): Node
|
||||
_debug: DjangoDebug
|
||||
}
|
||||
|
||||
"""An object with an ID"""
|
||||
interface Node {
|
||||
"""The ID of the object"""
|
||||
id: ID!
|
||||
}
|
||||
|
||||
"""Debugging information for the current query."""
|
||||
type DjangoDebug {
|
||||
"""Executed SQL queries for this API query."""
|
||||
sql: [DjangoDebugSQL]
|
||||
|
||||
"""Raise exceptions for this API query."""
|
||||
exceptions: [DjangoDebugException]
|
||||
}
|
||||
|
||||
"""Represents a single database query made to a Django managed DB."""
|
||||
type DjangoDebugSQL {
|
||||
"""The type of database being used (e.g. postrgesql, mysql, sqlite)."""
|
||||
vendor: String!
|
||||
|
||||
"""The Django database alias (e.g. 'default')."""
|
||||
alias: String!
|
||||
|
||||
"""The actual SQL sent to this database."""
|
||||
sql: String
|
||||
|
||||
"""Duration of this database query in seconds."""
|
||||
duration: Float!
|
||||
|
||||
"""The raw SQL of this query, without params."""
|
||||
rawSql: String!
|
||||
|
||||
"""JSON encoded database query parameters."""
|
||||
params: String!
|
||||
|
||||
"""Start time of this database query."""
|
||||
startTime: Float!
|
||||
|
||||
"""Stop time of this database query."""
|
||||
stopTime: Float!
|
||||
|
||||
"""Whether this database query took more than 10 seconds."""
|
||||
isSlow: Boolean!
|
||||
|
||||
"""Whether this database query was a SELECT."""
|
||||
isSelect: Boolean!
|
||||
|
||||
"""Postgres transaction ID if available."""
|
||||
transId: String
|
||||
|
||||
"""Postgres transaction status if available."""
|
||||
transStatus: String
|
||||
|
||||
"""Postgres isolation level if available."""
|
||||
isoLevel: String
|
||||
|
||||
"""Postgres connection encoding if available."""
|
||||
encoding: String
|
||||
}
|
||||
|
||||
"""Represents a single exception raised."""
|
||||
type DjangoDebugException {
|
||||
"""The class of the exception"""
|
||||
excType: String!
|
||||
|
||||
"""The message of the exception"""
|
||||
message: String!
|
||||
|
||||
"""The stack trace"""
|
||||
stack: String!
|
||||
}
|
||||
|
||||
type PublicMutation {
|
||||
betaLogin(input: BetaLoginInput!): BetaLoginPayload
|
||||
_debug: DjangoDebug
|
||||
}
|
||||
|
||||
type BetaLoginPayload {
|
||||
|
|
@ -15,37 +94,8 @@ type BetaLoginPayload {
|
|||
clientMutationId: String
|
||||
}
|
||||
|
||||
type DjangoDebug {
|
||||
sql: [DjangoDebugSQL]
|
||||
}
|
||||
|
||||
type DjangoDebugSQL {
|
||||
vendor: String!
|
||||
alias: String!
|
||||
sql: String
|
||||
duration: Float!
|
||||
rawSql: String!
|
||||
params: String!
|
||||
startTime: Float!
|
||||
stopTime: Float!
|
||||
isSlow: Boolean!
|
||||
isSelect: Boolean!
|
||||
transId: String
|
||||
transStatus: String
|
||||
isoLevel: String
|
||||
encoding: String
|
||||
}
|
||||
|
||||
interface Node {
|
||||
id: ID!
|
||||
}
|
||||
|
||||
type PublicMutation {
|
||||
betaLogin(input: BetaLoginInput!): BetaLoginPayload
|
||||
_debug: DjangoDebug
|
||||
}
|
||||
|
||||
type PublicQuery {
|
||||
node(id: ID!): Node
|
||||
_debug: DjangoDebug
|
||||
input BetaLoginInput {
|
||||
usernameInput: String
|
||||
passwordInput: String
|
||||
clientMutationId: String
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue