How to update a item by slug?

Hello!
I have this but i read the documentation and i not have idea how to do

Controller:

async updateByslug(ctx) {
          const { slug} = ctx.params;

   console.log(slug);

  const response= await strapi.db.query('api::inventario-usa.inventario-usa').update({
    where: {
      Codigo:slug,
    },
  });
      }

Route:

{ // Path defined with a URL parameter
        method: 'PUT',
        path: '/inventario-usas/:slug',
        handler:'inventario-usa.updateByslug',
      }

Thanks

System Information
  • Strapi Version: 4.0
  • Operating System: Ubuntu
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version: