async function shouldCreateActivity(activity) {
  const activityModel = new Activity(activity);
  const err = activityModel.validateSync();
  if (err) {
    console.warn(`Failed to validate activity ${activity._id}`);
    console.log(activity);
    return false;
  }

  const foundActivity = await Activity.findById(activity._id);
  if (foundActivity) {
    console.log(`Already saved activity ${activity._id}`);
    return false;
  }

  return true;
}
/**
 * Should only create new Activity if it passes validation and
 * has not already been saved in the database
 *
 * @param {Object} activity
 * @return {Bool}
 */
Should only create new Activity if it passes validation and
has not already been saved in the database

@param {Object} activity
@return {Bool}
Should only create new Activity if it passes validation and has not already been saved in the database @param { Object } activity @return { Bool }
async function shouldCreateActivity(activity) {
  const activityModel = new Activity(activity);
  const err = activityModel.validateSync();
  if (err) {
    console.warn(`Failed to validate activity ${activity._id}`);
    console.log(activity);
    return false;
  }
  const foundActivity = await Activity.findById(activity._id);
  if (foundActivity) {
    console.log(`Already saved activity ${activity._id}`);
    return false;
  }
  return true;
}
async function shouldCreateActivity ( activity ) { const activityModel = new Activity ( activity ) ; const err = activityModel . validateSync ( ) ; if ( err ) { console . warn ( ` ${ activity . _id } ` ) ; console . log ( activity ) ; return false ; } const foundActivity = await Activity . findById ( activity . _id ) ; if ( foundActivity ) { console . log ( ` ${ activity . _id } ` ) ; return false ; } return true ; }
Should only create new Activity if it passes validation and
 has not already been saved in the database
Should only create new Activity if it passes validation and has not already been saved in the database