prague-blockchain-week/data/23/events/ethprague/_sync.js

81 řádky
2.8 KiB
JavaScript
Surový Normální zobrazení Historie

2023-03-25 00:42:42 +01:00
const peopleMapper = {
2023-04-12 02:07:11 +02:00
"Dcbuilder.eth": { country: "cz" },
"Luc.computer": { country: "nl" },
2023-04-07 00:09:13 +02:00
"Ferit Tunçer": { country: "pt" },
"Puncar": { country: "us" },
"Miao ZhiCheng": { country: "ee" },
"Cryptowanderer": { country: "za" },
//"Daniel Lumi": { country: "" },
"Nicolas Manea": { country: "gb" },
"Tim Beiko": { country: "ca" },
"Abeer Sharma": { country: "hk" },
"Dustin Jacobus": { country: "be" },
"Rhys Williams": { country: "gb" },
"Sahil Sen": { country: "in" },
"Steffen Kux": { country: "de" },
2023-04-20 18:39:56 +02:00
"Michal Převrátil": { country: "cz" },
2023-04-24 21:29:26 +02:00
"Jan": { id: "jan-jaczkal", country: "cz" },
2023-04-26 21:27:57 +02:00
"Anett Rolikova": { country: "sk" },
2023-04-26 21:30:37 +02:00
"Josef Gattermayer ": { country: "cz" },
2023-05-01 13:50:06 +02:00
"Filip Siroky": { country: "cz" },
2023-05-04 06:50:25 +02:00
"Radek Svarz": { country: "cz" },
2023-05-08 21:19:08 +02:00
"Dominik": { id: "schmiddominik" },
2023-05-13 21:37:15 +02:00
"Wlodek Gogloza": { country: "pl" },
"Zeynep Ecenaz Altınok": { country: "tr" },
2023-05-15 13:41:25 +02:00
"Mário Havel": { country: "cz" },
2023-04-07 00:09:13 +02:00
};
export async function data($) {
const res = await $.loadJSONUrl(
"https://graphql.contentful.com/content/v1/spaces/6j1me6tz5h39/environments/master",
{
method: "POST",
body: JSON.stringify({
query: `
2023-03-25 00:42:42 +01:00
{
ethPraguePeopleSortedCollection(limit: 1) {
items {
ethPraguePeopleSortedCollection {
items {
sys { id }
... on EthPraguePerson {
sys { id }
name
twitter
company
role
profileImage {
sys {
publishedAt
id
}
fileName
url
}
}
}
}
}
}
2023-04-07 00:09:13 +02:00
}`,
}),
headers: {
"content-type": "application/json",
authorization: "Bearer 7xdKQm9l5CXQE6tXXKYxNQ_lgvanmpdUgT20pIlxfOk",
2023-03-25 00:42:42 +01:00
},
2023-04-07 00:09:13 +02:00
},
);
return {
speakers: res.data.ethPraguePeopleSortedCollection.items[0]
.ethPraguePeopleSortedCollection.items.map((s) =>
2023-03-25 00:42:42 +01:00
Object.assign({
id: $.formatId(s.name),
name: s.name,
2023-05-04 06:43:23 +02:00
twitter: s.twitter?.replace("https://twitter.com/", ""),
2023-03-25 00:42:42 +01:00
caption: s.company || "",
photoUrl: s.profileImage?.url,
}, peopleMapper[s.name] || {})
2023-03-31 11:40:12 +02:00
).sort((x, y) => x.id > y.id ? -1 : 1),
2023-04-07 00:09:13 +02:00
};
}