Member CRM
March 15th, 2021
Description

This feature is a revamp to the existing positions to make it more manageable and analyzable.

Back-end

There is the MemberPosition model which contains the detail of each position. It has 3 states - active, completed and terminated. Each position has a role, function and department assigned to an office along with the start and end date for the responsibility. If a position is terminated, a reason has to be provided.

Front-end

There are create and terminate mutations as well as queries to fetch one, all or download the positions.

The functions, roles, exit reasons and degree level can be queried using the Constants query. The type_id are function, role, exit_reason, study_level. The id from this query is the value for role_id, function_id and exit_reason_id in the mutations. A sample query is below.

query{
  allConstants(type_id: "role"){
    id
    name
  }
}


Mutations

1. memberPositionCreate - This is used to create a position. Please note that  reports_to_position_id is required for everyone other than president.

For department, there are two arguments committee_department_name and committee_department_id . When adding LCVP initially, use committee_department_name and when adding LCVP to an existing department section, use committee_department_id. 

reports_to_position_id is the member position of the person who reports to. If the role is for a VP, then the reports_to_position_id will be the id of the member_position object for the President.

Note: focus_products field is dependent on function field. for selective functions focus product applicable. For this, look for the key called has_focus_products in functions response(allConstants). This will return "true" or "false". Based on this value show the focus product input.

mutation {
  memberPositionCreate(member_position: {function_id: 11638, role_id: 11648, office_id: 630, start_date: "01-02-2021", end_date: "31-07-2021", reports_to_position: 12, invite_person: {first_name: "super", last_name: "man", home_lc_id: 630, email: "sajin+1023@commutatus.com"}}) {
    id
  }
}

2. memberPositionUpdate - Update the position. Has the same params as create.

mutation {
  memberPositionUpdate(id: 1, member_position: {role_id: 11645, office_id: 1585}) {
    id
  }
}

3. memberPositionTerminate - Used to terminate a member position. Exit reason id is required. The id can be obtained from constants with type_id exit_reason. Sample constant query above. If the exit reason is Other, then other_exit_reason has to be provided.

mutation {
  memberPositionTerminate(id: 1, exit_reason_id: 11667, other_exit_reason: "Just for fun") {
    id
    status
    exit_reason {
      name
    }
    other_exit_reason
    terminated_at
    terminated_by {
      id
    }
  }
}

Queries

1. memberPosition - This fetches a single member position. Id is required

query {
  memberPosition(id: 1) {
    id
  }
}

2. memberPositions - This query fetches all member positions and is used for analytics. Filters are available. The columns to sort by are ["gender", "no_of_ixps", "is_ixp", "status", "start_date", "dob", "end_date", "office_name", "exit_reason", "role", "department_department", "study_levels", "reports_to_name", "full_name", "function_name"]


query {
  memberPositions(filters: {status: ["terminated"]}) {
    paging {
      total_items
    }
    data {
      id
    }
  }
}

3. memberPositionsDownload - This query adds an export task which will be sent to the email id of the requesting person. All the available columns are in the query. The filters can be applied here as well.

query {
  memberPositionsDownload(columns: ["position_id", "position_title", "position_skills", "position_gender", "position_no_of_ixps", "position_ixp_products", "position_is_ixp", "position_languages", "position_status", "position_start_date", "position_backgrounds", "position_date_of_birth", "position_end_date", "position_office", "position_phone", "position_exit_reason", "position_role", "position_department", "position_study_level", "position_reports_to", "position_full_name", "position_email"])
}

4. committee - A new API to return member_positions has been added.

query{
  committeeTerms(id: 630){
    id
    name
    member_position{
      id
    }
    committee_departments{
      total_count
      edges{
        node{
          id
          name
          member_positions{
            edges{
              node{
                id
              }
            }
          }
        }
      }
    }  
  }
}

query{
  committeeTerm(id: 630, term_id: 11471){
    id
    name
    member_position{
      id
    }
    committee_departments{
      edges{
        node{
          id
          name
          member_positions{
            total_count
            facets
            edges{
              node{
                id
                role{
                  name
                }
              }
            }
          }
        }
      }
  }
  }
}

5. VP count in Department accordion - To get the VP count, refer facets objects inside member_positions object. 

facets - {21755=>8, 21756=>187} . 21755 is role_id. use local storage for role_id and 8 is total count. 
for AI - use role AIVP, for Region use role RD, for MC use role MCVP. and for LC use role LCVP. 
X
Crafted by