Samagra-Development / user-service

Additional Services related to user management in eSamwad
MIT License
5 stars 22 forks source link

Get User details with extra data from 3rd party Hasura #41

Open choxx opened 1 year ago

choxx commented 1 year ago

Description

For querying users where some data resides at Fusion Auth DB & rest at Hasura side.

Changes

GET /admin/user/:userId Use the existing devised generic approach; we'll add a new variable in env file JSON against the application ID with a new hasura Query, which will query & add a new fields in the response of this API. E.g. Request body:

{
    "hasuraMutations": [
        {
            "applicationId": "f0ddb3f6-091b-45e4-8c0f-889f89d4f5da",
            "mutation": "getTeacherDetail",
            "payload": {
                "user_id": "xxxx"
            }
        }
    ]
}

Response body:

{
    ...
    "hasuraMutations": [
        {
            "applicationId": "f0ddb3f6-091b-45e4-8c0f-889f89d4f5da",
            "mutation": "getTeacherDetail",
            "response": {
                ....
                // result from Hasura query
            }
        }
    ]
}

Open Questions:

  1. Does this approach makes sense?
  2. The above is existing GET API. We can pass the request payload as JSON (not sure if it is fine or not). Or, shall we add a new API (like POST /admin/user/:userId/getDetails) with request/response payload/body as mentioned above?