Describe the task
Develop a new endpoint named 'current_user' in the FastAPI middleware. This endpoint should fetch the mapped user's information from the database, relying on the user token ID present in the auth token of the request header. The returned data should include comprehensive user information and the organization they belong to.
Purpose
To provide authenticated users with an efficient and secure way to access their complete profile information and associated organization details, enhancing user experience and streamlining data retrieval operations for frontend applications.
Acceptance Criteria
[ ] The endpoint is capable of extracting the user token ID from the auth token in the request header.
[ ] The system fetches the correct user information based on the extracted token ID from the database.
[ ] The response from the 'current_user' endpoint includes all user details and the associated organization's information.
[ ] Proper error handling is implemented, ensuring that invalid or unauthorized requests are promptly identified and appropriate responses are returned.
Additional context
Considering that the user token ID is sensitive information, it is essential to ensure that proper authentication and authorization checks are implemented before processing the request.
It would be beneficial to implement rate-limiting or throttling on this endpoint to prevent potential abuse or DDOS attacks.
Ensure the database queries are optimized for fast retrieval to maintain good response times for the endpoint.
Describe the task Develop a new endpoint named 'current_user' in the FastAPI middleware. This endpoint should fetch the mapped user's information from the database, relying on the user token ID present in the auth token of the request header. The returned data should include comprehensive user information and the organization they belong to.
Purpose To provide authenticated users with an efficient and secure way to access their complete profile information and associated organization details, enhancing user experience and streamlining data retrieval operations for frontend applications.
Acceptance Criteria
Additional context