toHashtag = async (str, user, post) => {
  let hashtags = str.match(/[^|\s]?#[\d\w]+/g)

  if (hashtags) {
    for (let h of hashtags) {
      let hash = h.slice(1)
      if (hash.substr(0, 1) !== '#') {
        let newHashtag = {
          hashtag: h,
          post_id: post,
          user: user,
          hashtag_time: new Date().getTime(),
        }
        await query('INSERT INTO hashtags SET ?', newHashtag)
      }
    }
  }
}
Insert hashtags when post is created
@param {String} str Text which will be used to get hashtags
@param {Number} user UserID
@param {Number} post PostID