Skip to content

Commit c875ddd

Browse files
authored
fetch landing links (#46)
1 parent 13d47fd commit c875ddd

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/fetch-landings.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { getLandingLinks } = require('./http-utils');
2+
3+
const queryPages = /* GraphQL */ `
4+
query($conferenceTitle: ConferenceTitle, $eventYear: EventYear) {
5+
conf: conferenceBrand(where: { title: $conferenceTitle }) {
6+
id
7+
year: conferenceEvents(where: { year: $eventYear }) {
8+
id
9+
emsEventId
10+
}
11+
}
12+
}
13+
`;
14+
15+
const fetchData = async (client, vars) => {
16+
const data = await client.request(queryPages, vars).then(res => {
17+
return res.conf.year[0].emsEventId;
18+
});
19+
20+
const landingLinks = (await getLandingLinks(data)) || [];
21+
22+
return {
23+
landingLinks,
24+
};
25+
};
26+
27+
module.exports = {
28+
fetchData,
29+
queryPages,
30+
getData: res => res,
31+
story: 'landingLinks',
32+
};

src/http-utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const getMcs = baseEventFetch('users?role=MC');
2727
const getCommittee = baseEventFetch('users?role=PC');
2828
const getFreeWorkshops = baseEventFetch('free-workshops');
2929
const getEvent = baseEventFetch('');
30+
const getLandingLinks = baseEventFetch('latestLinks');
3031

3132
module.exports = {
3233
getSpeakers,
@@ -40,4 +41,5 @@ module.exports = {
4041
getCommittee,
4142
getEvent,
4243
getFreeWorkshops,
44+
getLandingLinks,
4345
};

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const extContent = require('./fetch-extended');
1616
const jobsContent = require('./fetch-jobs');
1717
const committeeContent = require('./fetch-committee');
1818
const diversityContent = require('./fetch-diversity');
19+
const latestLinksContent = require('./fetch-landings');
1920
const { postProcessLayer } = require('./postprocess');
2021

2122
const createClient = ({ endpoint, token }) => {
@@ -57,6 +58,7 @@ const getContent = async conferenceSettings => {
5758
jobsContent,
5859
committeeContent,
5960
diversityContent,
61+
latestLinksContent,
6062
].map(async content => {
6163
try {
6264
getQueriesData(content, conferenceSettings);

0 commit comments

Comments
 (0)