-
Notifications
You must be signed in to change notification settings - Fork 88
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
chore(backend): match subresources by payment pointer #647
Conversation
Add abstract PaymentPointerSubresource model.
Add SubresourceQueryBuilder custom query builder. Add shared subresource tests.
Replace grant.includesAccess with findAccess. Store filtering clientId on request context. Add shared subresource GET route tests
What if we moved the following into the (What if we then moved everything out of the |
Add PaymentPointerSubresourceService interface.
Create fewer instances in shared pagination tests.
@@ -84,6 +84,7 @@ export type ClientKeysContext = Context<AppRequest<'keyId'>> | |||
export interface PaymentPointerContext extends AppContext { | |||
paymentPointer: PaymentPointer | |||
grant?: Grant | |||
clientId?: string |
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.
Isn't that also a property of grant
?
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.
Yes, but ctx.clientId
is now being defined in the auth middleware if the request has limited access to client-specific resources.
(instead of checking the grant in every relevant route)
Maybe it'd be clearer if we replace grant
here with grantId
, but also add a limits?: AccessLimits
(to be used in outgoing payment creation)?
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.
Maybe it'd be clearer if we replace grant here with grantId, but also add a limits?: AccessLimits (to be used in outgoing payment creation)?
Let's do that.
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.
I started making this change but it seems like it'll be a bit extensive, so I'd prefer addressing it as a separate issue:
if (paymentPointerId) { | ||
this.where( | ||
`${this.modelClass().tableName}.paymentPointerId`, | ||
paymentPointerId | ||
) | ||
} | ||
if (clientId) { | ||
this.byClientId(clientId) | ||
} |
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.
Is this doing two queries if paymentPointerId
and clientId
are given?
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.
No, this is all a single query builder that isn't executed until we await
https://vincit.github.io/objection.js/api/query-builder/#class-querybuilder
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.
Let's just get it in and fix potential issues later.
Apparently I should have merged I'll resolve this as a part of: |
* chore(backend): store grantId on quote Add abstract PaymentPointerSubresource model. * chore(backend): match subresources by payment pointer Add SubresourceQueryBuilder custom query builder. Add shared subresource tests. * chore(backend): distinguish read/read-all in auth middleware Replace grant.includesAccess with findAccess. Store filtering clientId on request context. Add shared subresource GET route tests * chore(backend): add list query to SubresourceQueryBuilder Add PaymentPointerSubresourceService interface. * chore(backend): add list to shared subresource tests * chore(backend): run pagination tests via shared subresource tests Create fewer instances in shared pagination tests. * chore(backend): abstract list routes
Changes proposed in this pull request
grantId
on quoteread
/read-all
(andlist
/list-all
) in auth middleware instead of routesPaymentPointerSubresource
model.Context
paymentPointer
to pagination tests #602Checklist
fixes #number