- 
                Notifications
    
You must be signed in to change notification settings  - Fork 32
 
π Update API keys uniqueness constraint (ποΈ) #8363
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
π Update API keys uniqueness constraint (ποΈ) #8363
Conversation
          Codecov Reportβ
 All modified and coverable lines are covered by tests. Additional details and impacted files@@            Coverage Diff             @@
##           master    #8363      +/-   ##
==========================================
- Coverage   87.42%   86.02%   -1.40%     
==========================================
  Files        1945     1452     -493     
  Lines       75630    57518   -18112     
  Branches     1321      563     -758     
==========================================
- Hits        66120    49482   -16638     
+ Misses       9126     7902    -1224     
+ Partials      384      134     -250     
 
 Continue to review full report in Codecov by Sentry. 
 π New features to boost your workflow:
  | 
    
There was a problem hiding this 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 updates the uniqueness constraint for API keys in the database to include the product name, allowing users to have API keys with the same display name across different products.
- Updated the 
api_keystable uniqueness constraint from(display_name, user_id)to(display_name, user_id, product_name) - Refactored test fixtures to use a factory pattern for better flexibility
 - Added a new test to verify API keys with the same display name can be created for different products
 
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description | 
|---|---|
packages/postgres-database/src/simcore_postgres_database/models/api_keys.py | 
Updated uniqueness constraint definition to include product_name | 
packages/postgres-database/src/simcore_postgres_database/migration/versions/7e92447558e0_update_api_keys_uniqueness_constraint.py | 
Database migration to update the constraint | 
services/web/server/src/simcore_service_webserver/api_keys/_repository.py | 
Updated conflict resolution to include product_name | 
services/web/server/tests/unit/with_dbs/01/test_api_keys.py | 
Refactored fixtures and added test for same display name across products | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thanks.
β¦com:giancarloromeo/osparc-simcore into is8110/update-api-key-uniqueness-constraint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| 
           @Mergifyio queue  | 
    
          
 π Waiting for conditions to match
  | 
    
          
 | 
    



What do these changes do?
This PR updates the uniqueness constraint for API keys in the database to include the product name, allowing users to have API keys with the same display name across different products.
display_name, user_id) to (display_name, user_id, product_name)Related issue/s
How to test
Dev-ops
api_keystable.