-
Notifications
You must be signed in to change notification settings - Fork 12
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
Change return type of QrCode query to better indicate errors #1512
base: master
Are you sure you want to change the base?
Conversation
564cafe
to
f7b634e
Compare
The unions may contain error types with detailed info
f7b634e
to
c1c8ecc
Compare
c1c8ecc
to
7ee08fb
Compare
@fhenrich33 I consider this completed from a BE perspective. Please check the first post about the different return types of the |
a7170c1
to
93beadb
Compare
Makes sense, will do! |
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.
Thanks @pylipp! Great PR until now.
code review
It passes, but some FYI for @fhenrich33 :
- Philipp changed the input variable name for
qrCode
andqrExists
query. We should check the places where we execute the query.
functional review
passes as well. This is the query I used to test:
{
qrExists(code: "093f65e080a295f8076b1c5722a46aa2")
qrCodeFail: qrCode(code: "093f65e080a295f8076b1c5722a46aa2") {
... on QrCode {
id
box {
... on Box {
labelIdentifier
}
... on InsufficientPermissionError {
name
}
... on UnauthorizedForBaseError {
name
organisationName
}
}
}
... on InsufficientPermissionError {
name
}
... on InsufficientPermissionError {
name
}
}
qrCodeValid: qrCode (code: "9d7f34fbea04de63b0acdfb874f3ef59") {
... on QrCode {
id
box {
... on Box {
labelIdentifier
}
... on InsufficientPermissionError {
name
}
... on UnauthorizedForBaseError {
name
organisationName
}
}
}
... on InsufficientPermissionError {
name
}
... on InsufficientPermissionError {
name
}
}
}
Signed-off-by: Felipe Henrich <[email protected]>
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.