Skip to content

Commit e43e2f4

Browse files
Fix : Minor changes
1 parent 3c65371 commit e43e2f4

File tree

6 files changed

+26
-9
lines changed

6 files changed

+26
-9
lines changed

controllers/landformData.controller.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports.postLandformData = asyncHandler(async (req, res) => {
3838
const landformData = req.body;
3939
const date = new Date();
4040
const today = new Date(date.getFullYear(), date.getMonth(), date.getDate()).toLocaleDateString('en-CA');
41-
//console.log("Received landform data:", landformData);
41+
console.log("Received landform data:", landformData);
4242

4343
const safe = (value) => value === undefined ? null : value;
4444

@@ -345,6 +345,10 @@ exports.updateLandformData = asyncHandler(async (req, res) => {
345345
if (results.affectedRows > 0) {
346346
res.status(200).json({ message: "Form data updated successfully" });
347347
}
348+
else{
349+
console.log("form not found");
350+
res.status(404).json({ message: "Form not found" });
351+
}
348352
await connection.commit();
349353
} catch (err) {
350354
res.status(500).json({ error: err.message });

controllers/pondformData.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.postPondformData = asyncHandler(async (req, res) => {
3535
const pondformData = req.body;
3636
const date = new Date();
3737
const today = new Date(date.getFullYear(), date.getMonth(), date.getDate()).toLocaleDateString('en-CA');
38-
// console.log("Received landform data:", pondformData);
38+
console.log("Received landform data:", pondformData);
3939

4040
const safe = (value) => value === undefined ? null : value;
4141

controllers/previewformsData.controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ exports.getpreviewspecificformData = asyncHandler( async (req, res) => {
217217
getlandownwershipdetail_land_sql,
218218
[id]
219219
);
220-
console.log("land:",landOwnership);
220+
//console.log("land:",landOwnership);
221221
} else if (form_type == 2) {
222222
//fetch pond form
223223
[[landDevelopment]] = await connection.execute(
@@ -228,7 +228,7 @@ exports.getpreviewspecificformData = asyncHandler( async (req, res) => {
228228
getlandownwershipdetail_pond_sql,
229229
[id]
230230
);
231-
console.log("pond:",landOwnership);
231+
//console.log("pond:",landOwnership);
232232
} else if (form_type == 3) {
233233
//fetch plantation form
234234
[[landDevelopment]] = await connection.execute(
@@ -239,7 +239,7 @@ exports.getpreviewspecificformData = asyncHandler( async (req, res) => {
239239
getlandownwershipdetail_plant_sql,
240240
[id]
241241
);
242-
console.log("plantation:",landOwnership);
242+
//console.log("plantation:",landOwnership);
243243
//console.log(landDevelopment);
244244
} else {
245245
return res.status(400).json({ error: 'Unknown form type' });

controllers/users.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const asyncHandler = require("../middlewares/asyncHandler");
44
const authUser_sql = `
55
SELECT
66
CASE
7-
WHEN EXISTS (
7+
WHEN EXISTS (
88
SELECT * FROM users WHERE email = ? AND password = ?
99
)
1010
THEN '1'

routes/dashboardData.route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const router = express.Router();
33
const { getTotalFormsStatusCount, getTodayFormsStatusCount } = require("../controllers/dashboardData.controller");
44
const { getpreviewformsData, getpreviewspecificformData } = require("../controllers/previewformsData.controller");
55

6-
6+
//fetch forms stats
77
router.route('/getTotalFormsStatusCount').get(getTotalFormsStatusCount);
88
router.route('/getTodayFormsStatusCount').get(getTodayFormsStatusCount);
99

10-
//forms fetch for preview
10+
//forms data fetch for preview
1111
router.route('/getpreviewformsData').get(getpreviewformsData);
1212
router.route('/getpreviewspecificformData').get(getpreviewspecificformData);
1313

routes/formData.route.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@ const router = express.Router();
33
const {postLandformData} = require("../controllers/landformData.controller");
44
const {postPondformData} = require("../controllers/pondformData.controller");
55
const {postPlantationformData} = require("../controllers/plantationformData.controller");
6+
const {updateLandformData} = require("../controllers/landformData.controller");
7+
const { getpf_landformData } = require("../controllers/pf_landformData.contoller");
8+
const { getpf_pondformData } = require("../controllers/pf_pondformData.controller");
9+
const { getpf_plantationformData } = require("../controllers/pf_plantationformData.controller");
10+
const {updatepf_landformData} = require("../controllers/pf_landformData.contoller");
611

712

813
//forms submission routes
914
router.route('/postLandformData').post(postLandformData);
1015
router.route('/postPondformData').post(postPondformData);
1116
router.route('/postPlantationformData').post(postPlantationformData);
1217

13-
//forms fetch routes
18+
//forms update routes
19+
router.route('/updateLandformData').put(updateLandformData);
1420

21+
//fetch postfunding forms routes
22+
router.route('/getpf_landformData').get(getpf_landformData);
23+
router.route('/getpf_pondformData').get(getpf_pondformData);
24+
router.route('/getpf_plantationformData').get(getpf_plantationformData);
25+
26+
//update postfunding forms routes
27+
router.route('/updatepf_landformData').put(updatepf_landformData);
1528

1629
module.exports = router;

0 commit comments

Comments
 (0)