computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
896 B
38 lines
896 B
import { type APIContext } from 'astro'; |
|
import { api } from './api.ts'; |
|
|
|
export type LeaderboardUserDetails = { |
|
id: string; |
|
name: string; |
|
avatar?: string; |
|
count: number; |
|
}; |
|
|
|
export type ListLeaderboardStatsResponse = { |
|
streaks: { |
|
active: LeaderboardUserDetails[]; |
|
lifetime: LeaderboardUserDetails[]; |
|
}; |
|
projectSubmissions: { |
|
currentMonth: LeaderboardUserDetails[]; |
|
lifetime: LeaderboardUserDetails[]; |
|
}; |
|
githubContributors: { |
|
currentMonth: LeaderboardUserDetails[]; |
|
}; |
|
referrals: { |
|
currentMonth: LeaderboardUserDetails[]; |
|
lifetime: LeaderboardUserDetails[]; |
|
}; |
|
}; |
|
|
|
export function leaderboardApi(context: APIContext) { |
|
return { |
|
listLeaderboardStats: async function () { |
|
return api(context).get<ListLeaderboardStatsResponse>( |
|
`${import.meta.env.PUBLIC_API_URL}/v1-list-leaderboard-stats`, |
|
{}, |
|
); |
|
}, |
|
}; |
|
}
|
|
|