-
Notifications
You must be signed in to change notification settings - Fork 1
/
attendee.js
68 lines (55 loc) · 1.35 KB
/
attendee.js
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
const debug = require('debug')('graphql-attendee')
const fetch = require('node-fetch')
const services = require('services')
function attendees() {
debug('Start fetching attendees')
return fetch(`${services.persons}/attendees`)
.then(res => res.json())
.then(attendees => {
debug('...finished fetching attendees')
return attendees
})
}
function attendee(root, {
id
}) {
debug('Start fetching attendee')
return fetch(`${services.persons}/attendees/${id}`)
.then(res => res.json())
.then(attendee => {
debug('...finished fetching attendee')
return attendee
})
}
const Conference = {
attendees({
id
}) {
debug('Start fetching attendees for conference')
return fetch(`${services.persons}/conference/${id}/attendees`)
.then(res => res.json())
.then(attendees => {
debug('...finished fetching attendees for conference')
return attendees
})
}
}
const SocialProfile = {
socialprofiles({ id }) {
debug('Start fetching social profiles for attendee')
return fetch(`${services.social}/profiles/${id}`)
.then(res => res.json())
.then(profile => {
debug('...finished fetching social profiles for attendee')
return profile
})
}
}
exports.queries = {
attendee,
attendees
}
exports.resolvers = {
Conference,
SocialProfile
}