text: import { publishVersion } from '@apps/maha/services/versions'
  import Website from '@apps/websites/models/website'
  import socket from '@core/services/routes/emitter'
  import Menu from '@apps/websites/models/menu'
  
  const publishRoute = async (req, res) => {
  
    const website = await Website.query(qb => {
      qb.where('id', req.params.website_id)
    }).fetch({
      transacting: req.trx
    })
  
    if(!website) return res.status(404).respond({
      code: 404,
      message: 'Unable to load website'
    })
  
    const menu = await Menu.query(qb => {
      qb.where('team_id', req.team.get('id'))
      qb.where('website_id', website.get('id'))
      qb.where('id', req.params.id)
    }).fetch({
      transacting: req.trx
    })
  
    if(!menu) return res.status(404).respond({
      code: 404,
      message: 'Unable to load menu'
    })
  
    await publishVersion(req, {
      versionable_type: 'websites_menus',
      versionable_id: menu.get('id'),
      key: 'config'
    })
  
    await socket.refresh(req, [
      `/admin/websites/websites/${website.get('id')}/menus`,
      `/admin/websites/websites/${website.get('id')}/menus/${menu.get('id')}`,
      `/admin/websites/websites/${website.get('id')}/menus/${menu.get('id')}/versions`
    ])
  
    await res.status(200).respond(true)
  
  }
  
  export default publishRoute
  