-
Notifications
You must be signed in to change notification settings - Fork 11
Organization Onboarding
zaven edited this page Oct 8, 2020
·
5 revisions
Planter records are created in the planter table each time a new planter identifier (email or phone number) is used to log into the app. Every planter record needs to be linked to an existing or newly created entity record with person type. Often this needs to be done when planters belonging to a particular planting organizing join the platform, and need to be connected to their parent organization.
- Check in entity table for existing entity with matching identifier used by planter record
- If not matching entity exists, create new entity
- Use type = 'p' for 'person'
- copy first name, last name, and email or phone number from planter record
- Assign planter.person_id to the id of this entity
Connecting new person records to correct parent organization by inserting into entity_relationship table
The entity_relationship table stores organizational hierarchies used by various systems. We want to assign a given entity to the correct parent organization by creating a record in this table.
- Find id of child entity (for instance a planter)
- Find id of parent entity (this will be identified on a per planter basis by operations team or special data about the planter records)
- Insert new record into entity_relationship table
- type will be indicated by operations team. type describes a group of hierarchical relationships and must be shared between all records describing a hierarchy to link the tiers in that particularly organizational structure.
- role is the particular role of the child with respect to the parent for each entry in entity_relationship
11:42 3. Creating new admin_role descriptions when necessary