src/controllers/socialController.js
/**
   * @description This add new user into database
   * @param  {object} profile - The user information
   * @returns  {object} The response object
   */
@description This add new user into database
@param  {object} profile - The user information
@returns  {object} The response object
@description This add new user into database @param { object } profile - The user information @returns { object } The response object
static async socialCreate(profile) {
    try {
      if (profile.provider === 'facebook') {
        return await User.create({
          user_name: profile.displayName,
          social_id: profile.id,
          provider: profile.provider,
          role: 'requester',
          isVerified: true
        }, { fields: ['user_name', 'social_id', 'provider', 'role', 'isVerified'] });
      }
      const [{ value }] = profile.emails;
      const { familyName, givenName } = profile.name;
      const userData = await User.create({
        user_name: profile.displayName,
        first_name: familyName,
        last_name: givenName,
        email: value,
        social_id: profile.id,
        provider: profile.provider,
        role: 'requester',
        isVerified: true
      }, { fields: ['user_name', 'first_name', 'last_name', 'email', 'social_id', 'provider', 'role', 'isVerified'] });
      return userData;
    } catch (ex) {
      throw new Error(ex);
    }
  }
static async socialCreate ( profile ) { try { if ( profile . provider === 'facebook' ) { return await User . create ( { user_name : profile . displayName , social_id : profile . id , provider : profile . provider , role : 'requester' , isVerified : true } , { fields : [ 'user_name' , 'social_id' , 'provider' , 'role' , 'isVerified' ] } ) ; } const [ { value } ] = profile . emails ; const { familyName , givenName } = profile . name ; const userData = await User . create ( { user_name : profile . displayName , first_name : familyName , last_name : givenName , email : value , social_id : profile . id , provider : profile . provider , role : 'requester' , isVerified : true } , { fields : [ 'user_name' , 'first_name' , 'last_name' , 'email' , 'social_id' , 'provider' , 'role' , 'isVerified' ] } ) ; return userData ; } catch ( ex ) { throw new Error ( ex ) ; } }
@description This add new user into database
 @param  {object} profile - The user information
 @returns  {object} The response object
@description This add new user into database @param { object } profile - The user information @returns { object } The response object