Skip to content

Commit

Permalink
Add id field
Browse files Browse the repository at this point in the history
  • Loading branch information
RunarVestmann committed Jan 7, 2025
1 parent 2c29084 commit 44a08a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/web/screens/queries/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ export const slices = gql`
fragment FeaturedLinksFields on FeaturedLinks {
__typename
id
title
featuredLinks {
title
Expand Down
7 changes: 6 additions & 1 deletion libs/cms/src/lib/models/featuredLinks.model.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Field, ObjectType } from '@nestjs/graphql'
import { Field, ID, ObjectType } from '@nestjs/graphql'
import { IFeaturedLinks } from '../generated/contentfulTypes'
import { Featured, mapFeatured } from './featured.model'
import { CacheField } from '@island.is/nest/graphql'
import { SystemMetadata } from '@island.is/shared/types'

@ObjectType()
export class FeaturedLinks {
@Field(() => ID)
id!: string

@Field()
title?: string

Expand All @@ -15,8 +18,10 @@ export class FeaturedLinks {

export const mapFeaturedLinks = ({
fields,
sys,
}: IFeaturedLinks): SystemMetadata<FeaturedLinks> => ({
typename: 'FeaturedLinks',
id: sys.id,
title: fields.displayedTitle ?? '',
featuredLinks: fields.links ? fields.links.map(mapFeatured) : [],
})

0 comments on commit 44a08a3

Please sign in to comment.