Skip to content

Conversation

@rSnapkoOpenOps
Copy link
Collaborator

@rSnapkoOpenOps rSnapkoOpenOps commented Dec 24, 2025

Fixes OPS-2994.

@linear
Copy link

linear bot commented Dec 24, 2025

@rSnapkoOpenOps rSnapkoOpenOps marked this pull request as ready for review December 24, 2025 12:53
Copilot AI review requested due to automatic review settings December 24, 2025 12:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new IntegrationAuthorization model and corresponding database infrastructure to track user authorizations for external integrations.

Key Changes:

  • Added IntegrationAuthorization TypeBox schema model with fields for user, project, organization, token, integration name, and revocation status
  • Created database entity with foreign key relationships and composite index on projectId and integrationName
  • Implemented database migration to create the integration_authorization table

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/shared/src/lib/integration-authorization/integration-authorization.ts Defines the IntegrationAuthorization TypeBox schema with required fields
packages/shared/src/index.ts Exports the new IntegrationAuthorization model
packages/server/api/src/app/integration-authorization/integration-authorization.entity.ts Creates TypeORM entity schema with relations and composite index
packages/server/api/src/app/database/postgres-connection.ts Registers the migration in the migrations list
packages/server/api/src/app/database/migrations/1766579857000-CreateIntegrationAuthorizationTable.ts Implements database migration to create the table with foreign keys and index
packages/server/api/src/app/database/database-connection.ts Adds IntegrationAuthorizationEntity to the list of registered entities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rSnapkoOpenOps rSnapkoOpenOps changed the title Add IntegrationAuthorization model and database entity Add RefreshToken model and database entity Dec 29, 2025
"principal" jsonb NOT NULL,
"is_revoked" boolean NOT NULL DEFAULT false,
"revoked_at" TIMESTAMP WITH TIME ZONE,
"expirationTime" TIMESTAMP WITH TIME ZONE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be not null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, i think we need to keep an option for tokens without expiration date

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need tokens that don't expire?

await queryRunner.query(`
CREATE INDEX IF NOT EXISTS "idx_refresh_token_project_id_and_client" ON "refresh_token" ("projectId", "client")
`);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing constraints:

  • Unique refreshToken
  • Unique refreshToken, projectId, userId, client, isRevoked false

…CreateRefreshTokenTable.ts

Co-authored-by: Marcelo Gonçalves <marcelo@openops.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants