You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
689 B
34 lines
689 B
//Mock de base de datos
|
|
const store = require("./store");
|
|
|
|
function addDevice(chip_id, product_id) {
|
|
return new Promise((resolve, reject) => {
|
|
if (!chip_id || !product_id) {
|
|
console.error(
|
|
"[deviceController]: No se cargaron todos los datos del disposivo!"
|
|
);
|
|
reject("No se cargaron todos los datos del dispositivo!");
|
|
}
|
|
|
|
const device = {
|
|
chip_id: chip_id,
|
|
product_id: product_id
|
|
};
|
|
|
|
//store.add(device);
|
|
resolve(store.add(device));
|
|
});
|
|
}
|
|
|
|
function getDevices(filterDevices) {
|
|
return new Promise((resolve, reject) => {
|
|
resolve(store.list(filterDevices));
|
|
});
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
addDevice,
|
|
getDevices,
|
|
|
|
};
|
|
|