feat(auth-manager): added latest endpoints to asset,key,connection MAPCO-8095#76
Conversation
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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.
| } | ||
| return result.version; | ||
| }, | ||
| async getMaxVersion(name: string, environment: Environments): Promise<number | null> { |
There was a problem hiding this comment.
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.
| } | ||
| return result.version; | ||
| }, | ||
| async getMaxVersion(name: string): Promise<number | null> { |
There was a problem hiding this comment.
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.
|
🎫 Related Jira Issue: MAPCO-8095 |
No description provided.