init project

This commit is contained in:
daniel muniz
2024-06-05 18:15:03 -03:00
commit 6d4e9bb221
6 changed files with 255 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
const { exec } = require("node:child_process")
class GetCategoryUseCase {
constructor({categoriesMapping}) {
this.categoriesMapping = categoriesMapping
}
execute(domain) {
exec(`echo ${domain} | bin/gcf1check.sh etc check_categorize_hybrid`, { cwd: '/usr/local/gcf1' }, (error, stdout, stderr)=>{
if (error) {
console.error(error)
return
}
const outputParts = stdout.split(/\s+/); // Split by whitespace
if (outputParts[3]) {
const categoryId = outputParts[2];
console.log({ categoryId });
} else {
console.log({ error: 'Category ID not found' });
}
})
}
}
module.exports = { GetCategoryUseCase }