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

feat: Convert useInvoices from rest to GQL query #2920

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

ajay-sentry
Copy link
Contributor

Description

This PR aims to convert the useInvoices hook from calling the rest endpoint to the GQL query.

In the process of updating the tests, I've created a new mock invoice object which is the new "Source of Truth" for the invoice model. There were some deprecated fields that were removed in codecov/codecov-api#598 that I hope to remove from our other invoice mocks as the time comes.

Screenshots

Screenshots showing successful retrieval of the invoices locally with the updated hook

Screenshot 2024-06-05 at 10 27 04 AM
Screenshot 2024-06-05 at 10 27 14 AM

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Copy link

codecov-public-qa bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.45%. Comparing base (566b3ec) to head (4803f63).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2920   +/-   ##
=======================================
  Coverage   98.45%   98.45%           
=======================================
  Files         886      887    +1     
  Lines       13139    13177   +38     
  Branches     3507     3498    -9     
=======================================
+ Hits        12936    12974   +38     
  Misses        199      199           
  Partials        4        4           
Files Coverage Δ
src/services/account/useInvoices.ts 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (ø)
Pages 99.27% <ø> (-0.01%) ⬇️
Services 99.45% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (+<0.01%) ⬆️
UI 94.81% <ø> (+0.06%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 566b3ec...4803f63. Read the comment docs.

@codecov-notifications
Copy link

codecov-notifications bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2920   +/-   ##
=======================================
  Coverage   98.45%   98.45%           
=======================================
  Files         886      887    +1     
  Lines       13139    13177   +38     
  Branches     3512     3498   -14     
=======================================
+ Hits        12936    12974   +38     
  Misses        199      199           
  Partials        4        4           
Files Coverage Δ
src/services/account/useInvoices.ts 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (ø)
Pages 99.27% <ø> (-0.01%) ⬇️
Services 99.45% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (+<0.01%) ⬆️
UI 94.81% <ø> (+0.06%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 566b3ec...4803f63. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented Jun 5, 2024

Bundle Report

Changes will decrease total bundle size by 3.07kB ⬇️

Bundle name Size Change
gazebo-staging-array-push 6.85MB 3.07kB ⬇️

@codecov-qa
Copy link

codecov-qa bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.45%. Comparing base (566b3ec) to head (4803f63).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2920   +/-   ##
=======================================
  Coverage   98.45%   98.45%           
=======================================
  Files         886      887    +1     
  Lines       13139    13177   +38     
  Branches     3442     3517   +75     
=======================================
+ Hits        12936    12974   +38     
  Misses        199      199           
  Partials        4        4           
Files Coverage Δ
src/services/account/useInvoices.ts 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (ø)
Pages 99.27% <ø> (-0.01%) ⬇️
Services 99.45% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (+<0.01%) ⬆️
UI 94.81% <ø> (+0.06%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 566b3ec...4803f63. Read the comment docs.

Copy link

codecov bot commented Jun 5, 2024

Bundle Report

Changes will decrease total bundle size by 3.07kB ⬇️

Bundle name Size Change
gazebo-production-array-push 6.85MB 3.07kB ⬇️

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.45%. Comparing base (566b3ec) to head (4803f63).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##               main      #2920   +/-   ##
===========================================
  Coverage   98.45000   98.45000           
===========================================
  Files           886        887    +1     
  Lines         13139      13177   +38     
  Branches       3507       3522   +15     
===========================================
+ Hits          12936      12974   +38     
  Misses          199        199           
  Partials          4          4           
Files Coverage Δ
src/services/account/useInvoices.ts 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.23% <ø> (ø)
Pages 99.27% <ø> (-0.01%) ⬇️
Services 99.45% <100.00%> (+<0.01%) ⬆️
Shared 99.68% <ø> (+<0.01%) ⬆️
UI 94.81% <ø> (+0.06%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 566b3ec...4803f63. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jun 5, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
58eb8ec Wed, 05 Jun 2024 17:41:07 GMT Expired Expired
802c5ef Wed, 05 Jun 2024 17:56:04 GMT Expired Expired
4803f63 Thu, 06 Jun 2024 15:53:44 GMT Cloud Enterprise

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

currency: 'usd',
customerAddress: null,
customerName: 'Accounts Payable Codecov',
customerEmail: '[email protected]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to meet you Bob ✋

Copy link
Contributor

@RulaKhaled RulaKhaled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some quick tweaks to the schema and we're good to go

src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
src/services/account/useInvoices.ts Outdated Show resolved Hide resolved
periodEnd: z.number().nullable(),
periodStart: z.number().nullable(),
status: z.string().nullable(),
subtotal: z.number().nullable(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not nullable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d3feda3!

@ajay-sentry ajay-sentry added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 53391ea Jun 6, 2024
59 of 60 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/1471-convert-use-invoices branch June 6, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants