Skip to content

Do not use the blockName from the request in the GET and PATCH endpoints of connection controller #791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 13, 2025

Conversation

MarceloRGonc
Copy link
Contributor

@MarceloRGonc MarceloRGonc commented Jun 12, 2025

Part of OPS-1959.

Additional notes:

  • We can't change the models yet.

Copy link

linear bot commented Jun 12, 2025

@MarceloRGonc MarceloRGonc changed the base branch from main to mg/remove-ff June 12, 2025 10:45
Base automatically changed from mg/remove-ff to main June 13, 2025 08:26
Copy link

@MarceloRGonc MarceloRGonc changed the title Remove block-name from connections GET and PATCH endpoints Do not use the blockName from the request in the GET and PATCH endpoints of connection controller Jun 13, 2025
@MarceloRGonc MarceloRGonc marked this pull request as ready for review June 13, 2025 11:21
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 11:21
Copy link
Contributor Author

@MarceloRGonc MarceloRGonc left a comment

Choose a reason for hiding this comment

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

We can't change the models yet. I'm preparing another PR

Copy link
Contributor

@Copilot 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 removes the use of blockName in the GET and PATCH endpoints of the connection controller and updates associated models and tests to utilize authProviderKey and authProperty instead. Key changes include:

  • Removal of the blockNames field from the read request DTO.
  • Updates to the AppConnection model to enforce authProviderKey as a required string.
  • Adjustments in endpoints, service methods, and tests to reference authProperty instead of block.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/shared/src/lib/app-connection/dto/read-app-connection-request.ts Removed blockNames property in favor of using authProviderKey.
packages/shared/src/lib/app-connection/app-connection.ts Updated authProviderKey type from an optional union to a required string.
packages/server/api/test/unit/app-connection/connection-providers-resolver.test.ts Added tests for the new getAuthProviderMetadata helper.
packages/server/api/test/unit/app-connection/app-connection-service.test.ts Updated tests to pass authProperty instead of block.
packages/server/api/src/app/app-connection/connection-providers-resolver.ts Introduced getAuthProviderMetadata to fetch authentication metadata based on authProviderKey.
packages/server/api/src/app/app-connection/app-connection.controller.ts Modified endpoints to use authProperty instead of blockName for data retrieval and redaction.
packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts Updated patch method signature and usage from block to authProperty.
Comments suppressed due to low confidence (2)

packages/shared/src/lib/app-connection/app-connection.ts:113

  • Changing authProviderKey from an optional union (string | null) to a required string may lead to compatibility issues with consumers expecting null values. Consider verifying that all model usages are updated or that this change is acceptable.
authProviderKey: Type.String(),

packages/server/api/src/app/app-connection/app-connection.controller.ts:44

  • The PATCH endpoint does not currently check whether authProperty is defined before using it in subsequent operations. Adding a validation check and returning an appropriate error status if authProperty is undefined would help prevent unintended behavior.
const authProperty = await getAuthProviderMetadata(request.body.authProviderKey, request.principal.projectId);

@MarceloRGonc MarceloRGonc merged commit caa4bff into main Jun 13, 2025
15 checks passed
@MarceloRGonc MarceloRGonc deleted the mg/OPS-1959 branch June 13, 2025 12:24
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.

2 participants