Page MenuHomeDevCentral

No OneTemporary

diff --git a/backend/servpulse-backend/controllers/incidentController.js b/backend/servpulse-backend/controllers/incidentController.js
index ee48a43..aa580a1 100644
--- a/backend/servpulse-backend/controllers/incidentController.js
+++ b/backend/servpulse-backend/controllers/incidentController.js
@@ -1,18 +1,15 @@
-// incidentController.js
const incidentModel = require('../models/incidentModel.js');
const incidentServiceModel = require('../models/incidentServiceModel.js');
const incidentPostModel = require('../models/incidentPostModel.js');
const incidentPostStatusModel = require('../models/incidentPostStatusModel.js');
const getIncidents = async (req, res) => {
try {
const incidents = await incidentModel.getIncidents();
res.status(200).json(incidents);
} catch (error) {
res.status(500).json({ message: 'Error fetching services', error: error.message });
}
};
-// ... CRUD methods for incident controller using the respective models
-
-module.exports = { getIncidents, /* ... CRUD methods for incident controller */ };
+module.exports = { getIncidents };
diff --git a/backend/servpulse-backend/controllers/serviceController.js b/backend/servpulse-backend/controllers/serviceController.js
index fafa209..7e0915e 100644
--- a/backend/servpulse-backend/controllers/serviceController.js
+++ b/backend/servpulse-backend/controllers/serviceController.js
@@ -1,26 +1,23 @@
-// serviceController.js
const serviceModel = require('../models/serviceModel.js');
const addService = async (req, res) => {
try {
const serviceData = req.body;
const result = await serviceModel.addService(serviceData);
res.status(201).json(result);
} catch (error) {
res.status(500).json({ message: 'Error creating service', error: error.message });
}
};
const getServices = async (req, res) => {
try {
const services = await serviceModel.getServices();
res.status(200).json(services);
} catch (error) {
res.status(500).json({ message: 'Error fetching services', error: error.message });
}
};
-// ... other CRUD methods for service controller
-
-module.exports = { addService, getServices, /* ... other CRUD methods */ };
+module.exports = { addService, getServices };
diff --git a/backend/servpulse-backend/models/incidentModel.js b/backend/servpulse-backend/models/incidentModel.js
index 67e480d..32da632 100644
--- a/backend/servpulse-backend/models/incidentModel.js
+++ b/backend/servpulse-backend/models/incidentModel.js
@@ -1,14 +1,17 @@
-// incidentModel.js
const pool = require('../config/database.js');
const createIncident = async (data) => {
- return await pool.query('INSERT INTO incident (title, start_date, update_date, type_id, status) VALUES (\$1, \$2, \$3, \$4, \$5) RETURNING *', [data.title, data.start_date, data.update_date, data.type_id, data.status]);
-};
+ return await pool.query(`
+ INSERT INTO incident (title, start_date, update_date, type_id, status)
+ VALUES (\$1, \$2, \$3, \$4, \$5)
+ RETURNING *
+ `, [data.title, data.start_date, data.update_date, data.type_id, data.status]);
+ };
const getIncidents = async () => {
- return await pool.query('SELECT * FROM incident;');
+ return await pool.query(`
+ SELECT * FROM incident;
+ `);
};
-// ... other CRUD methods for incident table
-
-module.exports = { createIncident, getIncidents /* ... other CRUD methods */ };
+module.exports = { createIncident, getIncidents };
diff --git a/backend/servpulse-backend/models/serviceModel.js b/backend/servpulse-backend/models/serviceModel.js
index c4dc16f..4745295 100644
--- a/backend/servpulse-backend/models/serviceModel.js
+++ b/backend/servpulse-backend/models/serviceModel.js
@@ -1,14 +1,18 @@
-// serviceModel.js
const pool = require('../config/database.js');
const addService = async (data) => {
- return await pool.query('INSERT INTO service (name, "group", description, status) VALUES (\$1, \$2, \$3, \$4) RETURNING *', [data.name, data.group, data.description, data.status]);
+ return await pool.query(`
+ INSERT INTO service
+ (name, "group", description, status)
+ VALUES (\$1, \$2, \$3, \$4)
+ RETURNING *
+ `, [data.name, data.group, data.description, data.status]);
};
const getServices = async () => {
- return await pool.query('SELECT * FROM service;');
+ return await pool.query(`
+ SELECT * FROM service;
+ `);
};
-// ... other CRUD methods for service table
-
-module.exports = { addService, getServices, /* ... other CRUD methods */ };
+module.exports = { addService, getServices };
diff --git a/backend/servpulse-backend/routes/incidentRoutes.js b/backend/servpulse-backend/routes/incidentRoutes.js
index 3b518b7..5dc1503 100644
--- a/backend/servpulse-backend/routes/incidentRoutes.js
+++ b/backend/servpulse-backend/routes/incidentRoutes.js
@@ -1,10 +1,7 @@
-// incidentRoutes.js
const express = require('express');
const router = express.Router();
const incidentController = require('../controllers/incidentController.js');
router.get('/incident/getAll', incidentController.getIncidents);
-// ... other routes for incident controller
-
module.exports = router;
diff --git a/backend/servpulse-backend/routes/serviceRoutes.js b/backend/servpulse-backend/routes/serviceRoutes.js
index f8cbc62..cd507ed 100644
--- a/backend/servpulse-backend/routes/serviceRoutes.js
+++ b/backend/servpulse-backend/routes/serviceRoutes.js
@@ -1,11 +1,8 @@
-// serviceRoutes.js
const express = require('express');
const router = express.Router();
const serviceController = require('../controllers/serviceController.js');
router.get('/service/getAll', serviceController.getServices);
router.post('/service', serviceController.addService);
-// ... other routes for service controller
-
module.exports = router;

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 12:14 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2256406
Default Alt Text
(5 KB)

Event Timeline