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

Legger til mulighet for å hente ut htmltitle og htmlintroduction #433

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"@graphql-codegen/typescript-resolvers": "^2.7.6",
"@graphql-eslint/eslint-plugin": "^3.12.0",
"@jest-mock/express": "^2.0.2",
"@ndla/types-backend": "^0.2.48",
"@ndla/types-embed": "^4.0.14",
"@ndla/types-backend": "^0.2.50",
"@ndla/types-embed": "^4.0.15",
"@ndla/types-taxonomy": "^1.0.22",
"@types/bunyan": "^1.8.5",
"@types/compression": "^1.7.2",
Expand Down
4 changes: 4 additions & 0 deletions src/api/articleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ const _fetchTransformedArticle = async (params: ArticleParams, context: Context)
return {
...article,
introduction: article.introduction?.introduction ?? "",
htmlIntroduction: article.introduction?.htmlIntroduction ?? "",
metaDescription: article.metaDescription.metaDescription,
title: article.title.title,
htmlTitle: article.title.htmlTitle,
metaData,
tags: article.tags.tags,
visualElementEmbed,
Expand Down Expand Up @@ -168,7 +170,9 @@ export async function fetchArticles(articleIds: string[], context: Context): Pro
return {
id: article.id,
title: article.title.title,
htmlTitle: article.title.htmlTitle,
introduction: article.introduction?.introduction,
htmlIntroduction: article.introduction?.htmlIntroduction,
metaDescription: article.metaDescription?.metaDescription,
lastUpdated: article.updated,
metaImage: article.metaImage,
Expand Down
1 change: 1 addition & 0 deletions src/api/learningpathApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function fetchLearningpaths(learningpathIds: string[], context: Con
return {
id: learningpath.id,
title: learningpath.title.title,
htmlTitle: learningpath.title.title,
Copy link
Contributor

Choose a reason for hiding this comment

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

Har vi støtte for html-tittel i stier?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nei, men siden eg utvida Meta-typen måtte eg legge det til her også.

introduction: learningpath.introduction.introduction,
metaDescription: learningpath.description.description,
lastUpdated: learningpath.lastUpdated,
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/articleResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const resolvers = {
},
introduction(article: GQLArticle): string {
return parseMarkdown({
markdown: article.introduction ?? "",
markdown: article.htmlIntroduction ?? "",
inline: true,
});
},
Expand Down
4 changes: 4 additions & 0 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ export const typeDefs = gql`
type Meta {
id: Int!
title: String!
htmlTitle: String!
introduction: String
htmlIntroduction: String
metaDescription: String
metaImage: MetaImage
lastUpdated: String
Expand Down Expand Up @@ -501,8 +503,10 @@ export const typeDefs = gql`
id: Int!
revision: Int!
title: String!
htmlTitle: String!
slug: String
introduction: String
htmlIntroduction: String
content: String!
created: String!
updated: String!
Expand Down
8 changes: 8 additions & 0 deletions src/types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ export type GQLArticle = {
created: Scalars['String'];
crossSubjectTopics?: Maybe<Array<GQLCrossSubjectElement>>;
grepCodes?: Maybe<Array<Scalars['String']>>;
htmlIntroduction?: Maybe<Scalars['String']>;
htmlTitle: Scalars['String'];
id: Scalars['Int'];
introduction?: Maybe<Scalars['String']>;
language: Scalars['String'];
Expand Down Expand Up @@ -920,6 +922,8 @@ export type GQLManuscript = {
export type GQLMeta = {
__typename?: 'Meta';
availability?: Maybe<Scalars['String']>;
htmlIntroduction?: Maybe<Scalars['String']>;
htmlTitle: Scalars['String'];
id: Scalars['Int'];
introduction?: Maybe<Scalars['String']>;
language?: Maybe<Scalars['String']>;
Expand Down Expand Up @@ -2777,6 +2781,8 @@ export type GQLArticleResolvers<ContextType = any, ParentType extends GQLResolve
created?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
crossSubjectTopics?: Resolver<Maybe<Array<GQLResolversTypes['CrossSubjectElement']>>, ParentType, ContextType, Partial<GQLArticleCrossSubjectTopicsArgs>>;
grepCodes?: Resolver<Maybe<Array<GQLResolversTypes['String']>>, ParentType, ContextType>;
htmlIntroduction?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
htmlTitle?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
id?: Resolver<GQLResolversTypes['Int'], ParentType, ContextType>;
introduction?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
language?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
Expand Down Expand Up @@ -3499,6 +3505,8 @@ export type GQLManuscriptResolvers<ContextType = any, ParentType extends GQLReso

export type GQLMetaResolvers<ContextType = any, ParentType extends GQLResolversParentTypes['Meta'] = GQLResolversParentTypes['Meta']> = {
availability?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
htmlIntroduction?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
htmlTitle?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>;
id?: Resolver<GQLResolversTypes['Int'], ParentType, ContextType>;
introduction?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
language?: Resolver<Maybe<GQLResolversTypes['String']>, ParentType, ContextType>;
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2068,17 +2068,17 @@ __metadata:
languageName: node
linkType: hard

"@ndla/types-backend@npm:^0.2.48":
version: 0.2.48
resolution: "@ndla/types-backend@npm:0.2.48"
checksum: 10c0/fad7377b46ae3878db8770e4541e5ba4d798357b73ad4123329b5e95e8e0bd75753bd572cf040cefe4d62ab7a18a71e719f0f684a82e0b106d61d17e949e7563
"@ndla/types-backend@npm:^0.2.50":
version: 0.2.50
resolution: "@ndla/types-backend@npm:0.2.50"
checksum: 10c0/82e18af457d7f51943cc519064206cfc425d97576dabf6cf16acf80b9f640e57970392109386b7fdba0873c3554ea8130efa90e7f502bbb52293f4c133a3a5bb
languageName: node
linkType: hard

"@ndla/types-embed@npm:^4.0.14":
version: 4.0.14
resolution: "@ndla/types-embed@npm:4.0.14"
checksum: 10c0/2be7ac0a97ae31d788197b40a5202c1091693ab162de5aab61c3fe48e4bd291a6c491f194ff4e2f38f57a0fc046d74d5720e9e955c23787b3ae7d693b25c7acb
"@ndla/types-embed@npm:^4.0.15":
version: 4.0.15
resolution: "@ndla/types-embed@npm:4.0.15"
checksum: 10c0/e25d11d980f4cebf4027a618551e3428a4277595fcc5df67a9c5f866e993af10c47c036b80b72902b4668ed7f0a83552e30287aff19f06eaca22d213d09ed2c1
languageName: node
linkType: hard

Expand Down Expand Up @@ -8845,8 +8845,8 @@ __metadata:
"@graphql-tools/schema": "npm:^9.0.8"
"@jest-mock/express": "npm:^2.0.2"
"@ndla/licenses": "npm:^7.2.5"
"@ndla/types-backend": "npm:^0.2.48"
"@ndla/types-embed": "npm:^4.0.14"
"@ndla/types-backend": "npm:^0.2.50"
"@ndla/types-embed": "npm:^4.0.15"
"@ndla/types-taxonomy": "npm:^1.0.22"
"@types/bunyan": "npm:^1.8.5"
"@types/compression": "npm:^1.7.2"
Expand Down
Loading