-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappv2.js
75 lines (60 loc) · 2.35 KB
/
appv2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require('colors');
const fs = require('fs');
const AllController = require('./controller/AllController');
const {
inquirerMenu,
pausa,
leerInput
} = require('./helpers/inquirer');
const main = async () => {
console.clear();
const Controller = new AllController();
await Controller.connectAll('TG-62c0a9ed68929400137304bd-86979722')
.then(async (res) => {
console.log("Respuesta de connectAll: ", res);
})
.catch(async (error) => {
console.log("Error de connectAll: ", error);
});
let opt = '';
do {
opt = await inquirerMenu();
switch (opt) {
case '1':
await Controller.copyAmazonPrimeToWooyML(false)
.then(async (res) => {
console.log("Respuesta de copyAmazonPrimeToWooyML: ", res);
})
.catch(async (error) => {
console.log("Error de copyAmazonPrimeToWooyML: ", error);
});
break;
case '2':
const asin = await leerInput('Ingresa un ASIN para obtener la información:');
const producto = await Controller.getAmazonProducto(true, asin);
console.log('Producto obtenido de Amazon: '.italic.green, producto);
break;
case '3':
const mlcat = await leerInput('Ingresa un código de categoria de Mercadolibre:');
const info = await Controller.getMercadolibreCategories(mlcat);
console.log('Información de categoria: '.italic.green, info);
break;
//* Case para pruebas
case '98':
break;
case '99':
let p ={};
const name = await leerInput('Ingresa el nombre de una categoria:');
const code = await leerInput('Ingresa el código de la categoria:');
const id = await Controller.manejoCategoriasWoo({
nombre: name,
code
});
console.log('ID de categoria obtenido: ', id);
break;
}
await pausa();
console.clear();
} while (opt !== '0');
}
main();