diff --git a/Node/real-estate/queries.js b/Node/real-estate/queries.js index 3405462..4b9923f 100644 --- a/Node/real-estate/queries.js +++ b/Node/real-estate/queries.js @@ -1,33 +1,38 @@ -const Pool = require('pg').Pool +const Pool = require("pg").Pool; const pool = new Pool({ - user: 'postgres', - host: 'localhost', - database: 'real_estate', - password: 'root', + user: "postgres", + host: "localhost", + database: "real_estate", + password: "root", port: 5432, }); const getAllRealEstate = (request, response) => { - pool.query('SELECT * FROM real_estate ORDER BY id DESC', (error, results) => { - if (error) { - throw error - } - response.status(200).json(results.rows) - }) + pool.query("SELECT * FROM real_estate ORDER BY id DESC", (error, results) => { + if (error) { + throw error; + } + response.status(200).json(results.rows); + }); }; +// We don't need the citizen_upn here? ** Temporary ** const insertRealEstate = (request, response) => { - const { address, area } = request.body + const { address, area, citizen_upn } = request.body; - pool.query('INSERT INTO real_estate (address, area) VALUES ($1, $2)', [address, area], (error, results) => { - if (error) { - throw error + pool.query( + "INSERT INTO real_estate (address, area, citizen_upn) VALUES ($1, $2, $3)", + [address, area, citizen_upn], + (error, results) => { + if (error) { + throw error; + } + response.status(201).send("done :)"); } - response.status(201).send('done :)') - }) -} + ); +}; module.exports = { getAllRealEstate, - insertRealEstate -} \ No newline at end of file + insertRealEstate, +}; diff --git a/React/real-estate/src/pages/components/Navbar.js b/React/real-estate/src/pages/components/Navbar.js index fde21c9..e42af5d 100644 --- a/React/real-estate/src/pages/components/Navbar.js +++ b/React/real-estate/src/pages/components/Navbar.js @@ -53,7 +53,7 @@ const Navbar = () => { className="text-white font-inter font-semibold hover:text-white focus:text-white tracking-normal mr-20" style={{ fontSize: "1.335rem" }} > - Your Real Estates + Your Real Estate