Skip to content

Commit

Permalink
Drop extra params from resource and node
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Nov 26, 2024
1 parent b856b62 commit b39063e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
11 changes: 6 additions & 5 deletions src/resolvers/learningpathResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*
*/

import { fetchImageV3, fetchLearningpath, fetchMyLearningpaths, fetchNode, fetchOembed } from "../api";
import { fetchImageV3, fetchLearningpath, fetchMyLearningpaths, fetchNode, fetchOembed, queryNodes } from "../api";
import { deleteLearningpath, updateLearningpathStatus } from "../api/learningpathApi";
import {
GQLLearningpath,
GQLLearningpathCoverphoto,
GQLLearningpathStep,
GQLLearningpathStepNodeArgs,

Check failure on line 15 in src/resolvers/learningpathResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'"../types/schema"' has no exported member named 'GQLLearningpathStepNodeArgs'. Did you mean 'GQLLearningpathStep'?

Check failure on line 15 in src/resolvers/learningpathResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'"../types/schema"' has no exported member named 'GQLLearningpathStepNodeArgs'. Did you mean 'GQLLearningpathStep'?
GQLLearningpathStepOembed,
GQLLearningpathStepResourceArgs,

Check failure on line 17 in src/resolvers/learningpathResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'"../types/schema"' has no exported member named 'GQLLearningpathStepResourceArgs'. Did you mean 'GQLLearningpathStepResolvers'?

Check failure on line 17 in src/resolvers/learningpathResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'"../types/schema"' has no exported member named 'GQLLearningpathStepResourceArgs'. Did you mean 'GQLLearningpathStepResolvers'?
GQLMutationDeleteLearningpathArgs,
Expand Down Expand Up @@ -87,14 +88,14 @@ export const resolvers = {
},
async resource(
learningpathStep: GQLLearningpathStep,
args: GQLLearningpathStepResourceArgs,
_: any,
context: ContextWithLoaders,
): Promise<GQLResource | null> {
return this.node(learningpathStep, args, context);
return this.node(learningpathStep, _, context);
},
async node(
learningpathStep: GQLLearningpathStep,
{ rootId, parentId }: GQLLearningpathStepResourceArgs,
_: any,
context: ContextWithLoaders,
): Promise<GQLResource | null> {
if (
Expand All @@ -109,7 +110,7 @@ export const resolvers = {
const lastResourceMatch = learningpathStep.embedUrl.url.match(/(resource:[:\da-fA-F-]+)/g)?.pop();

if (lastResourceMatch !== undefined) {
const resource = await fetchNode({ id: `urn:${lastResourceMatch}`, rootId, parentId }, context);
const resource = await fetchNode({ id: `urn:${lastResourceMatch}` }, context);
return nodeToTaxonomyEntity(resource, context);
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export const typeDefs = gql`
supportedLanguages: [String!]!
type: String!
article: Article
resource(rootId: String, parentId: String): Resource
node(rootId: String, parentId: String): Node
resource: Resource
node: Node
showTitle: Boolean!
oembed: LearningpathStepOembed
}
Expand Down
17 changes: 2 additions & 15 deletions src/types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,19 +953,6 @@ export type GQLLearningpathStep = {
type: Scalars['String'];
};


export type GQLLearningpathStepNodeArgs = {
parentContextId?: InputMaybe<Scalars['String']>;
parentId?: InputMaybe<Scalars['String']>;
rootId?: InputMaybe<Scalars['String']>;
};


export type GQLLearningpathStepResourceArgs = {
parentId?: InputMaybe<Scalars['String']>;
rootId?: InputMaybe<Scalars['String']>;
};

export type GQLLearningpathStepEmbedUrl = {
__typename?: 'LearningpathStepEmbedUrl';
embedType: Scalars['String'];
Expand Down Expand Up @@ -3814,9 +3801,9 @@ export type GQLLearningpathStepResolvers<ContextType = any, ParentType extends G
id?: Resolver<GQLResolversTypes['Int'], ParentType, ContextType>;
license?: Resolver<Maybe<GQLResolversTypes['License']>, ParentType, ContextType>;
metaUrl?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
node?: Resolver<Maybe<GQLResolversTypes['Node']>, ParentType, ContextType, Partial<GQLLearningpathStepNodeArgs>>;
node?: Resolver<Maybe<GQLResolversTypes['Node']>, ParentType, ContextType>;
oembed?: Resolver<Maybe<GQLResolversTypes['LearningpathStepOembed']>, ParentType, ContextType>;
resource?: Resolver<Maybe<GQLResolversTypes['Resource']>, ParentType, ContextType, Partial<GQLLearningpathStepResourceArgs>>;
resource?: Resolver<Maybe<GQLResolversTypes['Resource']>, ParentType, ContextType>;
revision?: Resolver<GQLResolversTypes['Int'], ParentType, ContextType>;
seqNo?: Resolver<GQLResolversTypes['Int'], ParentType, ContextType>;
showTitle?: Resolver<GQLResolversTypes['Boolean'], ParentType, ContextType>;
Expand Down

0 comments on commit b39063e

Please sign in to comment.