Closed pylipp closed 4 days ago
@fhenrich33 I consider this completed from a BE perspective. Please check the first post about the different return types of the qrCode
query and the QrCode.box
field. Overall, the logic in useQrResolver
needs a major rework now :sweat_smile: let me know how it goes for you. I could already adjust queries.ts
though.
Since the changes in the GraphQL API break FE, I suggest you continue to work on it on the same branch, what do you think?
@fhenrich33 I consider this completed from a BE perspective. Please check the first post about the different return types of the
qrCode
query and theQrCode.box
field. Overall, the logic inuseQrResolver
needs a major rework now 😅 let me know how it goes for you. I could already adjustqueries.ts
though. Since the changes in the GraphQL API break FE, I suggest you continue to work on it on the same branch, what do you think?
Makes sense, will do!
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 84.33%. Comparing base (
5caa2d9
) to head (2388dd8
). Report is 24 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@fhenrich33 I'll merge master into this branch and try to resolve the conflict in the mutations.graphql
file.
@pylipp By the way the tests that are failing doesn't reflect what actually happens in the real app, I didn't figure out a way to fix them yet. cc @HaGuesto
The failing tests:
3.4.3.5 QrReaderMultiBox.test.tsx
AssertionError: expected "spy" to be called with arguments: [ ObjectContaining{…} ]
Received:
1st spy call:
Array [
- ObjectContaining {
- "message": StringMatching /have permission to access this box/i,
+ Object {
+ "message": "QR code lookup failed. Please wait a bit and try again.",
},
]
3.4.8.7 ResolveHash.test.tsx
TestingLibraryElementError: Unable to find an element by: [data-testid="ReturnScannedQr"]
3.4.2.2 QrReaderOverlay.test.tsx
TestingLibraryElementError: Unable to find role="heading" and name "/bases/1/boxes/123"
3.4.2.5b QrReaderOverlay.test.tsx
AssertionError: expected "spy" to be called with arguments: [ ObjectContaining{…} ]
Received:
1st spy call:
Array [
- ObjectContaining {
- "message": StringMatching /No box found for this QR code/i,
+ Object {
+ "message": "QR code lookup failed. Please wait a bit and try again.",
},
]
@pylipp this PR is ready to be merge. Pls do so when you think it is the right time.
The unions may contain error types with detailed info. I hope the following table clarifies how to deal with the response of the query https://github.com/boxwise/boxtribute/blob/change-qrcode-query-interface/front/src/queries/queries.ts#L38-L66
qr:read
permission (e.g. a label-creation user)FORBIDDEN
BAD_USER_INPUT
stock:read
permissionstock:read
permission BUT NOT for the base that the requested box is inNote how currently the cases 1, 3a, 3b cannot be distinguished.
Also with the new interface design now in case of 3b information about the base/org of the box can be displayed.