MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / updateModel

Function updateModel

apps/web/src/lib/integrations/linear-service.ts:532–569  ·  view source on GitHub ↗
(
  owner: Owner,
  modelSlug: string
)

Source from the content-addressed store, hash-verified

530 if (
531 isActive &&
532 (options.getChatSdkAccessToken ||
533 options.deleteChatSdkInstallation ||
534 options.deleteChatSdkIdentityCache)
535 ) {
536 if (!organizationId) {
537 throw new TRPCError({
538 code: 'INTERNAL_SERVER_ERROR',
539 message: 'Linear installation is missing an organization ID',
540 });
541 }
542
543 // Fetch the access token from the chat-sdk adapter BEFORE deleting the
544 // installation, then ask Linear to revoke it. This ensures the OAuth app
545 // is properly uninstalled on Linear's side; otherwise the workspace will
546 // see "already installed" on a reinstall attempt.
547 const accessToken = await options.getChatSdkAccessToken?.(organizationId);
548 if (accessToken) {
549 await revokeLinearToken(accessToken);
550 }
551
552 await options.deleteChatSdkInstallation?.(organizationId);
553 await options.deleteChatSdkIdentityCache?.(organizationId);
554 }
555
556 await db.delete(platform_integrations).where(eq(platform_integrations.id, integration.id));
557
558 return { success: true };
559}
560
561export async function deleteInstallationByOrganizationId(organizationId: string) {
562 const integration = await getInstallationByOrganizationId(organizationId);
563
564 if (!integration) {
565 return { success: true, deleted: false };
566 }
567
568 await db.delete(platform_integrations).where(eq(platform_integrations.id, integration.id));
569
570 return { success: true, deleted: true };
571}
572

Callers

nothing calls this directly

Calls 8

getOrganizationByIdFunction · 0.90
isAllowedFunction · 0.85
getInstallationFunction · 0.70
setMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected