Skip to content

feat(auth-manager): added latest endpoints to asset,key,connection MAPCO-8095#76

Merged
CptSchnitz merged 2 commits into
masterfrom
latest-requests
Jul 1, 2025
Merged

feat(auth-manager): added latest endpoints to asset,key,connection MAPCO-8095#76
CptSchnitz merged 2 commits into
masterfrom
latest-requests

Conversation

@CptSchnitz
Copy link
Copy Markdown
Contributor

No description provided.

@CptSchnitz CptSchnitz requested review from Copilot and netanelC July 1, 2025 07:45
Copy link
Copy Markdown
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 adds new endpoints to retrieve the latest versions of keys, connections, and assets. The changes span integration tests, routers, models, controllers, DAL methods, and updates to the OpenAPI specification to support these endpoints.

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/auth-manager/tests/integration/key/key.spec.ts Added tests for GET /key/:environment/latest covering multiple versions and error scenarios.
packages/auth-manager/tests/integration/connection/connection.spec.ts Introduced integration tests for GET /client/:clientName/connection/:environment/latest validating success and error responses.
packages/auth-manager/tests/integration/asset/asset.spec.ts Added tests for GET /asset/:assetName/latest ensuring correct behavior under various conditions.
packages/auth-manager/src//routes/.ts Added new routes to support latest endpoints for keys, assets, and client connections.
packages/auth-manager/src/*/models/*Manager.ts Implemented new getLatest functions that retrieve the latest version using repository helpers.
packages/auth-manager/src/*/controllers/*Controller.ts Created new controller handlers for latest endpoints that handle errors such as not found cases.
packages/auth-manager/src/*/DAL/*Repository.ts Extended repositories with getMaxVersion methods to support fetching the highest version from the database.
packages/auth-manager/openapi3.yaml Updated API specification to document the new latest endpoints and their responses.

}
return result.version;
},
async getMaxVersion(env: Environments): Promise<number | null> {
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

Consider refining the null/undefined check in getMaxVersion; instead of only checking for undefined, explicitly check if the result is falsy or if result.version is null to cover all edge cases.

Copilot uses AI. Check for mistakes.
}
return result.version;
},
async getMaxVersion(name: string, environment: Environments): Promise<number | null> {
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

For consistency and clarity, consider explicitly checking if the query result or its version property is null or undefined, similar to the suggestion in the key repository.

Copilot uses AI. Check for mistakes.
}
return result.version;
},
async getMaxVersion(name: string): Promise<number | null> {
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

Consider updating the null-check in getMaxVersion to handle cases where the result object exists but the version is null, ensuring explicit handling of such cases.

Copilot uses AI. Check for mistakes.
@CptSchnitz CptSchnitz changed the title feat(auth-manager): added latest endpoints to asset,key,connection feat(auth-manager): added latest endpoints to asset,key,connection MAPCO-8095 Jul 1, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 1, 2025

🎫 Related Jira Issue: MAPCO-8095

Copy link
Copy Markdown
Contributor

@netanelC netanelC left a comment

Choose a reason for hiding this comment

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

Good Job

@CptSchnitz CptSchnitz merged commit c452486 into master Jul 1, 2025
13 checks passed
@CptSchnitz CptSchnitz deleted the latest-requests branch July 1, 2025 10:08
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