-
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
feat: add bff handler context #577
Conversation
f7187a5
to
0ab0b2d
Compare
0ab0b2d
to
609dc3f
Compare
self.enterprise_customer_uuid = None | ||
self.lms_user_id = 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.
Note: Something I considered but deferred on is the inclusion of url and params as a means of populating the enteprise_customer_uuid
or lms_user_id
within the HandlerContext
. This would also help improve traceback of warnings/errors to specific calls within the BFF layer.
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] I agree. From our synchronous discussion, we could likely move the initialize_common_context_data
from the reference prototype's BaseHandler
into the HandlerContext
so the route/base handler's themselves don't need to worry about it.
Edit: as you proposed, this change could also be deferred for this PR and saved for your next ticket to bring in the actual handlers to populate the HandlerContext
.
def create(self, validated_data): | ||
return validated_data | ||
|
||
def update(self, instance, validated_data): | ||
return validated_data |
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.
609dc3f
to
c8f5ed6
Compare
developer_message = serializers.CharField() | ||
user_message = serializers.CharField() | ||
|
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.
Note: Something I considered but deferred on was to serialize the request url and params as part of exposing pertinent metadata within the errors for better observability.
c8f5ed6
to
6c8feef
Compare
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 good, small suggestion.
70e7b82
to
256b217
Compare
Accidentally approved, instead of only leaving comments.
256b217
to
8a3fef0
Compare
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.
LGTM!
8a3fef0
to
935e567
Compare
Description:
This application, bffs, has been added to enterprise-access. bff stands for "backend-for-frontend" and is designed to provide a consolidated API layer for supporting enterprise micro frontends (MFEs). The bffs application serves as an intermediary between frontend components and underlying services, centralizing business logic and data transformation within a single BFF layer. This approach aims to streamline data returned to the frontend, minimizing the need for additional transformation on the client side, and enabling frontend components to consume data in a more ready-to-use format.
Additionally, this PR introduces a HandlerContext component. HandlerContext will store the instantiated requests originating from API client calls, preparing them to be utilized by an upcoming response builder, designed to construct responses for each corresponding API call.
Each MFE will support route-based API calls, allowing for flexible orchestration of the frontend. This structure enables individual MFEs to manage route-specific API calls, ensuring a seamless flow between frontend routes and backend data, optimized for MFE interactions and reducing redundant API calls across the application.
Jira:
ENT-XXXX
Merge checklist:
./manage.py makemigrations
has been runPost merge: