const { exec } = require("node:child_process")

class UpdateCategoriesUseCase {
  execute() {
    return new Promise((_, reject) => {
      exec(`bin/gcf1dbmng.sh etc urldb_update`, { cwd: '/usr/local/gcf1' }, (error, stdout, stderr) => {
        if (error) {
          console.error(error);
          reject(error);
          return;
        }

        console.log(stdout)
      });
    });
  }
}

module.exports = { UpdateCategoriesUseCase }

