Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added copyright info for metaimages in articles #496

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/api/articleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import { IArticleV2 } from "@ndla/types-backend/article-api";
import { queryNodes } from "./taxonomyApi";
import { transformArticle } from "./transformArticleApi";
import { ndlaUrl } from "../config";
import {
GQLArticleTransformedContentArgs,
GQLMeta,
GQLRelatedContent,
GQLTransformedArticleContent,
} from "../types/schema";
import { GQLArticleTransformedContentArgs, GQLRelatedContent, GQLTransformedArticleContent } from "../types/schema";
import { fetch, resolveJson } from "../utils/apiHelpers";
import { getArticleIdFromUrn, findPrimaryPath } from "../utils/articleHelpers";

Expand Down
1 change: 1 addition & 0 deletions src/resolvers/articleResolvers.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bytt ut returverdien fra funksjonen med GQLMetaImageWithCopyright

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
return {
...article.metaImage,
url: image.image?.imageUrl,
copyright: image.copyright,

Check failure on line 102 in src/resolvers/articleResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

Type '{ url: string; copyright: ICopyright; alt: string; language: string; }' is not assignable to type 'GQLMetaImage'.

Check failure on line 102 in src/resolvers/articleResolvers.ts

View workflow job for this annotation

GitHub Actions / Unit tests

Type '{ url: string; copyright: ICopyright; alt: string; language: string; }' is not assignable to type 'GQLMetaImage'.
};
},
introduction(article: IArticleV2): string {
Expand Down
8 changes: 7 additions & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,12 @@ export const typeDefs = gql`
url: String!
}

type MetaImageWithCopyright {
gunnarvelle marked this conversation as resolved.
Show resolved Hide resolved
alt: String!
url: String!
copyright: Copyright!
}

type Article {
id: Int!
revision: Int!
Expand All @@ -576,7 +582,7 @@ export const typeDefs = gql`
created: String!
updated: String!
published: String!
metaImage: MetaImage
metaImage: MetaImageWithCopyright
metaDescription: String!
articleType: String!
oldNdlaUrl: String
Expand Down
23 changes: 21 additions & 2 deletions src/types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export type GQLArticle = {
introduction?: Maybe<Scalars['String']>;
language: Scalars['String'];
metaDescription: Scalars['String'];
metaImage?: Maybe<GQLMetaImage>;
metaImage?: Maybe<GQLMetaImageWithCopyright>;
oembed?: Maybe<Scalars['String']>;
oldNdlaUrl?: Maybe<Scalars['String']>;
published: Scalars['String'];
Expand Down Expand Up @@ -970,6 +970,13 @@ export type GQLMetaImage = {
url: Scalars['String'];
};

export type GQLMetaImageWithCopyright = {
__typename?: 'MetaImageWithCopyright';
alt: Scalars['String'];
copyright: GQLCopyright;
url: Scalars['String'];
};

export type GQLMovie = {
__typename?: 'Movie';
id: Scalars['String'];
Expand Down Expand Up @@ -2481,6 +2488,8 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs
info: GraphQLResolveInfo
) => TResult | Promise<TResult>;



/** Mapping between all available schema types and the resolvers types */
export type GQLResolversTypes = {
AggregationResult: ResolverTypeWrapper<GQLAggregationResult>;
Expand Down Expand Up @@ -2575,6 +2584,7 @@ export type GQLResolversTypes = {
Manuscript: ResolverTypeWrapper<GQLManuscript>;
Meta: ResolverTypeWrapper<GQLMeta>;
MetaImage: ResolverTypeWrapper<GQLMetaImage>;
MetaImageWithCopyright: ResolverTypeWrapper<GQLMetaImageWithCopyright>;
Movie: ResolverTypeWrapper<GQLMovie>;
MovieMeta: ResolverTypeWrapper<GQLMovieMeta>;
MovieResourceTypes: ResolverTypeWrapper<GQLMovieResourceTypes>;
Expand Down Expand Up @@ -2743,6 +2753,7 @@ export type GQLResolversParentTypes = {
Manuscript: GQLManuscript;
Meta: GQLMeta;
MetaImage: GQLMetaImage;
MetaImageWithCopyright: GQLMetaImageWithCopyright;
Movie: GQLMovie;
MovieMeta: GQLMovieMeta;
MovieResourceTypes: GQLMovieResourceTypes;
Expand Down Expand Up @@ -3020,7 +3031,7 @@ export type GQLArticleResolvers<ContextType = any, ParentType extends GQLResolve
introduction?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
language?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
metaDescription?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
metaImage?: Resolver<Maybe<GQLResolversTypes['MetaImage']>, ParentType, ContextType>;
metaImage?: Resolver<Maybe<GQLResolversTypes['MetaImageWithCopyright']>, ParentType, ContextType>;
oembed?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
oldNdlaUrl?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
published?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
Expand Down Expand Up @@ -3740,6 +3751,13 @@ export type GQLMetaImageResolvers<ContextType = any, ParentType extends GQLResol
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type GQLMetaImageWithCopyrightResolvers<ContextType = any, ParentType extends GQLResolversParentTypes['MetaImageWithCopyright'] = GQLResolversParentTypes['MetaImageWithCopyright']> = {
alt?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
copyright?: Resolver<GQLResolversTypes['Copyright'], ParentType, ContextType>;
url?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type GQLMovieResolvers<ContextType = any, ParentType extends GQLResolversParentTypes['Movie'] = GQLResolversParentTypes['Movie']> = {
id?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
metaDescription?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
Expand Down Expand Up @@ -4605,6 +4623,7 @@ export type GQLResolvers<ContextType = any> = {
Manuscript?: GQLManuscriptResolvers<ContextType>;
Meta?: GQLMetaResolvers<ContextType>;
MetaImage?: GQLMetaImageResolvers<ContextType>;
MetaImageWithCopyright?: GQLMetaImageWithCopyrightResolvers<ContextType>;
Movie?: GQLMovieResolvers<ContextType>;
MovieMeta?: GQLMovieMetaResolvers<ContextType>;
MovieResourceTypes?: GQLMovieResourceTypesResolvers<ContextType>;
Expand Down
Loading