-
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
adding stripe modular example #29
base: main
Are you sure you want to change the base?
Conversation
Let's also add a readme file as in the rest of the examples |
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.
Added a few comments
@@ -0,0 +1,34 @@ | |||
module issuing |
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.
Looks like an odd module name. What would be the app component handling this called? "card-management""
define view_only: [user] or admin | ||
define transfer_analyst_in_test_mode: transfer_analyst but not transfer_analyst from test_mode # intermediate relations, just used for evaluating other relations | ||
|
||
define test_mode: [account] # self-defining relationship, used to set a type into a true/false state |
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.
We should explain in the comments what is test mode used for in Stripe
|
||
extend type account | ||
relations | ||
define card: [card] # dual-writes relationships between card & account, when you need to traverse relations on two types checking both ways (starting at card then going up or account then going down) |
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.
Can you clarify why we need to traverse it both ways?
## default spending limit is 500 USD a day | ||
## could be 100 USD per transaction | ||
## could be 3000 USD per month | ||
condition spending_limit(transaction_amount: double, transaction_limit: double, daily_amount: double, daily_limit: double, monthly_amount: double, monthly_limit: double) { |
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.
We should have tuples/tests that use the condition
Description
This example models a few of Stripe's core functionality, but not everything.
It introduces another modular models example splitting the model into 3 modules:
accounts.fga
- core Stripe account functionalitypayments.fga
- (yet to be implemented)issuing.fga
- credit card issuing and transactionsIt also introduces modeling concepts such as "self-defining" relationships, "dual-write" relationships, and "intermediate" relationships. It also uses exclusions and conditions.
It includes tests for two scenarios:
Review Checklist
main