( owner: Owner, modelSlug: string )
| 313 | forceRefresh, |
| 314 | cachedRepositories, |
| 315 | repositoriesSyncedAt: integration.repositories_synced_at, |
| 316 | }) |
| 317 | ) { |
| 318 | const appType = integration.github_app_type || 'standard'; |
| 319 | const installationId = integration.platform_installation_id; |
| 320 | const repos = await readListingWithinBudget(() => |
| 321 | fetchGitHubRepositories(installationId, appType, integration.id, 'management') |
| 322 | ); |
| 323 | await updateRepositoriesForIntegration(integrationId, repos); |
| 324 | return { |
| 325 | repositories: repos, |
| 326 | syncedAt: new Date().toISOString(), |
| 327 | }; |
| 328 | } |
| 329 | |
| 330 | return { |
| 331 | repositories: cachedRepositories ?? [], |
| 332 | syncedAt: integration.repositories_synced_at, |
| 333 | }; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Cancel one pending installation request. |
| 338 | * |
| 339 | * The id is required: a user can hold several pending requests, so the caller |
| 340 | * must name the row it displayed. An id that is not a pending request for this |
| 341 | * owner is refused rather than replaced by another matching row. |
| 342 | */ |
| 343 | export async function cancelPendingInstallation(owner: Owner, integrationId: string) { |
| 344 | const ownershipCondition = ownerCondition(owner); |
| 345 | |
| 346 | const [integration] = await db |
| 347 | .select() |
| 348 | .from(platform_integrations) |
| 349 | .where( |
| 350 | and( |
| 351 | ownershipCondition, |
| 352 | eq(platform_integrations.id, integrationId), |
| 353 | eq(platform_integrations.platform, 'github'), |
| 354 | eq(platform_integrations.integration_status, INTEGRATION_STATUS.PENDING), |
| 355 | isNull(platform_integrations.platform_installation_id) |
| 356 | ) |
nothing calls this directly
no test coverage detected