Merge branch 'fix-realtime-timeline-on-staging' into 'master'

fixed realtime not working on staging

See merge request fyipe-project/app!1809
This commit is contained in:
Nawaz Dhandala
2021-03-18 16:59:05 +00:00
5 changed files with 15 additions and 7 deletions

View File

@@ -82,9 +82,10 @@ router.get(
async function(req, res) {
try {
const idNumber = req.params.incidentId;
const incidentId = await IncidentService.getIncidentId({
let incidentId = await IncidentService.getIncidentId({
idNumber,
});
incidentId = incidentId._id;
const skip = req.query.skip || 0;
const limit = req.query.limit || 10;
const alerts = await alertService.findBy({

View File

@@ -29,6 +29,7 @@ const sendItemResponse = require('../middlewares/response').sendItemResponse;
const subscriberAlertService = require('../services/subscriberAlertService');
const onCallScheduleStatusService = require('../services/onCallScheduleStatusService');
const Services = require('../utils/services');
const { lessThan } = require('../utils/DateTime');
// Route
// Description: Creating incident.
@@ -277,9 +278,10 @@ router.get(
// Call the IncidentService.
try {
const incidentId = await IncidentService.getIncidentId({
let incidentId = await IncidentService.getIncidentId({
idNumber: req.params.incidentId,
});
incidentId = incidentId._id;
const incident = await IncidentService.findOneBy({
_id: incidentId,
});
@@ -920,9 +922,10 @@ router.get(
try {
let incidentMessages, result;
const idNumber = req.params.incidentId;
const incidentId = await IncidentService.getIncidentId({
let incidentId = await IncidentService.getIncidentId({
idNumber,
});
incidentId = incidentId._id;
const projectId = req.params.projectId;
if (type === 'investigation') {
incidentMessages = await IncidentMessageService.findBy(

View File

@@ -99,7 +99,8 @@ router.get('/:projectId/incident/:incidentId', async (req, res) => {
try {
const projectId = req.params.projectId;
const idNumber = req.params.incidentId;
const incidentId = await IncidentService.getIncidentId({ idNumber });
let incidentId = await IncidentService.getIncidentId({ idNumber });
incidentId = incidentId._id;
const skip = req.query.skip || 0;
const limit = req.query.limit || 10;
const subscriberAlerts = await SubscriberAlertService.findBy(

View File

@@ -267,8 +267,8 @@ module.exports = {
getIncidentId: async function(query) {
try {
const incidentId = await IncidentModel.findOne(query);
return incidentId._id;
const incident = await IncidentModel.findOne(query);
return incident;
} catch (error) {
ErrorService.log('incidentService.getIncidentId', error);
throw error;

View File

@@ -35,9 +35,12 @@ module.exports = {
? project.parentProjectId._id
: project._id
: timeline.projectId;
const { idNumber } = await IncidentService.getIncidentId({
_id: timeline.incidentId,
});
const data = {
incidentId: timeline.incidentId,
incidentId: idNumber,
incidentMessages: timeline.data,
count: timeline.data.length,
type: 'internal',