deactivate = async (user, req, res) => {
  let posts = await db.query('SELECT post_id FROM posts WHERE user=?', [user]),
    groups = await db.query('SELECT group_id FROM groups WHERE admin=?', [
      user,
    ]),
    cons = await db.query(
      'SELECT con_id FROM conversations WHERE user_one=? OR user_two=?',
      [user, user]
    ),
    dltDir = promisify(rmdir),
    QLusers = JSON.parse(req.cookies.users),
    filtered = QLusers.filter(u => u.id != user)

  // DELETE ALL POSTS
  posts.map(async p => {
    await deletePost({
      post: p.post_id,
      user,
      when: 'user',
    })
  })

  // DELETE ALL GROUPS
  groups.map(async g => {
    await deleteGroup(g.group_id)
  })
  await db.query('DELETE FROM group_members WHERE member=? OR added_by=?', [
    user,
    user,
  ])

  // DELETE ALL CONVERSATIONS
  cons.map(async c => {
    await deleteCon(c.con_id)
  })

  await db.query('DELETE FROM tags WHERE user=?', [user])
  await db.query('DELETE FROM favourites WHERE fav_by=? OR user=?', [
    user,
    user,
  ])
  await db.query('DELETE FROM follow_system WHERE follow_by=? OR follow_to=?', [
    user,
    user,
  ])
  await db.query(
    'DELETE FROM notifications WHERE notify_by=? OR notify_to=? OR user=?',
    [user, user, user]
  )
  await db.query('DELETE FROM profile_views WHERE view_by=? OR view_to=?', [
    user,
    user,
  ])
  await db.query(
    'DELETE FROM recommendations WHERE recommend_by=? OR recommend_to=? OR recommend_of=?',
    [user, user, user]
  )
  await db.query('DELETE FROM hashtags WHERE user=?', [user])

  DeleteAllOfFolder(`${root}/dist/users/${user}/`)
  await dltDir(`${root}/dist/users/${user}`)

  await db.query('DELETE FROM users WHERE id=?', [user])

  res.cookie('users', `${JSON.stringify(filtered)}`)
  req.session.reset()
}
Deactivates user
@param {user} user User to deactivate
@param {Object} req Express' Req object
@param {Object} res Express' Res Object