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.
 
 
 

41 lines
795 B

const { database } = require('../database.backup');
const createConfigIp = (ipname) => {
const query = database.prepare('INSERT INTO ipconfig (ipname) VALUES (?)');
try {
let response = query.run(ipname)
return response;
} catch (error) {
return error;
}
}
const getIPConfig = async () => {
try {
let response = await database.prepare('SELECT * FROM ipconfig WHERE id = ?').get(1);
return response;
} catch (error) {
return error
}
}
const updateIPConfig = async (id, name) => {
let query = database.prepare('UPDATE ipconfig SET ipname = ? WHERE id = ?');
try {
let response = await query.run(name, id);
return response;
} catch (error) {
return error;
}
}
module.exports = {
createConfigIp,
getIPConfig,
updateIPConfig
}