-
Notifications
You must be signed in to change notification settings - Fork 10
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
[REFERENCE] feat: introduce Gateway Aggregation / Backend-for-Frontend abstraction via LearnerPortalBFFAPIView #572
base: main
Are you sure you want to change the base?
Conversation
fcb96e8
to
023a9d7
Compare
def get_request_id(): | ||
""" | ||
Helper to get the request id - usually set via an X-Request-ID header | ||
""" | ||
request = crum.get_current_request() | ||
if request is not None and request.headers is not None: | ||
return request.headers.get('X-Request-ID') | ||
else: | ||
return None |
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.
[inform] Replicated from here
023a9d7
to
4dabe51
Compare
…n via LearnerPortalBFFAPIView
4dabe51
to
52aa2d9
Compare
{ | ||
'uuid': subscription_license.get('uuid'), | ||
'status': subscription_license.get('status'), | ||
'user_email': subscription_license.get('user_email'), | ||
'activation_date': subscription_license.get('activation_date'), | ||
'last_remind_date': subscription_license.get('last_remind_date'), | ||
'revoked_date': subscription_license.get('revoked_date'), | ||
'activation_key': subscription_license.get('activation_key'), | ||
'subscription_plan': subscription_license.get('subscription_plan', {}), | ||
} |
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.
[inform] Extract only the fields the frontend really needs.
and customer_agreement.get('net_days_until_expiration') > 0 | ||
) | ||
idp_or_univeral_link_enabled = ( | ||
# TODO: IDP from customer |
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.
Description
[Context] Tech Spec
This PR introduces the
LearnerPortalBFFAPIView
as part of a new Gateway Aggregation / Backend-for-Frontend (BFF) abstraction. This new view aims to simplify the interaction between the frontend and multiple backend services, enhancing the overall architecture and making it easier to manage and extend.Key features
High-level overview
LearnerPortalBFFAPIView
exposes a POST API endpoint with a dynamicpage_route
route parameter.HandlerContext
, passing the originatingrequest
andpage_route
as attributes. TheHandlerContext
is responsible for keeping a shared data structure that the route handlers can mutate while loading/processing data. It also exposes anadd_error
helper method for route handlers to use to aggregate errors. This shared context is passed to the appropriate route-specific handler (e.g.,DashboardHandler
). The route handler's implementedload_and_process
method is called, which mutates the shared context for the route handler.LearnerDashboardResponseBuilder
), which exposes a.build()
method called, extracting the pertinent metadata from the shared context object to return in the response. This is a clean separation of concerns between loading/processing dependent data vs. creating the desired response structure.Response
.Jira
ENT-9427
Merge checklist:
./manage.py makemigrations
has been runPost merge: