IBFEC-38 – Backend - Save infos on Singup user
Questions:
Possibles questions about this feature
Technical Refinement
Description
SignUp
Create a feature flag:
enable-required-acceptance-agreement-info
intl-user-service:
First, will add the new attribute on graphql:
path:
intl-user-service/src/graphql/schema.graphql
input SignUpUserInput { ... requiredAcceptanceAgreementInfo: [RequiredAcceptanceAgreementInfo!] }
input RequiredAcceptanceAgreementInfo { id: String! updatedAt: String! }
After that, we will need to run the command to create graphql dependencies:
On file:
intl-user-service/src/graphql/graphql.ts
, probably, will be many changes, but we can to discard all, except of change locally in the interfaceSignUpUserInput
Now, we will add the new attribute on class
SignupRequestDto
:path:
intl-user-service/src/users/dtos/users.dtos.ts
On file:
intl-user-service/src/verification/utils.ts
, we will need to create a mapper:We will add the
requiredAcceptanceAgreementInfo
in the callthis.signupFacade.signUp
:path:
intl-user-service/src/verification/verification.legacy-resolver.ts
We will need to add the
requiredAcceptanceAgreementInfo
of the destructuring fromrequestDto
by methodsignUpUser
:path:
intl-user-service/src/users/user-signup.service.ts
In the same method
signUpUser
, we will add therequiredAcceptanceAgreementInfo
attributesignupCognito
object:And add the
requiredAcceptanceDocumentInfo
attribute on typeSignUpCognitoType
To this point, the cognito client will be call as method
this.cognitoClient.signUp
, to save the information in cognito (onlyattributes
information), how our attribute is onclientMetadata
, it won’t save in cognito, just on dynamodb. When the information is saved on cognito, will be call thePreSignupService
through a gateway.In this step, we won’t be able to test 'cause the gateway call. We will need to mock some data to test: https://rbictg.atlassian.net/wiki/spaces/IN/pages/4040164203/Terms+and+Conditions+-+Technical+Refinement#MOCKS
After that, we will need to add the
requiredAcceptanceAgreementInfo
attribute of the destructuring on methodpreSignupHandler
path:
intl-user-service/src/cognito-lambdas/pre-signup.service.ts
And after, add the
requiredAcceptanceAgreementInfo
onthis.usersRepository.create
We will need to add too on interface
ICreateUser
:path:
intl-user-service/src/core/users.repository.ts
In the same file on method
mapCreateUserToUserItem
, we will add also therequiredAcceptanceAgreementInfo
attribute:and on
const userItem:
Now, will add the new attribute on
IUserDetails
interface:
intl-packages:
Inside
intl-packages/packages/users/,
We will need to run the command to createintl-user-service
dependencies:We will need to add the
requiredAcceptanceAgreementInfo
attribute on interfaceIUserSignup
path:
intl-packages/packages/users/src/schemata.ts
Also, we will add the
requiredAcceptanceDocumentInfo
of the destructuring fromiUserSignup
:path:
intl-packages/packages/users/src/services/user-service/user-service-client.ts
And we will include the
requiredAcceptanceDocumentInfo
as the parameteriSignupRequest
to callsignUpUser
fromintl-user-service
intl-whitelabel-graphql:
First, we need to update the
intl-packages
version, running the command:Many packages will be updated, we can to discard all, except of change version
"@rbilabs/users"
locallyintl-whitelabel-graphql/package.json
We will need to add a new attribute:
requiredAcceptanceAgreementInfo: Boolean
on inputSignUpUserInput
path:
intl-whitelabel-graphql/src/functions/graphql/schemas/users.gql
After that, we will need to run the command to create graphql dependencies:
On file:
intl-whitelabel-graphql/src/functions/graphql/generated/graphql.ts
, probably, will be many changes, but we can to discard all, except of change locally in the interfaceISignUpUserInput
We will need to add too, the same attribute on interface
IUserSignup
path:
intl-whitelabel-graphql/src/functions/graphql/providers/users.ts
On method
signUpUser
, we will add therequiredAcceptanceAgreementInfo
of the destructuring from input:path:
intl-whitelabel-graphql/src/functions/graphql/providers/users.ts
After that, we will need to attribute
requiredAcceptanceAgreementInfo
on the call methodthis.userClientSignUp
Sanity
rbi-whitelabel-cms:
We will add a new field:
path:
rbi-whitelabel-cms/schemas/appData/documents/staticPage.tsx
intl-whitelabel-app:
We will need to run the command to create rbi-graphql dependencies:
On file:
intl-whitelabel-app/workspaces/frontend/src/generated/rbi-graphql.tsx
will be many changes, but we can to discard all, except of change locally in the interfaceISignUpUserInput
:
Get Sanity
_updatedAt
Now, we will create a new constant:
path:
intl-whitelabel-app/workspaces/frontend/src/remote/queries/static-page.ts
We will change the parameters of the hook
path:
intl-whitelabel-app/workspaces/frontend/src/state/static-page-manager/hooks/use-static-page-routes.ts
before
after
And will change the call from
GetStaticPageRoutesQuery
to_queryStaticPage
before
after
We will need to get the
_updatedAt
from sanity, for it, we will create a function:path:
intl-whitelabel-app/workspaces/frontend/src/state/auth/hooks/use-account-authentication.ts
And import the hooks:
And add the useEffect:
In the same file, we will need to call
signUpMutation
, on methodsignUp
, sending the new attributerequiredAcceptanceAgreementInfo
Screenshots
TODO - images or links to images about this feature
POC
TODO - POC used to concept proof
Impact Analysis
All signup flow
Unit Test
Update the unit tests:
intl-whitelabel-app/workspaces/frontend/src/state/auth/hooks/use-account-authentication.test.ts
MOCKS
To mock:
path:
intl-user-service/src/users/user-signup.service.ts
On
constructor
classSignupInitializer
, we will addprivate readonly preSignupService: PreSignupService
And will replace all method
signUpUser
to:In the same file on class
UserSignupService
, we will change theconstructor
On file
intl-user-service/src/users/users.module.ts
, we will add the service on@Module
in the end fileAfter, we will call the
signUp
mutation from https://studio.apollographql.com/sandbox/explorer, just start the intl-user-service and callsignUp
Useful Links
Existent behavior: https://rbictg.atlassian.net/wiki/spaces/IN/pages/4044391349