diff --git a/client/src/__generated__/gql.ts b/client/src/__generated__/gql.ts index 87afd72e..e107dc3f 100644 --- a/client/src/__generated__/gql.ts +++ b/client/src/__generated__/gql.ts @@ -36,7 +36,7 @@ const documents = { "\n fragment ContentBlockHighlightsWithIdOnlyFragment on ContentBlockNode {\n highlights {\n id\n }\n }\n ": types.ContentBlockHighlightsWithIdOnlyFragmentFragmentDoc, "\n mutation UpdateInstrumentBookmark($input: UpdateInstrumentBookmarkInput!) {\n updateInstrumentBookmark(input: $input) {\n success\n }\n }\n ": types.UpdateInstrumentBookmarkDocument, "\n mutation UpdateContentBookmark($input: UpdateContentBookmarkInput!) {\n updateContentBookmark(input: $input) {\n success\n }\n }\n ": types.UpdateContentBookmarkDocument, - "\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n allHighlights {\n ...HighlightParts\n }\n }\n }\n }\n }\n ": types.MyActivitiesQueryDocument, + "\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n myHighlights {\n ...HighlightParts\n }\n myBookmarks {\n ... on ContentBlockBookmarkNode {\n id\n uuid\n contentBlock {\n id\n }\n note {\n id\n text\n }\n }\n __typename\n }\n mySubmissions {\n id\n text\n assignment {\n id\n title\n }\n }\n myAnswers {\n id\n survey {\n id\n title\n }\n }\n }\n }\n }\n }\n ": types.MyActivitiesQueryDocument, "\n query ChapterQuery($id: ID!) {\n chapter(id: $id) {\n path\n }\n }\n ": types.ChapterQueryDocument, "\n query ContentBlockQuery($id: ID!) {\n contentBlock(id: $id) {\n path\n }\n }\n ": types.ContentBlockQueryDocument, "\n fragment InstrumentParts on InstrumentNode {\n id\n title\n intro\n slug\n language\n bookmarks {\n uuid\n note {\n id\n text\n }\n }\n type {\n id\n name\n category {\n id\n name\n foreground\n background\n }\n type\n }\n contents\n highlights {\n ...HighlightParts\n }\n }\n": types.InstrumentPartsFragmentDoc, @@ -156,7 +156,7 @@ export function graphql(source: "\n mutation UpdateContentBookmark($input /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n allHighlights {\n ...HighlightParts\n }\n }\n }\n }\n }\n "): (typeof documents)["\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n allHighlights {\n ...HighlightParts\n }\n }\n }\n }\n }\n "]; +export function graphql(source: "\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n myHighlights {\n ...HighlightParts\n }\n myBookmarks {\n ... on ContentBlockBookmarkNode {\n id\n uuid\n contentBlock {\n id\n }\n note {\n id\n text\n }\n }\n __typename\n }\n mySubmissions {\n id\n text\n assignment {\n id\n title\n }\n }\n myAnswers {\n id\n survey {\n id\n title\n }\n }\n }\n }\n }\n }\n "): (typeof documents)["\n query MyActivitiesQuery {\n myActivities {\n topics {\n id\n title\n modules {\n id\n slug\n title\n myHighlights {\n ...HighlightParts\n }\n myBookmarks {\n ... on ContentBlockBookmarkNode {\n id\n uuid\n contentBlock {\n id\n }\n note {\n id\n text\n }\n }\n __typename\n }\n mySubmissions {\n id\n text\n assignment {\n id\n title\n }\n }\n myAnswers {\n id\n survey {\n id\n title\n }\n }\n }\n }\n }\n }\n "]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/client/src/__generated__/graphql.ts b/client/src/__generated__/graphql.ts index 5b8b2fbe..e14318da 100644 --- a/client/src/__generated__/graphql.ts +++ b/client/src/__generated__/graphql.ts @@ -321,6 +321,8 @@ export type AssignmentNode = Node & { userCreated: Scalars['Boolean']['output']; }; +export type BookmarkNode = ChapterBookmarkNode | ContentBlockBookmarkNode | InstrumentBookmarkNode | ModuleBookmarkNode; + /** An enumeration. */ export enum BooksModuleCategoryFilterAttributeTypeChoices { /** All */ @@ -969,7 +971,6 @@ export type ModuleLevelNodeModuleSetArgs = { export type ModuleNode = ModuleInterface & { __typename?: 'ModuleNode'; - allHighlights?: Maybe>>; assignments?: Maybe>>; bookmark?: Maybe; category?: Maybe; @@ -986,10 +987,12 @@ export type ModuleNode = ModuleInterface & { level?: Maybe; /** e.g. 'Intro' or 'Modul 1' */ metaTitle: Scalars['String']['output']; - myAnswers?: Maybe; + myAnswers?: Maybe>>; + myBookmarks?: Maybe>>; myChapterBookmarks?: Maybe; myContentBookmarks?: Maybe; - mySubmissions?: Maybe; + myHighlights?: Maybe>>; + mySubmissions?: Maybe>>; objectiveGroups?: Maybe>>; pk?: Maybe; /** Der Name der Seite, wie er in URLs angezeigt werden soll, z.B. http://domain.com/blog/[my-slug]/ */ @@ -1003,15 +1006,6 @@ export type ModuleNode = ModuleInterface & { }; -export type ModuleNodeMyAnswersArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - - export type ModuleNodeMyChapterBookmarksArgs = { after?: InputMaybe; before?: InputMaybe; @@ -1029,15 +1023,6 @@ export type ModuleNodeMyContentBookmarksArgs = { offset?: InputMaybe; }; - -export type ModuleNodeMySubmissionsArgs = { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; - last?: InputMaybe; - offset?: InputMaybe; -}; - export type ModuleNodeConnection = { __typename?: 'ModuleNodeConnection'; /** Contains the nodes in this connection. */ @@ -1712,7 +1697,6 @@ export type Query = { roomEntry?: Maybe; rooms?: Maybe>>; snapshot?: Maybe; - something: Scalars['String']['output']; studentSubmission?: Maybe; survey?: Maybe; surveys?: Maybe; @@ -2134,23 +2118,6 @@ export type StudentSubmissionNode = Node & { text: Scalars['String']['output']; }; -export type StudentSubmissionNodeConnection = { - __typename?: 'StudentSubmissionNodeConnection'; - /** Contains the nodes in this connection. */ - edges: Array>; - /** Pagination data for this connection. */ - pageInfo: PageInfo; -}; - -/** A Relay edge containing a `StudentSubmissionNode` and its cursor. */ -export type StudentSubmissionNodeEdge = { - __typename?: 'StudentSubmissionNodeEdge'; - /** A cursor for use in pagination */ - cursor: Scalars['String']['output']; - /** The item at the end of the edge */ - node?: Maybe; -}; - export type SubmissionFeedbackInput = { final?: InputMaybe; id?: InputMaybe; @@ -2818,10 +2785,10 @@ export type UpdateContentBookmarkMutation = { __typename?: 'Mutation', updateCon export type MyActivitiesQueryQueryVariables = Exact<{ [key: string]: never; }>; -export type MyActivitiesQueryQuery = { __typename?: 'Query', myActivities?: { __typename?: 'ActivityNode', topics?: Array<{ __typename?: 'TopicNode', id: string, title: string, modules?: Array<{ __typename?: 'ModuleNode', id: string, slug: string, title: string, allHighlights?: Array<( +export type MyActivitiesQueryQuery = { __typename?: 'Query', myActivities?: { __typename?: 'ActivityNode', topics?: Array<{ __typename?: 'TopicNode', id: string, title: string, modules?: Array<{ __typename?: 'ModuleNode', id: string, slug: string, title: string, myHighlights?: Array<( { __typename?: 'HighlightNode' } & { ' $fragmentRefs'?: { 'HighlightPartsFragment': HighlightPartsFragment } } - ) | null> | null } | null> | null } | null> | null } | null }; + ) | null> | null, myBookmarks?: Array<{ __typename: 'ChapterBookmarkNode' } | { __typename: 'ContentBlockBookmarkNode', id: string, uuid?: any | null, contentBlock: { __typename?: 'ContentBlockNode', id: string }, note?: { __typename?: 'NoteNode', id: string, text: string } | null } | { __typename: 'InstrumentBookmarkNode' } | { __typename: 'ModuleBookmarkNode' } | null> | null, mySubmissions?: Array<{ __typename?: 'StudentSubmissionNode', id: string, text: string, assignment: { __typename?: 'AssignmentNode', id: string, title: string } } | null> | null, myAnswers?: Array<{ __typename?: 'AnswerNode', id: string, survey: { __typename?: 'SurveyNode', id: string, title: string } } | null> | null } | null> | null } | null> | null } | null }; export type ChapterQueryQueryVariables = Exact<{ id: Scalars['ID']['input']; @@ -2904,7 +2871,7 @@ export const AddHighlightDocument = {"kind":"Document","definitions":[{"kind":"O export const AddContentHighlightDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddContentHighlight"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AddContentHighlightInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addContentHighlight"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"highlight"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"HighlightParts"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"HighlightParts"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"HighlightNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"contentIndex"}},{"kind":"Field","name":{"kind":"Name","value":"paragraphIndex"}},{"kind":"Field","name":{"kind":"Name","value":"selectionLength"}},{"kind":"Field","name":{"kind":"Name","value":"contentUuid"}},{"kind":"Field","name":{"kind":"Name","value":"startPosition"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}}]}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"page"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ContentBlockNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InstrumentNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ModuleNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ChapterNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}}]} as unknown as DocumentNode; export const UpdateInstrumentBookmarkDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateInstrumentBookmark"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateInstrumentBookmarkInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateInstrumentBookmark"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode; export const UpdateContentBookmarkDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateContentBookmark"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateContentBookmarkInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateContentBookmark"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode; -export const MyActivitiesQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyActivitiesQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myActivities"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"topics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"modules"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"allHighlights"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"HighlightParts"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"HighlightParts"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"HighlightNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"contentIndex"}},{"kind":"Field","name":{"kind":"Name","value":"paragraphIndex"}},{"kind":"Field","name":{"kind":"Name","value":"selectionLength"}},{"kind":"Field","name":{"kind":"Name","value":"contentUuid"}},{"kind":"Field","name":{"kind":"Name","value":"startPosition"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}}]}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"page"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ContentBlockNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InstrumentNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ModuleNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ChapterNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}}]} as unknown as DocumentNode; +export const MyActivitiesQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyActivitiesQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myActivities"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"topics"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"modules"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"myHighlights"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"HighlightParts"}}]}},{"kind":"Field","name":{"kind":"Name","value":"myBookmarks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ContentBlockBookmarkNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"uuid"}},{"kind":"Field","name":{"kind":"Name","value":"contentBlock"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"text"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mySubmissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"assignment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"myAnswers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"survey"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"HighlightParts"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"HighlightNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"contentIndex"}},{"kind":"Field","name":{"kind":"Name","value":"paragraphIndex"}},{"kind":"Field","name":{"kind":"Name","value":"selectionLength"}},{"kind":"Field","name":{"kind":"Name","value":"contentUuid"}},{"kind":"Field","name":{"kind":"Name","value":"startPosition"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}}]}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"page"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ContentBlockNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InstrumentNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ModuleNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ChapterNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}}]} as unknown as DocumentNode; export const ChapterQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ChapterQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"chapter"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}}]} as unknown as DocumentNode; export const ContentBlockQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ContentBlockQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contentBlock"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path"}}]}}]}}]} as unknown as DocumentNode; export const InstrumentQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"InstrumentQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"instrument"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"InstrumentParts"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"HighlightParts"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"HighlightNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"contentIndex"}},{"kind":"Field","name":{"kind":"Name","value":"paragraphIndex"}},{"kind":"Field","name":{"kind":"Name","value":"selectionLength"}},{"kind":"Field","name":{"kind":"Name","value":"contentUuid"}},{"kind":"Field","name":{"kind":"Name","value":"startPosition"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}}]}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"page"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ContentBlockNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InstrumentNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ModuleNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ChapterNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"InstrumentParts"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InstrumentNode"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"intro"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"language"}},{"kind":"Field","name":{"kind":"Name","value":"bookmarks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uuid"}},{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"text"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"type"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"foreground"}},{"kind":"Field","name":{"kind":"Name","value":"background"}}]}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"contents"}},{"kind":"Field","name":{"kind":"Name","value":"highlights"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"HighlightParts"}}]}}]}}]} as unknown as DocumentNode; diff --git a/client/src/components/profile/ActivityEntry.vue b/client/src/components/profile/ActivityEntry.vue index ca77b1cc..40603e8d 100644 --- a/client/src/components/profile/ActivityEntry.vue +++ b/client/src/components/profile/ActivityEntry.vue @@ -1,32 +1,17 @@ - diff --git a/client/src/pages/topic-page.vue b/client/src/pages/topic-page.vue index 27e3b81c..a457b567 100644 --- a/client/src/pages/topic-page.vue +++ b/client/src/pages/topic-page.vue @@ -90,9 +90,7 @@ export default { data() { return { topic: { - modules: { - edges: [], - }, + modules: [], }, saveMe: false, }; diff --git a/server/books/schema/nodes/module.py b/server/books/schema/nodes/module.py index abf92593..59563938 100644 --- a/server/books/schema/nodes/module.py +++ b/server/books/schema/nodes/module.py @@ -1,5 +1,4 @@ import graphene -from wagtail.models import Page from assignments.models import StudentSubmission from assignments.schema.types import AssignmentNode, StudentSubmissionNode from books.models import Chapter, ContentBlock, Module, RecentModule @@ -11,15 +10,11 @@ from django.db.models import Q from graphene import relay from graphene_django import DjangoObjectType from graphene_django.filter import DjangoFilterConnectionField -from notes.models import ( - ChapterBookmark, - ContentBlockBookmark, - Highlight, - ModuleBookmark, -) +from notes.models import Highlight, ModuleBookmark from objectives.schema import ObjectiveGroupNode from surveys.models import Answer from surveys.schema import AnswerNode +from wagtail.models import Page class ModuleNode(DjangoObjectType): @@ -48,8 +43,8 @@ class ModuleNode(DjangoObjectType): chapters = graphene.List(ChapterNode) solutions_enabled = graphene.Boolean() bookmark = graphene.Field("notes.schema.ModuleBookmarkNode") - my_submissions = DjangoFilterConnectionField(StudentSubmissionNode) - my_answers = DjangoFilterConnectionField(AnswerNode) + my_submissions = graphene.List(StudentSubmissionNode) + my_answers = graphene.List(AnswerNode) my_content_bookmarks = DjangoFilterConnectionField( "notes.schema.ContentBlockBookmarkNode" ) @@ -63,7 +58,8 @@ class ModuleNode(DjangoObjectType): category = graphene.Field(ModuleCategoryNode) language = graphene.String() highlights = graphene.List("notes.schema.HighlightNode") - all_highlights = graphene.List("notes.schema.HighlightNode") + my_highlights = graphene.List("notes.schema.HighlightNode") + my_bookmarks = graphene.List("notes.schema.BookmarkNode") def resolve_chapters(self, info, **kwargs): return Chapter.get_by_parent(self) @@ -136,7 +132,7 @@ class ModuleNode(DjangoObjectType): return root.highlights.filter(user=info.context.user) @staticmethod - def resolve_all_highlights(root: Module, info, **kwargs): + def resolve_my_highlights(root: Module, info, **kwargs): # todo: is this too expensive, query-wise pages = Page.objects.live().descendant_of(root) highlights = Highlight.objects.filter(user=info.context.user).filter( @@ -144,6 +140,27 @@ class ModuleNode(DjangoObjectType): ) return highlights + @staticmethod + def resolve_my_bookmarks(root: Module, info, **kwargs): + from notes.models import ChapterBookmark, ContentBlockBookmark, ModuleBookmark + + module_bookmarks = ModuleBookmark.objects.filter( + module=root, user=info.context.user + ) + chapters = Chapter.get_by_parent(root) + chapter_bookmarks = ChapterBookmark.objects.filter( + chapter__in=chapters, user=info.context.user + ) + content_blocks = ContentBlock.objects.descendant_of(root) + content_block_bookmarks = ContentBlockBookmark.objects.filter( + user=info.context.user, content_block__in=content_blocks + ) + return ( + list(module_bookmarks) + + list(chapter_bookmarks) + + list(content_block_bookmarks) + ) + class RecentModuleNode(DjangoObjectType): class Meta: diff --git a/server/notes/schema.py b/server/notes/schema.py index ad0606f8..58384f61 100644 --- a/server/notes/schema.py +++ b/server/notes/schema.py @@ -1,10 +1,10 @@ import graphene from basicknowledge.queries import InstrumentNode from books.schema.nodes import ContentBlockNode, ModuleNode -from graphene import relay -from graphene_django import DjangoObjectType from books.schema.nodes.chapter import ChapterNode from core.logger import get_logger +from graphene import relay +from graphene_django import DjangoObjectType from notes.models import ( ChapterBookmark, ContentBlockBookmark, @@ -69,6 +69,16 @@ class InstrumentBookmarkNode(DjangoObjectType): interfaces = (relay.Node,) +class BookmarkNode(graphene.Union): + class Meta: + types = ( + ContentBlockBookmarkNode, + ModuleBookmarkNode, + ChapterBookmarkNode, + InstrumentBookmarkNode, + ) + + class HighlightableNode(graphene.Union): class Meta: types = (ContentBlockNode, InstrumentNode, ModuleNode, ChapterNode) diff --git a/server/schema.graphql b/server/schema.graphql index 3d79e3cd..53051102 100644 --- a/server/schema.graphql +++ b/server/schema.graphql @@ -54,7 +54,6 @@ type Query { myActivity(offset: Int, before: String, after: String, first: Int, last: Int, slug: String, slug_Icontains: String, slug_In: [String], title: String, title_Icontains: String, title_In: [String]): ModuleNodeConnection myInstrumentActivity(offset: Int, before: String, after: String, first: Int, last: Int, slug: String): InstrumentNodeConnection myActivities: ActivityNode - something: String! _debug: DjangoDebug } @@ -124,14 +123,15 @@ type ModuleNode implements ModuleInterface { chapters: [ChapterNode] solutionsEnabled: Boolean bookmark: ModuleBookmarkNode - mySubmissions(offset: Int, before: String, after: String, first: Int, last: Int): StudentSubmissionNodeConnection - myAnswers(offset: Int, before: String, after: String, first: Int, last: Int): AnswerNodeConnection + mySubmissions: [StudentSubmissionNode] + myAnswers: [AnswerNode] myContentBookmarks(offset: Int, before: String, after: String, first: Int, last: Int): ContentBlockBookmarkNodeConnection myChapterBookmarks(offset: Int, before: String, after: String, first: Int, last: Int): ChapterBookmarkNodeConnection snapshots: [SnapshotNode] language: String highlights: [HighlightNode] - allHighlights: [HighlightNode] + myHighlights: [HighlightNode] + myBookmarks: [BookmarkNode] } interface ModuleInterface { @@ -682,40 +682,6 @@ type SnapshotChangesNode { newContentBlocks: Int! } -type StudentSubmissionNodeConnection { - """Pagination data for this connection.""" - pageInfo: PageInfo! - - """Contains the nodes in this connection.""" - edges: [StudentSubmissionNodeEdge]! -} - -"""A Relay edge containing a `StudentSubmissionNode` and its cursor.""" -type StudentSubmissionNodeEdge { - """The item at the end of the edge""" - node: StudentSubmissionNode - - """A cursor for use in pagination""" - cursor: String! -} - -type AnswerNodeConnection { - """Pagination data for this connection.""" - pageInfo: PageInfo! - - """Contains the nodes in this connection.""" - edges: [AnswerNodeEdge]! -} - -"""A Relay edge containing a `AnswerNode` and its cursor.""" -type AnswerNodeEdge { - """The item at the end of the edge""" - node: AnswerNode - - """A cursor for use in pagination""" - cursor: String! -} - type AnswerNode implements Node { """The ID of the object""" id: ID! @@ -767,6 +733,25 @@ type ChapterBookmarkNodeEdge { cursor: String! } +union BookmarkNode = ContentBlockBookmarkNode | ModuleBookmarkNode | ChapterBookmarkNode | InstrumentBookmarkNode + +type AnswerNodeConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [AnswerNodeEdge]! +} + +"""A Relay edge containing a `AnswerNode` and its cursor.""" +type AnswerNodeEdge { + """The item at the end of the edge""" + node: AnswerNode + + """A cursor for use in pagination""" + cursor: String! +} + type SurveyNodeConnection { """Pagination data for this connection.""" pageInfo: PageInfo!