Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 73df542

Browse files
Add second query
1 parent 3ff5c95 commit 73df542

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

graphql_api/types/owner/owner.graphql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ type Owner {
3939
yaml: String
4040
aiFeaturesEnabled: Boolean!
4141
aiEnabledRepos: [String]
42+
aiEnabledRepos2(
43+
filters: RepositorySetFilters
44+
ordering: RepositoryOrdering
45+
orderingDirection: OrderingDirection
46+
first: Int
47+
after: String
48+
last: Int
49+
before: String
50+
): RepositoryConnection! @cost(complexity: 25, multipliers: ["first", "last"])
4251
uploadTokenRequired: Boolean
4352
activatedUserCount: Int
4453
}

graphql_api/types/owner/owner.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,29 @@ def resolve_ai_features_enabled(owner: Owner, info: GraphQLResolveInfo) -> bool:
362362
@owner_bindable.field("aiEnabledRepos")
363363
@sync_to_async
364364
@require_part_of_org
365+
def resolve_ai_enabled_repos(
366+
owner: Owner, info: GraphQLResolveInfo
367+
) -> List[str] | None:
368+
ai_features_app_install = GithubAppInstallation.objects.filter(
369+
app_id=AI_FEATURES_GH_APP_ID, owner=owner
370+
).first()
371+
372+
if not ai_features_app_install:
373+
return None
374+
375+
current_owner = info.context["request"].current_owner
376+
queryset = Repository.objects.filter(author=owner).viewable_repos(current_owner)
377+
378+
if ai_features_app_install.repository_service_ids:
379+
queryset = queryset.filter(
380+
service_id__in=ai_features_app_install.repository_service_ids
381+
)
382+
383+
return list(queryset.values_list("name", flat=True))
384+
385+
@owner_bindable.field("aiEnabledRepos2")
386+
@sync_to_async
387+
@require_part_of_org
365388
def resolve_ai_enabled_repos(
366389
owner: Owner,
367390
info: GraphQLResolveInfo,
@@ -391,7 +414,6 @@ def resolve_ai_enabled_repos(
391414
**kwargs,
392415
)
393416

394-
395417
@owner_bindable.field("uploadTokenRequired")
396418
@require_part_of_org
397419
def resolve_upload_token_required(

0 commit comments

Comments
 (0)