You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3, because the PR involves multiple files and functionalities including tests, service logic, and type definitions. The changes are moderate in complexity, involving async operations and interactions with external APIs.
🧪 Relevant tests
Yes
⚡ Possible issues
Possible Bug: The deletion of the schedule metafield in CustomerScheduleServiceDestroy does not handle the case where the shopifyAdmin.request might fail. This could lead to inconsistencies where the schedule is deleted from the database but the metafield remains in Shopify.
Consider adding error handling for the shopifyAdmin.request call within the CustomerScheduleServiceDestroy function. This could involve wrapping the request in a try-catch block and handling the error appropriately, possibly by logging the error or even preventing the deletion of the schedule from the database if the metafield deletion fails. [important]
Add error handling for the metafield deletion request
Consider adding error handling for the shopifyAdmin.request call when attempting to delete a metafield. This will ensure that any failures in the deletion process are caught and handled appropriately, preventing potential issues in the application flow.
Why: Adding error handling for the shopifyAdmin.request call is crucial for ensuring that any failures in the deletion process are caught and handled appropriately. This improves the robustness and reliability of the application.
9
Enhancement
Use await with proper error handling for asynchronous operations
Ensure that the await keyword is used with the shopifyAdmin.request to handle asynchronous operations properly. This change is crucial to ensure that the function execution waits for the request to complete before moving on.
Why: The suggestion to add error handling around the await keyword ensures that the function execution waits for the request to complete and handles any potential errors, improving the reliability of the code.
8
Best practice
Use dynamic enum values from the LocationTypes to ensure consistency
When defining enums in Mongoose schemas, it's a good practice to ensure that all possible values are covered. In this case, adding 'ONLINE' to the enum in the schema ensures data integrity and consistency with the updated LocationTypes enum.
Why: Using dynamic enum values from LocationTypes ensures consistency and reduces the risk of errors if the enum values are updated in the future. This is a good practice for maintaining data integrity.
7
Maintainability
Add assertions to verify the parameters with which mock functions are called
It's important to verify the behavior of mocked functions in tests to ensure they behave as expected. Adding assertions to check the call parameters of mockRequest would enhance the test's reliability and maintainability.
Why: Adding assertions to check the call parameters of mockRequest enhances the test's reliability and maintainability by ensuring that the mocked functions behave as expected.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement, Tests
Description
shopifyAdmin
request.ONLINE
toLocationTypes
enum in both schema and types.Changes walkthrough 📝
destroy.spec.ts
Add tests for destroying schedule metafield in controller
src/functions/customer/controllers/schedule/destroy.spec.ts
shopifyAdmin
request.DestroyScheduleMetafieldMutation
.destroy.spec.ts
Add tests for destroying schedule metafield in service
src/functions/customer/services/schedule/destroy.spec.ts
shopifyAdmin
request.DestroyScheduleMetafieldMutation
.destroy.ts
Ensure async request for product destruction
src/functions/customer/services/product/destroy.ts
await
toshopifyAdmin.request
call.destroy.ts
Implement metafield deletion in schedule service
src/functions/customer/services/schedule/destroy.ts
shopifyAdmin
request for metafield deletion.location.schema.ts
Add online location type to schema
src/functions/location/location.schema.ts
ONLINE
toLocationTypes
enum.location.types.ts
Add online location type to types
src/functions/location/location.types.ts
ONLINE
toLocationTypes
enum.admin.generated.d.ts
Add types and mutation for destroying schedule metafield
src/types/admin.generated.d.ts
DestroyScheduleMetafieldMutation
and its variables.