From f035dc5b96f647d7d31a3138b7ca2275dc77a344 Mon Sep 17 00:00:00 2001 From: Lero Date: Mon, 10 Mar 2025 16:39:41 +0200 Subject: [PATCH] fetch landing links --- src/fetch-landings.js | 32 ++++++++++++++++++++++++++++++++ src/http-utils.js | 2 ++ src/index.js | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 src/fetch-landings.js diff --git a/src/fetch-landings.js b/src/fetch-landings.js new file mode 100644 index 0000000..3b83807 --- /dev/null +++ b/src/fetch-landings.js @@ -0,0 +1,32 @@ +const { getLandingLinks } = require('./http-utils'); + +const queryPages = /* GraphQL */ ` + query($conferenceTitle: ConferenceTitle, $eventYear: EventYear) { + conf: conferenceBrand(where: { title: $conferenceTitle }) { + id + year: conferenceEvents(where: { year: $eventYear }) { + id + emsEventId + } + } + } +`; + +const fetchData = async (client, vars) => { + const data = await client.request(queryPages, vars).then(res => { + return res.conf.year[0].emsEventId; + }); + + const landingLinks = (await getLandingLinks(data)) || []; + + return { + landingLinks, + }; +}; + +module.exports = { + fetchData, + queryPages, + getData: res => res, + story: 'landingLinks', +}; diff --git a/src/http-utils.js b/src/http-utils.js index 83da1db..9f4e92e 100644 --- a/src/http-utils.js +++ b/src/http-utils.js @@ -27,6 +27,7 @@ const getMcs = baseEventFetch('users?role=MC'); const getCommittee = baseEventFetch('users?role=PC'); const getFreeWorkshops = baseEventFetch('free-workshops'); const getEvent = baseEventFetch(''); +const getLandingLinks = baseEventFetch('latestLinks'); module.exports = { getSpeakers, @@ -40,4 +41,5 @@ module.exports = { getCommittee, getEvent, getFreeWorkshops, + getLandingLinks, }; diff --git a/src/index.js b/src/index.js index 85d547b..1332996 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,7 @@ const extContent = require('./fetch-extended'); const jobsContent = require('./fetch-jobs'); const committeeContent = require('./fetch-committee'); const diversityContent = require('./fetch-diversity'); +const latestLinksContent = require('./fetch-landings'); const { postProcessLayer } = require('./postprocess'); const createClient = ({ endpoint, token }) => { @@ -57,6 +58,7 @@ const getContent = async conferenceSettings => { jobsContent, committeeContent, diversityContent, + latestLinksContent, ].map(async content => { try { getQueriesData(content, conferenceSettings);