MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / getReposStats

Function getReposStats

packages/web/src/actions.ts:232–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230 * Returns a set of aggregated stats about the repos in the org
231 */
232export const getReposStats = async () => sew(() =>
233 withOptionalAuth(async ({ org, prisma }) => {
234 const [
235 // Total number of repos.
236 numberOfRepos,
237 // Number of repos with their first time indexing jobs either
238 // pending or in progress.
239 numberOfReposWithFirstTimeIndexingJobsInProgress,
240 // Number of repos that have been indexed at least once.
241 numberOfReposWithIndex,
242 ] = await Promise.all([
243 prisma.repo.count({
244 where: {
245 orgId: org.id,
246 }
247 }),
248 prisma.repo.count({
249 where: {
250 orgId: org.id,
251 indexedAt: null,
252 jobs: {
253 some: {
254 type: RepoIndexingJobType.INDEX,
255 status: {
256 in: [
257 RepoIndexingJobStatus.PENDING,
258 RepoIndexingJobStatus.IN_PROGRESS,
259 ]
260 }
261 },
262 },
263 }
264 }),
265 prisma.repo.count({
266 where: {
267 orgId: org.id,
268 NOT: {
269 indexedAt: null,
270 }
271 }
272 })
273 ]);
274
275 return {
276 numberOfRepos,
277 numberOfReposWithFirstTimeIndexingJobsInProgress,
278 numberOfReposWithIndex,
279 };
280 })
281)
282
283export const getConnectionStats = async () => sew(() =>
284 withAuth(async ({ org, prisma }) => {

Callers 3

SearchLandingPageFunction · 0.90
ChatLandingPageFunction · 0.90
LayoutFunction · 0.90

Calls 2

sewFunction · 0.90
withOptionalAuthFunction · 0.90

Tested by

no test coverage detected