-
Notifications
You must be signed in to change notification settings - Fork 0
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
Business central auth fixed #61
Conversation
WalkthroughThe recent updates reflect a restructuring in the management of Business Central credentials within a workspace application. The process for connecting to Business Central has been simplified, with some of the logic being shifted away from serializers to views, indicating a possible move towards a more view-centric approach for handling credentials. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- apps/workspaces/helpers.py (3 hunks)
- apps/workspaces/serializers.py (2 hunks)
- apps/workspaces/views.py (2 hunks)
Additional comments: 5
apps/workspaces/views.py (3)
8-8: The import of
connect_business_central
is correctly placed and follows the Python convention of grouping third-party imports separately from local application imports.81-95: The
post
method implementation correctly uses theconnect_business_central
function to create Business Central credentials and returns a serialized response. Ensure that theauthorization_code
andredirect_uri
are validated before use to prevent security issues.97-98: The
get_queryset
method is implemented correctly, returning all instances ofBusinessCentralCredentials
. This is a standard Django ORM practice for views that require a queryset.apps/workspaces/helpers.py (1)
- 88-93: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [88-102]
The
connect_business_central
function has been refactored to remove the dependency onWorkspace
attributes. Ensure that the removal of this logic does not affect other parts of the application that may rely on these attributes. The function correctly handles the creation or update ofBusinessCentralCredentials
.apps/workspaces/serializers.py (1)
- 84-86: The
create
method has been removed from theBusinessCentralCredentialsSerializer
class. This change implies that the creation logic has been moved elsewhere, likely to theConnectBusinessCentralView
class. Verify that this change aligns with the application's design and that the credential creation process is still secure and functional.
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #61 +/- ##
==========================================
+ Coverage 90.29% 90.91% +0.61%
==========================================
Files 51 51
Lines 2504 2487 -17
==========================================
Hits 2261 2261
+ Misses 243 226 -17 ☔ View full report in Codecov by Sentry. |
* Company Selection API * test case fixed * moved to business central
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (7)
- apps/business_central/helpers.py (2 hunks)
- apps/business_central/serializers.py (1 hunks)
- apps/business_central/urls.py (2 hunks)
- apps/business_central/utils.py (2 hunks)
- apps/business_central/views.py (2 hunks)
- tests/test_business_central/test_views.py (1 hunks)
- tests/test_mappings/test_imports/test_modules/test_expense_custom_fields.py (1 hunks)
Files skipped from review due to trivial changes (1)
- tests/test_mappings/test_imports/test_modules/test_expense_custom_fields.py
Additional comments: 10
apps/business_central/urls.py (2)
3-3: The import statement has been updated to include
CompanySelectionView
. Ensure that this view is indeed used within this file and that the import is necessary.12-12: The new URL path for
CompanySelectionView
is correctly added with the namecompany-selection
. Ensure that this naming convention is consistent with the rest of the application.apps/business_central/views.py (2)
3-7: The import statements have been updated to include
BusinessCentralFieldSerializer
,CompanySelectionSerializer
, andImportBusinessCentralAttributesSerializer
. Confirm that these serializers are used within this file.28-32: The
CompanySelectionView
class has been added with aserializer_class
attribute set toCompanySelectionSerializer
. Ensure that theCompanySelectionSerializer
is defined and that it contains the necessary logic for this view to function correctly.tests/test_business_central/test_views.py (1)
- 45-64: The new test function
test_post_company_selection
is added to test the POST request for company selection. Verify that the test covers all necessary scenarios and that the assertions are appropriate for the expected outcomes. Additionally, ensure that the test function name and docstring accurately describe its purpose.apps/business_central/helpers.py (2)
7-7: The import order in
helpers.py
has been modified. Confirm that this new order follows the project's conventions and that there are no circular dependencies introduced.51-51: The
'companies'
dimension has been added to thedimensions
list in thesync_dimensions
function. Ensure that this addition is consistent with the intended behavior of the function and that the necessary logic to handle this new dimension is in place.apps/business_central/serializers.py (1)
- 98-121: The
CompanySelectionSerializer
class has been added with aMeta
inner class and acreate
method. Ensure that theMeta
class correctly specifies the model and fields, and that thecreate
method contains the appropriate logic for updatingWorkspace
attributes based on the request data and context.apps/business_central/utils.py (2)
64-71: The logic in the
_sync_data
method has been modified to include 'COMPANY' in theattribute_type
parameter check and to handle thedisplay_name
parameter using the 'displayName' field if available. Confirm that this logic is correct and that it aligns with the data structure of the items being synchronized.84-86: The
sync_companies
method now passes an empty list as thefield_names
parameter to the_sync_data
method. Ensure that this is the intended behavior and that it does not negatively impact the synchronization process.
Summary by CodeRabbit