tenants
tenants copied to clipboard
Research integrating the Advocate Code system
The advocate code system allows a tenant user to be associated with an advocate user. When the tenant signs up, they'll be asked to enter the provided Advocate Code (see here for an example).
We want to append the advocate code to the provided link in the SMS content, i.e. https://www.justfix.nyc?q=samplecode
However, we can't know the length of the advocate code, which is a problem given our 160 character length of the SMS. So we'll probably want some sort of hash system or key-value mapping that would allow https:/www.justfix.nyc?q=1
where 1 => samplecode
Finally, when a user navigates to this link with the Advocate Code in the query string, we'll want to prepopulate the form with the code OR directly navigate the user to the post-code-entered state.
Hey Dan, Can you share few sample Advocate codes with me? Also, a snapshot of the Database column type(from MongoDB) that this field is mapped to? Thanks!
Angular detects the query string (?q=samplecode) Angular makes the call to validate the code If successful, we redirect to the Code Referral Landing Page
https://github.com/angular-ui/ui-router/wiki#resolve
- Detect queryString in
public/modules/core/config/core.client.config.js
(see line 43 for a different qs detection). - If theres a string, redirect to
/onboarding/referral
if($location.search().q) {
$location.path('/onboarding/referral');
}
- State logic in
public/modules/onboarding/config/onboarding.client.routes.js
has aresolve
that validates the query, then either renders the view with the advocate data or redirects to the general signup page (/signup
)
Pseudocode: https://gist.github.com/romeboards/894f3d1ed55fd2444a61f19cd474f28c
@kiranvalsia see attached for a comp of the new advocate landing page! thanks!!
Hi @kiranvalsia ! Thanks for the great work. Have you been able to test this yet by creating some sample advocate codes and tenant users?
Hi @romeboards . Actually, I am having trouble testing it on my local DB instance. I will send you more details tomorrow. Thanks.
Hi @kiranvalsia - please let me know and hopefully I can be of assistance!
Hi @romeboards So far, I have mock tested the flow by passing the advocate code in the UI (?code=123 appended to the URL) and the url gets routed to the new landing page.
As for DB, i start the local MongoDB instance and when I signup, I get success message on UI(Below is the screenshot). But no records are inserted in the DB. Can you tell me what I am missing? (which DB user,tables etc) so I can create some sample advocate codes and tenant users?
Alternatively, I was thinking to import the db tables into my local Mongo instance, so I could test the validation. What do you think?