Skip to content

Commit 3855938

Browse files
committed
Custom ownerAffiliations for general stats
1 parent 4edda27 commit 3855938

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: api/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = async (req, res) => {
3333
disable_animations,
3434
border_radius,
3535
border_color,
36+
role,
3637
} = req.query;
3738
let stats;
3839

@@ -51,6 +52,7 @@ module.exports = async (req, res) => {
5152
username,
5253
parseBoolean(count_private),
5354
parseBoolean(include_all_commits),
55+
parseArray(role),
5456
);
5557

5658
const cacheSeconds = clampValue(

Diff for: src/fetchers/stats-fetcher.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const fetcher = (variables, token) => {
1111
return request(
1212
{
1313
query: `
14-
query userInfo($login: String!) {
14+
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
1515
user(login: $login) {
1616
name
1717
login
@@ -31,7 +31,7 @@ const fetcher = (variables, token) => {
3131
followers {
3232
totalCount
3333
}
34-
repositories(first: 100, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}) {
34+
repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}) {
3535
totalCount
3636
nodes {
3737
stargazers {
@@ -88,6 +88,7 @@ async function fetchStats(
8888
username,
8989
count_private = false,
9090
include_all_commits = false,
91+
ownerAffiliations,
9192
) {
9293
if (!username) throw Error("Invalid username");
9394

@@ -101,7 +102,7 @@ async function fetchStats(
101102
rank: { level: "C", score: 0 },
102103
};
103104

104-
let res = await retryer(fetcher, { login: username });
105+
let res = await retryer(fetcher, { login: username, ownerAffiliations});
105106

106107
if (res.data.errors) {
107108
logger.error(res.data.errors);

0 commit comments

Comments
 (0)