Releases: Samagra-Development/user-service
v2.3.2
v2.3.1
Description
This PR brings the enhancement to allow updating user's registration details along with support for updating 3rd party Hasura via config driven approach
Changes
- User's registration object can be patched
- 3rd party Hasura tables can be updated via config driven approach
PATCH /admin/updateUser/:userId
now accepts aregistrations
array in the request body:
...
"registrations": [
{
"applicationId": "xxxx",
"roles": [
"role 1",
"role 2",
"role nl"
],
"data": {
...
}
}
],
...
Checkout more on Fusion Auth docs, what all details can be passed in the array object: https://fusionauth.io/docs/v1/tech/apis/registrations#update-a-user-registration
PATCH /admin/updateUser/:userId
now accepts another array namedhasuraMutations
in the request body:
...
"hasuraMutations": [
{
"applicationId": "xxxx",
"mutation": "pre-defined mutation identifier as configured via generic API approach in `.env` file",
"payload": {
// payload needed by mutation
}
}
],
...
Generic config in the .env
file can be added like the example below:
APP_application_id_uuid='{
"host": "${FUSIONAUTH_BASE_URL}",
"hasura": {
"graphql_url": "http://example.com/v1/graphql",
"admin_secret": "my-hasura-admin-secret",
"mutations": {
"some-unique-mutation-identifier": "mutation someMutation($id: Int, $someKey: Int) {update_table(where: {id: {_eq: $id}}, _set: {some_key: $someKey}) {returning { id some_key } } }"
}
}
}'
Note: the value of the generic key APP_application_id_uuid must be a minified JSON. Example shown above is just for reference.
Generic APIs for PIN
Added Generic APIs for PIN
Changes
Added Login By Pin
Added Signup By Pin
Added CHange Password By Pin
Added refresh token API
Fixed issues with generic env variables causing docker-compose issues for application IDs
Added Generic APIs
Added Impl for Generic APIs
Changes
Created api module
Added impl for generic user service apis which are available
How to test
Postman Collection here
Revised Roles for Admin API
Merge pull request #27 from Samarth-HP/develop Added School as a role for admin api
Service Refactoring
Description
Exception Handling for http req within service and Code refactoring
Changes
- Added Exception Handling for inter service http req within the module for Admin rotes
- Code Refactored for FusionAuth Service
- Updated request body for Create User and Update User requests in Admin module
How to test
-
Sample Request - Create User:
curl --location --request POST '{{host-url}}/admin/createUser' \
--header 'Authorization: Bearer {{admin_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"registration": {
"applicationId": "1ae074db-32f3-4714-a150-cc8a370eafd1",
"preferredLanguages": [
"en"
],
"roles": [
"BPO"
],
"timezone": "Asia/Kolkata",
"username": "ra_dhay3",
"usernameStatus": "ACTIVE"
},
"user": {
"fullName": "test",
"data": {
"roleData": {
"block": "JHANDUTTA",
"designation": "BPO",
"district": "BILASPUR",
"geographic_level": "Block"
},
"phone": "8219781037",
"accountName": "test"
},
"preferredLanguages": [
"en"
],
"timezone": "Asia/Kolkata",
"usernameStatus": "ACTIVE",
"username": "ra_dhay3",
"mobilePhone": "8219781037",
"password": "himachal12345"
}
}'
Expected response:
Success
{
"registration": {
"applicationId": "1ae074db-32f3-4714-a150-cc8a370eafd1",
"preferredLanguages": [
"en"
],
"roles": [
"BPO"
],
"timezone": "Asia/Kolkata",
"username": "ra_dhay3",
"usernameStatus": "ACTIVE"
},
"user": {
"fullName": "test",
"data": {
"roleData": {
"block": "JHANDUTTA",
"designation": "BPO",
"district": "BILASPUR",
"geographic_level": "Block"
},
"phone": "8219781037",
"accountName": "test"
},
"preferredLanguages": [
"en"
],
"timezone": "Asia/Kolkata",
"usernameStatus": "ACTIVE",
"username": "ra_dhay3",
"mobilePhone": "8219781037",
"password": "himachal12345"
}
}
Error
{
"statusCode": 400,
"exception": {
"fieldErrors": {
"user.email": [
{
"code": "[duplicate]user.email",
"message": "A User with email [[email protected]] already exists."
}
]
}
}
}
Sample Request - Update User:
curl --location --request PATCH '{{host-url}}/admin/updateUser/d8308009-37c0-41ad-a60c-7542ec48e73f' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"roleData": {
"block": "block"
}
}
}'
Expected Response:
{
"responseCode": "OK",
"params": {
"responseMsgId": "7665009b-3744-4090-a5ca-fa5f582a3490",
"msgId": "27f2229b-64e3-45fc-9e52-1466a2eff240",
"err": "",
"status": "Success",
"errMsg": ""
},
"ts": "2022-05-12T04:55:12.951Z",
"id": "44c6599d-34ed-4223-9368-282098d8c2b0",
"result": {
"active": true,
"connectorId": "e3306678-a53a-4964-9040-1c96f36dda72",
"data": {
"roleData": {
"block": "block"
}
},
"id": "d8308009-37c0-41ad-a60c-7542ec48e73f",
"insertInstant": 1650636317539,
"lastLoginInstant": 1650636317631,
"lastUpdateInstant": 1652331313026,
"passwordChangeRequired": false,
"passwordLastUpdateInstant": 1650636317616,
"preferredLanguages": [
"en"
],
"registrations": [
{
"applicationId": "f0ddb3f6-091b-45e4-8c0f-889f89d4f5da",
"id": "f44b487d-8df8-4105-b706-e63e63183bd6",
"insertInstant": 1650636317629,
"lastLoginInstant": 1650636317631,
"lastUpdateInstant": 1650636317629,
"preferredLanguages": [
"en"
],
"timezone": "Asia/Kolkata",
"username": "test1234",
"usernameStatus": "ACTIVE",
"verified": true
}
],
"tenantId": "064458d0-dd05-e293-3709-a06cc6ca5ed7",
"timezone": "Asia/Kolkata",
"twoFactorDelivery": "None",
"twoFactorEnabled": false,
"username": "test1234",
"usernameStatus": "ACTIVE",
"verified": true
}
}
Please consider using the closing keyword if the pull request is proposed to
fix an issue already created in the repository
(https://help.github.com/articles/closing-issues-using-keywords/)
DST API Changes
Description
Updated the DST APIs with the new proposed changes and added API for trainee login.
Changes
Added Exception Handling for FusionAuth Responses
Added env variable for DST login API throttler
DST Login and Register API
Description
Updated the DST APIs with the new proposed changes and added API for trainee login.
Changes
Added Trainee login and register APIs
Updated Principal and Trainee login and register APIs
Added Exception handling and Data validation checks on input data
Updated Throttle policies for DST APIs
v2.1.2
- Added jwt strategy and jwt guard
- Added trainee login api for DST
- Enabled Role based access on routes
v2.1.1
- DST module: Added a Response transfromer for send otp request.