This commit is contained in:
omkieit 2024-09-19 17:05:14 +05:30
parent 0b6366a6ac
commit 1549c32eb6
12 changed files with 869 additions and 48 deletions

View File

@ -1,6 +1,7 @@
import mysql from "mysql2"; import mysql from "mysql2";
// MySQL connection setup (you can move this to a separate config file if needed)
const db = mysql.createConnection({ const db = mysql.createConnection({
host: "db-mysql-nyc1-99306-do-user-12431193-0.b.db.ondigitalocean.com", host: "db-mysql-nyc1-99306-do-user-12431193-0.b.db.ondigitalocean.com",
user: "doadmin", user: "doadmin",
@ -10,6 +11,15 @@ const db = mysql.createConnection({
connectTimeout: 20000, // 20 seconds connectTimeout: 20000, // 20 seconds
}); });
// const db = mysql.createConnection({
// host: "localhost",
// user: "root",
// password: "root",
// database: "estates",
// port: "3306",
// connectTimeout: 20000, // 20 seconds
// });
// Connect to MySQL database // Connect to MySQL database
db.connect((err) => { db.connect((err) => {
if (err) { if (err) {
@ -20,13 +30,33 @@ db.connect((err) => {
}); });
// Controller function // Controller function
// export const searchMySQL = (req, res) => {
// const q = "SELECT * FROM client_information";
// // const q = "SELECT * FROM home_information";
// db.query(q, (err, data) => {
// if (err) {
// console.log(err);
// return res.status(500).json({ error: "Database query failed" });
// }
// return res.json(data);
// });
// };
export const searchMySQL = (req, res) => { export const searchMySQL = (req, res) => {
const q = "SELECT * FROM client_info"; const limit = parseInt(req.query.limit) || 10; // Default to 10 items per page
const offset = parseInt(req.query.offset) || 0; // Default to the first page
const q = `SELECT * FROM home_information LIMIT ${limit} OFFSET ${offset}`;
db.query(q, (err, data) => { db.query(q, (err, data) => {
if (err) { if (err) {
console.log(err); console.log(err);
return res.status(500).json({ error: "Database query failed" }); return res.status(500).json({ error: "Database query failed" });
} }
// Set cache-control headers to prevent caching
res.set('Cache-Control', 'no-store');
return res.json(data); return res.json(data);
}); });
}; };

332
ef-api/package-lock.json generated
View File

@ -21,6 +21,7 @@
"mysql": "^2.18.1", "mysql": "^2.18.1",
"mysql2": "^3.11.3", "mysql2": "^3.11.3",
"nodemailer": "^6.9.14", "nodemailer": "^6.9.14",
"nodemon": "^3.1.5",
"uuid": "^10.0.0" "uuid": "^10.0.0"
} }
}, },
@ -61,6 +62,19 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
"license": "ISC",
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/array-flatten": { "node_modules/array-flatten": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
@ -76,6 +90,12 @@
"node": ">= 6.0.0" "node": ">= 6.0.0"
} }
}, },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/basic-auth": { "node_modules/basic-auth": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
@ -109,6 +129,18 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/binary-extensions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/body-parser": { "node_modules/body-parser": {
"version": "1.20.2", "version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
@ -133,6 +165,28 @@
"npm": "1.2.8000 || >= 1.4.16" "npm": "1.2.8000 || >= 1.4.16"
} }
}, },
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"license": "MIT",
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/bson": { "node_modules/bson": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
@ -176,6 +230,36 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"license": "MIT"
},
"node_modules/content-disposition": { "node_modules/content-disposition": {
"version": "0.5.4", "version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@ -428,6 +512,18 @@
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/finalhandler": { "node_modules/finalhandler": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
@ -464,6 +560,20 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@ -501,6 +611,18 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/gopd": { "node_modules/gopd": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
@ -513,6 +635,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/has-property-descriptors": { "node_modules/has-property-descriptors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
@ -589,6 +720,12 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"license": "ISC"
},
"node_modules/inherits": { "node_modules/inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@ -604,6 +741,48 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"license": "MIT",
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-property": { "node_modules/is-property": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
@ -809,6 +988,18 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/mongodb": { "node_modules/mongodb": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.8.0.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.8.0.tgz",
@ -1063,6 +1254,66 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/nodemon": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.5.tgz",
"integrity": "sha512-V5UtfYc7hjFD4SI3EzD5TR8ChAHEZ+Ns7Z5fBk8fAbTVAj+q3G+w7sHJrHxXBkVn6ApLVTljau8wfHwqmGUjMw==",
"license": "MIT",
"dependencies": {
"chokidar": "^3.5.2",
"debug": "^4",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^7.5.3",
"simple-update-notifier": "^2.0.0",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.5"
},
"bin": {
"nodemon": "bin/nodemon.js"
},
"engines": {
"node": ">=10"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/nodemon"
}
},
"node_modules/nodemon/node_modules/debug": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/nodemon/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/object-assign": { "node_modules/object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@ -1120,6 +1371,18 @@
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/process-nextick-args": { "node_modules/process-nextick-args": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@ -1139,6 +1402,12 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
"license": "MIT"
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@ -1217,6 +1486,18 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -1352,6 +1633,18 @@
"integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==", "integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/simple-update-notifier": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
"integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
"license": "MIT",
"dependencies": {
"semver": "^7.5.3"
},
"engines": {
"node": ">=10"
}
},
"node_modules/sparse-bitfield": { "node_modules/sparse-bitfield": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
@ -1394,6 +1687,30 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"license": "MIT",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/toidentifier": { "node_modules/toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@ -1403,6 +1720,15 @@
"node": ">=0.6" "node": ">=0.6"
} }
}, },
"node_modules/touch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",
"integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",
"license": "ISC",
"bin": {
"nodetouch": "bin/nodetouch.js"
}
},
"node_modules/tr46": { "node_modules/tr46": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
@ -1440,6 +1766,12 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/undefsafe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"license": "MIT"
},
"node_modules/unpipe": { "node_modules/unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",

View File

@ -23,6 +23,7 @@
"mysql": "^2.18.1", "mysql": "^2.18.1",
"mysql2": "^3.11.3", "mysql2": "^3.11.3",
"nodemailer": "^6.9.14", "nodemailer": "^6.9.14",
"nodemon": "^3.1.5",
"uuid": "^10.0.0" "uuid": "^10.0.0"
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,8 +42,8 @@
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> --> <!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js"></script>
<script type="module" crossorigin src="/assets/index-Bt6M0iua.js"></script> <script type="module" crossorigin src="/assets/index-vceAjfBL.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BrT2kTNU.css"> <link rel="stylesheet" crossorigin href="/assets/index-DPr78kNB.css">
</head> </head>

View File

@ -15,6 +15,7 @@ import Registrationsuccess from "./components/Registrationsuccess";
import PropertyView from "./components/PropertyView"; import PropertyView from "./components/PropertyView";
import SearchMysql from "./components/SearchMysql"; import SearchMysql from "./components/SearchMysql";
const App = () => { const App = () => {
return ( return (
<BrowserRouter> <BrowserRouter>
@ -57,6 +58,8 @@ const App = () => {
<Route path="/property/:id" element={<PropertyView />} /> <Route path="/property/:id" element={<PropertyView />} />
<Route path="/searchmyproperties" element={<SearchMysql />} /> <Route path="/searchmyproperties" element={<SearchMysql />} />
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>
); );

View File

@ -174,6 +174,7 @@ const Register = () => {
</div> </div>
</div> </div>
</div> </div>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<div className="row gy-3 overflow-hidden"> <div className="row gy-3 overflow-hidden">
{/* Radio buttons for Lender and Borrower */} {/* Radio buttons for Lender and Borrower */}

View File

@ -2,43 +2,228 @@ import { useEffect, useState } from "react";
import axios from "axios"; import axios from "axios";
import Navbar from "./Navbar"; import Navbar from "./Navbar";
import Footer from "./Footer"; import Footer from "./Footer";
import "../searchmysqlresults.css";
const SearchMysql = () => { const SearchMysql = () => {
const [properties, setProperties] = useState([]); const [properties, setProperties] = useState([]);
const [totalRecords, setTotalRecords] = useState(0);
const [page, setPage] = useState(0); // Page number
const [limit] = useState(10); // Items per page
// Fetch data from backend API const fetchProperties = async () => {
try {
const res = await axios.get(
`${import.meta.env.VITE_REACT_APP_SECRET}/mysql/searchmysql`,
{
params: { limit, offset: page * limit },
headers: { "Cache-Control": "no-cache" }, // Disable caching
}
);
setProperties(res.data);
setTotalRecords(res.data.total); // Get total records from backend
} catch (err) {
console.log("Error fetching data:", err);
}
};
// Fetch data when page changes
useEffect(() => { useEffect(() => {
const fetchAllProperties = async () => { fetchProperties();
try { }, [page]);
const res = await axios.get(`${import.meta.env.VITE_REACT_APP_SECRET}/mysql/searchmysql`);
setProperties(res.data); // Set the data to the state const totalPages = Math.ceil(totalRecords / limit);
} catch (err) {
console.log("Error fetching data:", err);
}
};
fetchAllProperties();
}, []);
return ( return (
<> <>
<Navbar /> <Navbar />
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
<p style={{ fontSize: "1.5rem", color: "#F74B02" }} > {/* Display properties */}
This is just a sample testing data to showcase the field named "client_name" present in table named : "client_info" available in the database named :"defaultdb". {properties.length > 0 ? (
</p> <div className="container col-12">
{/* Check if properties array is populated before mapping */} <div className="row">
{properties && properties.length > 0 ? ( <div className="col-lg-12 card-margin col-12">
properties.map((property, index) => ( <div className="card search-form col-12">
<div key={index} className="property"> <div className="card-body p-0">
<h2>{property.client_name}</h2> {/* Display client_name */} <form id="search-form">
<div className="row">
<div className="col-12">
<div className="row no-gutters">
<div className="col-lg-8 col-md-6 col-sm-12 p-0">
<input
type="text"
placeholder="Search..."
className="form-control"
id="search"
name="search"
/>
</div>
<div className="col-lg-1 col-md-3 col-sm-12 p-0"></div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div> </div>
)) <div className="row">
<div className="col-12">
<div className="card card-margin">
<div className="card-body">
<div className="row search-body">
<div className="col-lg-12">
<div className="search-result col-12">
<div className="result-header">
<div className="row">
<div className="col-lg-6">
<div className="records">
{/* Pagination Controls */}
<div>
<button
onClick={() => setPage(page - 1)}
disabled={page === 0}
>
Previous
</button>
<span>
{" "}
Page {page + 1} of {totalPages}{" "}
</span>
<button
onClick={() => setPage(page + 1)}
disabled={page + 1 >= totalPages}
>
Next
</button>
</div>
</div>
</div>
</div>
</div>
<div className="result-body">
<div className="table-responsive">
<table className="table widget-26">
<tbody>
{properties.map((property, index) => (
<div key={index} className="property">
<tr>
<td>
<div className="widget-26-job-emp-img">
<img
src="https://bootdey.com/img/Content/avatar/avatar2.png"
alt="Company"
/>
</div>
</td>
<td>
<div className="widget-26-job-title">
<a href="#">{property.address}</a>
<p className="m-0">
<span
className="employer-name"
>
{property.city}, {property.county}, {property.state}
</span>{" "}
<p className="text-muted m-0">
House Id: {property.house_id}
</p>
</p>
</div>
</td>
<td>
<div className="widget-26-job-info">
<p className="type m-0">Total Living Square foot</p>
<p className="text-muted m-0">
is{" "}
<span className="location">
{property.total_living_sqft}
</span>
</p>
</div>
</td>
<td>
<div className="widget-26-job-salary">
$ {property.cost_per_sqft}/sqft
</div>
</td>
<td>
<div className="widget-26-job-info">
<p className="type m-0">Year built</p>
<p className="text-muted m-0">
<span className="location">
{property.year_built}
</span>
</p>
</div>
</td>
{/* <td>
<div className="widget-26-job-starred">
<a href="#">
<svg
xmlns="http://www.w3.org/2000/svg"
width={24}
height={24}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
className="feather feather-star"
>
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
</svg>
</a>
</div>
</td> */}
</tr>
<hr style={{color: "#fda417"}} />
</div>
))}
{/* Pagination Controls */}
<div>
<button
onClick={() => setPage(page - 1)}
disabled={page === 0}
>
Previous
</button>
<span>
{" "}
Page {page + 1} of {totalPages}{" "}
</span>
<button
onClick={() => setPage(page + 1)}
disabled={page + 1 >= totalPages}
>
Next
</button>
</div>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
) : ( ) : (
<p>No properties found.</p> <p>No properties found.</p>
)} )}
{/* Pagination Controls */}
<Footer /> <Footer />
</> </>
); );
}; };

View File

@ -1,7 +1,7 @@
import { StrictMode } from 'react' import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client' import { createRoot } from 'react-dom/client'
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import store from "./redux/store"; import store from './redux/store';
import App from './App.jsx' import App from './App.jsx'
import './index.css' import './index.css'

View File

@ -38,6 +38,9 @@ export const fetchPropertyById = createAsyncThunk(
} }
); );
const propertySlice = createSlice({ const propertySlice = createSlice({
name: 'property', name: 'property',
initialState: { initialState: {
@ -46,6 +49,10 @@ const propertySlice = createSlice({
error: null, error: null,
userProperties: [], userProperties: [],
selectedProperty: null, selectedProperty: null,
}, },
reducers: {}, reducers: {},
extraReducers: (builder) => { extraReducers: (builder) => {
@ -84,8 +91,13 @@ const propertySlice = createSlice({
.addCase(fetchPropertyById.rejected, (state, action) => { .addCase(fetchPropertyById.rejected, (state, action) => {
state.status = "failed"; state.status = "failed";
state.error = action.payload; state.error = action.payload;
}); })
;
}, },
}); });
export default propertySlice.reducer; export default propertySlice.reducer;

View File

@ -0,0 +1,257 @@
body{
background:#dcdcdc;
margin-top:20px;}
.widget-26 {
color: #3c4142;
font-weight: 400;
}
.widget-26 tr:first-child td {
border: 0;
}
.widget-26 .widget-26-job-emp-img img {
width: 35px;
height: 35px;
border-radius: 50%;
}
.widget-26 .widget-26-job-title {
min-width: 200px;
}
.widget-26 .widget-26-job-title a {
font-weight: 400;
font-size: 0.975rem;
color: #3c4142;
line-height: 1.5;
}
.widget-26 .widget-26-job-title a:hover {
color: #68CBD7;
text-decoration: none;
}
.widget-26 .widget-26-job-title .employer-name {
margin: 0;
line-height: 1.5;
font-weight: 400;
color: #3c4142;
font-size: 0.9125rem;
color: #3c4142;
}
.widget-26 .widget-26-job-title .employer-name:hover {
color: #68CBD7;
text-decoration: none;
}
.widget-26 .widget-26-job-title .time {
font-size: 14px;
font-weight: 400;
}
.widget-26 .widget-26-job-info {
min-width: 100px;
font-weight: 400;
}
.widget-26 .widget-26-job-info p {
line-height: 1.5;
color: #3c4142;
font-size: 0.9125rem;
}
.widget-26 .widget-26-job-info .location {
color: #3c4142;
}
.widget-26 .widget-26-job-salary {
min-width: 70px;
font-weight: 400;
color: #3c4142;
font-size: 0.9125rem;
}
.widget-26 .widget-26-job-category {
padding: .5rem;
display: inline-flex;
white-space: nowrap;
border-radius: 15px;
}
.widget-26 .widget-26-job-category .indicator {
width: 13px;
height: 13px;
margin-right: .5rem;
float: left;
border-radius: 50%;
}
.widget-26 .widget-26-job-category span {
font-size: 0.8125rem;
color: #3c4142;
font-weight: 600;
}
.widget-26 .widget-26-job-starred svg {
width: 20px;
height: 20px;
color: #fd8b2c;
}
.widget-26 .widget-26-job-starred svg.starred {
fill: #fd8b2c;
}
.bg-soft-base {
background-color: #e1f5f7;
}
.bg-soft-warning {
background-color: #fff4e1;
}
.bg-soft-success {
background-color: #d1f6f2;
}
.bg-soft-danger {
background-color: #fedce0;
}
.bg-soft-info {
background-color: #d7efff;
}
.search-form {
width: 80%;
margin: 0 auto;
margin-top: 1rem;
}
.search-form input {
height: 100%;
background: transparent;
border: 0;
display: block;
width: 100%;
padding: 1rem;
height: 100%;
font-size: 1rem;
}
.search-form select {
background: transparent;
border: 0;
padding: 1rem;
height: 100%;
font-size: 1rem;
}
.search-form select:focus {
border: 0;
}
.search-form button {
height: 100%;
width: 100%;
font-size: 1rem;
}
.search-form button svg {
width: 24px;
height: 24px;
}
.search-body {
margin-bottom: 1.5rem;
}
.search-body .search-filters .filter-list {
margin-bottom: 1.3rem;
}
.search-body .search-filters .filter-list .title {
color: #3c4142;
margin-bottom: 1rem;
}
.search-body .search-filters .filter-list .filter-text {
color: #727686;
}
.search-body .search-result .result-header {
margin-bottom: 2rem;
}
.search-body .search-result .result-header .records {
color: #3c4142;
}
.search-body .search-result .result-header .result-actions {
text-align: right;
display: flex;
align-items: center;
justify-content: space-between;
}
.search-body .search-result .result-header .result-actions .result-sorting {
display: flex;
align-items: center;
}
.search-body .search-result .result-header .result-actions .result-sorting span {
flex-shrink: 0;
font-size: 0.9125rem;
}
.search-body .search-result .result-header .result-actions .result-sorting select {
color: #68CBD7;
}
.search-body .search-result .result-header .result-actions .result-sorting select option {
color: #3c4142;
}
@media (min-width: 768px) and (max-width: 991.98px) {
.search-body .search-filters {
display: flex;
}
.search-body .search-filters .filter-list {
margin-right: 1rem;
}
}
.card-margin {
margin-bottom: 1.875rem;
}
@media (min-width: 992px){
.col-lg-2 {
flex: 0 0 16.66667%;
max-width: 16.66667%;
}
}
.card-margin {
margin-bottom: 1.875rem;
}
.card {
border: 0;
box-shadow: 0px 0px 10px 0px rgba(82, 63, 105, 0.1);
-webkit-box-shadow: 0px 0px 10px 0px rgba(82, 63, 105, 0.1);
-moz-box-shadow: 0px 0px 10px 0px rgba(82, 63, 105, 0.1);
-ms-box-shadow: 0px 0px 10px 0px rgba(82, 63, 105, 0.1);
}
.card {
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #ffffff;
background-clip: border-box;
border: 1px solid #e6e4e9;
border-radius: 8px;
}