Closed raae closed 1 year ago
For reference, something like this, but with our numbers!
const { actions, reporter, createContentDigest, createNodeId } = gatsbyUtils;
const { createNode } = actions;
createNode({
id: createNodeId("statistics"),
unfollowedCount: 10,
userCount: 10,
internal: {
type: "statistics",
contentDigest: createContentDigest(10),
},
});
To get the number from Xata (in localhost these will be very small):
const xata = getXataClient();
const result = await xata.db.accounts.aggregate({
unfollowsTotal: {
count: {
filter: {
unfollowed: { $ge: new Date("2022-11-03") },
},
},
},
usersTotal: {
uniqueCount: {
column: "followed_by",
},
},
});
const unfollowsTotal = result.aggs.unfollowsTotal
const usersTotal = result.aggs.usersTotal
// Use unfollowsTotal and usersTotal when creating the node
It would be cool to pull in the number of unfollowed across users and the number of users for a little statistics section on the marketing page.