Custom ownerAffiliations for general stats
This commit is contained in:
@@ -33,6 +33,7 @@ module.exports = async (req, res) => {
|
||||
disable_animations,
|
||||
border_radius,
|
||||
border_color,
|
||||
role,
|
||||
} = req.query;
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
@@ -49,6 +50,7 @@ module.exports = async (req, res) => {
|
||||
username,
|
||||
parseBoolean(count_private),
|
||||
parseBoolean(include_all_commits),
|
||||
parseArray(role),
|
||||
);
|
||||
|
||||
const cacheSeconds = clampValue(
|
||||
|
||||
@@ -11,7 +11,7 @@ const fetcher = (variables, token) => {
|
||||
return request(
|
||||
{
|
||||
query: `
|
||||
query userInfo($login: String!) {
|
||||
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
|
||||
user(login: $login) {
|
||||
name
|
||||
login
|
||||
@@ -34,7 +34,7 @@ const fetcher = (variables, token) => {
|
||||
followers {
|
||||
totalCount
|
||||
}
|
||||
repositories(first: 100, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}) {
|
||||
repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}) {
|
||||
totalCount
|
||||
nodes {
|
||||
stargazers {
|
||||
@@ -91,6 +91,7 @@ async function fetchStats(
|
||||
username,
|
||||
count_private = false,
|
||||
include_all_commits = false,
|
||||
ownerAffiliations,
|
||||
) {
|
||||
if (!username) throw Error("Invalid username");
|
||||
|
||||
@@ -104,7 +105,7 @@ async function fetchStats(
|
||||
rank: { level: "C", score: 0 },
|
||||
};
|
||||
|
||||
let res = await retryer(fetcher, { login: username });
|
||||
let res = await retryer(fetcher, { login: username, ownerAffiliations});
|
||||
|
||||
if (res.data.errors) {
|
||||
logger.error(res.data.errors);
|
||||
|
||||
Reference in New Issue
Block a user