Skip to content
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

🏗️ Improved the HTTP Client implementation on the SM module #221

Merged
merged 21 commits into from
Jun 25, 2023

Conversation

ctreminiom
Copy link
Owner

@ctreminiom ctreminiom commented Jun 22, 2023

  • Changed the client interface from Client interface to Connector interface on the service management module

  • 🐞 The requestFieldValues object was overwritten map values on the CustomerRequestFields struct methods because the methods that appends fields on the slice of maps is replacing the information on the iteration.

  • This was fixed replacing the Fields struct tag from the CustomerRequestFields (from []map[string]interface{} to map[string]interface{}).

  • With that change, the Fields tag appends the information to avoid the overwriting them send the information to the consolidation method (MergeFields)

  • Some logic was changed on the MergeFields method, removing the mergo iteration and replace it with the creation of the requestFieldValues map.

  • When the requestFieldValues map is created, it's merged with the request struct information.

  • In conclusion, the custom fields are added dynamically and the customer request can be created with multiple form types :).

1. Replacing the Client interface with 6 methods.

2. Changed the client interface from Client to Connector on the service management approval service.
1. The requestFieldValues object was overwritten map values on the CustomerRequestFields struct methods because the methods that appends fields on the slice of maps is replacing the information on the iteration.

2. This was fixed replacing the Fields struct tag from the CustomerRequestFields (from []map[string]interface{} to map[string]interface{}).

3. With that change, the Fields tag appends the information avoid the overwriting and to send of the information to the consolidation method (*MergeFields*)

4. Some logic was changed on the MergeFields method, removing the mergo iteration and replace it with the creation of the requestFieldValues map.

5. When the requestFieldValues map is created, it's merged with the request struct information.

6. In conclusion, the custom fields are added dynamically and the customer request can be created with multiple form types :).
@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Merging #221 (b1d6975) into main (9bed304) will increase coverage by 1.64%.
The diff coverage is 95.37%.

@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
+ Coverage   85.66%   87.30%   +1.64%     
==========================================
  Files         137      137              
  Lines       11625    11367     -258     
==========================================
- Hits         9958     9924      -34     
+ Misses        931      724     -207     
+ Partials      736      719      -17     
Impacted Files Coverage Δ
jira/agile/api_client_impl.go 83.78% <0.00%> (-0.22%) ⬇️
jira/sm/api_client_impl.go 82.29% <84.37%> (+9.15%) ⬆️
jira/sm/internal/service_desk_impl.go 87.50% <86.66%> (-2.98%) ⬇️
pkg/infra/models/sm_request_field.go 96.44% <92.00%> (+2.05%) ⬆️
jira/sm/internal/approval_impl.go 96.49% <100.00%> (+6.01%) ⬆️
jira/sm/internal/attachment_impl.go 94.87% <100.00%> (+7.37%) ⬆️
jira/sm/internal/authentication_impl.go 100.00% <100.00%> (ø)
jira/sm/internal/comment_impl.go 95.06% <100.00%> (+3.75%) ⬆️
jira/sm/internal/customer_impl.go 100.00% <100.00%> (+9.75%) ⬆️
jira/sm/internal/feedback_impl.go 100.00% <100.00%> (+6.55%) ⬆️
... and 8 more

@ctreminiom ctreminiom merged commit 3650e72 into main Jun 25, 2023
@Fank Fank deleted the feature/sm-http-impl branch June 27, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change enhancement New feature or request
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

1 participant