-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgatsby-node.js
More file actions
69 lines (64 loc) · 1.99 KB
/
gatsby-node.js
File metadata and controls
69 lines (64 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require("path")
exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes } = actions
const typeDefs = [
`
type media__image implements Node {
drupal_id: String
name: String
field_media_image: media__imageField_media_image
relationships: media__imageRelationships
}
type media__imageField_media_image implements Node {
alt: String
}
type media__imageRelationships implements Node {
field_media_image: file__file @link(from: "field_media_image___NODE")
node__spotlight: [node__spotlight] @link(from: "node__spotlight___NODE")
}
type node__spotlight implements Node {
changed: Date
drupal_id: String
field_spotlight_alignment: String
field_spotlight_button: String
field_spotlight_caption: String
field_spotlight_image_alignment: String
field_spotlight_rank: Int
field_spotlight_url: node__spotlightField_spotlight_url
relationships: node__spotlightRelationships
status: Boolean
title: String
}
type node__spotlightRelationships implements Node {
field_hero_image: media__image @link(from: "field_hero_image___NODE")
}
type node__spotlightField_spotlight_url implements Node {
uri: String
url: String
title: String
}
type WpEventToEventsCategoryConnection implements Node {
nodes: [WpEventsCategory]
}
type WpEventsCategory implements Node {
name: String
}
`,
schema.buildObjectType({
name: `WpEvent`,
interfaces: [`Node`],
fields: {
endDate: `String`,
startDate: `String`,
title: `String`,
url: `String`,
eventsCategories: `WpEventToEventsCategoryConnection`,
isPast: {
type: `Boolean`,
resolve: (source) => new Date(source.startDate) < new Date(),
},
},
}),
]
createTypes(typeDefs)
}