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

docs: BFF ADR #1238

Merged
merged 4 commits into from
Jan 6, 2025
Merged

docs: BFF ADR #1238

merged 4 commits into from
Jan 6, 2025

Conversation

brobro10000
Copy link
Member

ADR for the frontend integration of the backend for frontend API call and and overview of resulting changes.

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)
  • Ensure English strings are marked for translation. See documentation for more details.

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.00%. Comparing base (337a7b4) to head (cc2a2e1).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1238      +/-   ##
==========================================
- Coverage   89.05%   89.00%   -0.06%     
==========================================
  Files         401      403       +2     
  Lines        8708     8729      +21     
  Branches     2123     2125       +2     
==========================================
+ Hits         7755     7769      +14     
- Misses        912      918       +6     
- Partials       41       42       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brobro10000 brobro10000 force-pushed the hu/ent-BFF-ADR branch 2 times, most recently from b407cf4 to 333adae Compare December 17, 2024 17:57
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
Comment on lines +33 to +34
- [Gateway Aggregation pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/gateway-aggregation)
- [Backends for Frontends pattern](https://learn.microsoft.com/en-us/azure/architecture/patterns/backends-for-frontends)
Copy link
Member

Choose a reason for hiding this comment

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

Nice

docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
Comment on lines 47 to 55
- `useSubscriptions` ([source](https://github.com/openedx/frontend-app-learner-portal-enterprise/blob/337a7b44d94d8be5d9233e80e2fa0e2de72d165c/src/components/app/data/hooks/useSubscriptions.js#L11))
- This is the simplest implementation of migrating existing React query custom hooks to utilize the BFF. It passes an object representing
fields typically passed within `useQuery` for the BFF query call within `bffQueryConfig`. This includes the transform to match the
data structure of the existing `useSubscriptions` non-BFF call to `useBFF` within an object when making a call to the BFF query. It also passes
the original arguments for making a query call within `useSubscriptions` passed within `useQuery` as a `fallbackQueryConfig` object within `useBFF`.
- This structure allows the developer to continue using the original hooks as implemented.
- `useEnterpriseCourseEnrollments` ([source](https://github.com/openedx/frontend-app-learner-portal-enterprise/blob/337a7b44d94d8be5d9233e80e2fa0e2de72d165c/src/components/app/data/hooks/useEnterpriseCourseEnrollments.js#L36))
- The modifications required to make this current hook utilize the original `useEnterpriseCourseEnrollments` hook and
the `useBFF` layer required specific options to be passed in depending on the modified hooks downstream related to `enterpriseCourseEnrollments`.
Copy link
Member

Choose a reason for hiding this comment

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

nit: the "Custom query hooks modified" list item is still nested under the useBFF list item versus being a sibling to useBFF list item.

Given these hooks call useBFF, it still doesn't quite make sense to have them nested under the useBFF list item, as a sibling to resolveBFFQuery (i.e., resolveBFFQuery is called within useBFF, but the hooks aren't called within useBFF).

docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
- Within `resolveBFFQuery` ([source](https://github.com/openedx/frontend-app-learner-portal-enterprise/blob/337a7b44d94d8be5d9233e80e2fa0e2de72d165c/src/components/app/data/queries/utils.js#L11))
- Whether a customer is eligible to use the BFF API call by either being explicitly enabled via the configuration API as a defined `enterpriseUuid`,
or an individual customer has been selected to resolve the dashboard page with the BFF loader with a gradual rollout process via a Waffle flag.
- Whether the current route the user is on is eligible to make the BFF call, if so, return the query required to call the BFF.
Copy link
Member

Choose a reason for hiding this comment

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

I think this comment still remains; the "eligibility" above pertains to whether the BFF should be considered based on the feature flags, but I was hoping to clarify the "eligibility" here pertaining to the current page route having a "corresponding BFF API endpoint that exists".

docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
docs/decisions/0013-backend-for-frontend-api.md Outdated Show resolved Hide resolved
@brobro10000 brobro10000 merged commit 0bae540 into master Jan 6, 2025
5 of 6 checks passed
@brobro10000 brobro10000 deleted the hu/ent-BFF-ADR branch January 6, 2025 18:56
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.

2 participants