Commit 3045fac3 authored by Geovanny's avatar Geovanny

Delete house query fixed

parent 79eee266
...@@ -87,16 +87,16 @@ model.modifyHouse = async(house_id, body) => { ...@@ -87,16 +87,16 @@ model.modifyHouse = async(house_id, body) => {
await db.pool.query(sql_text, [house_id]); await db.pool.query(sql_text, [house_id]);
}; };
model.deleteHouse = async(house_id, liege_id) => { model.deleteHouse = async(house_id) => {
const sql_text = 'DELETE FROM houses WHERE id = ?;'; const sql_text = 'UPDATE users SET lk_house_role = NULL where house_id = ?';
const sql_text2 = 'UPDATE users SET lk_house_role = NULL where id = ?;' const sql_text2 = 'DELETE FROM houses WHERE id = ?;';
let con = await db.pool.getConnection(); let con = await db.pool.getConnection();
await con.query('START TRANSACTION;'); await con.query('START TRANSACTION;');
await con.query(sql_text, [house_id]); await con.query(sql_text, [house_id]);
await con.query(sql_text2, [liege_id]); await con.query(sql_text2, [house_id]);
await con.query('COMMIT;'); await con.query('COMMIT;');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment