ashok 4 months ago
commit e740d7d6a7

@ -6685,40 +6685,44 @@ exports.getDisconnectedMoveCustomerDetails = async (req, reply) => {
const combinedCustomerList = users.map(user => {
const cid = user.customerId;
return {
customerId: cid,
connectionStatus: customerStatusMap[cid]?.status || "unknown",
username: user.username || "",
firstName: user.profile?.firstName || user.firstName || "",
lastName: user.profile?.lastName || user.lastName || "",
phone: user.phone || user.profile?.contactNumber || user.alternativeNumber || "",
email: user.emails?.[0]?.email || user.email || "",
phoneVerified: user.phoneVerified || false,
address1: user.profile?.address1 || user.address1 || "",
address2: user.profile?.address2 || user.address2 || "",
city: user.profile?.city || user.city || "",
state: user.profile?.state || user.state || "",
country: user.profile?.country || user.country || "",
zip: user.profile?.zip || "",
notes: user.profile?.notes || "",
latitude: user.latitude || 0,
longitude: user.longitude || 0,
fcmIds: (user.fcmIds || []).filter(fcm => typeof fcm === "string" && fcm.startsWith("d")),
installationId: user.installationId || "",
notificationPreferences: {
allowNotifications: user.allowNotifications || false,
automaticStartAndStopNotify: user.automaticStartAndStopNotify || false,
manualStartAndStopNotify: user.manualStartAndStopNotify || false,
criticalLowWaterAlert: user.criticalLowWaterAlert || false,
lowWaterAlert: user.lowWaterAlert || false,
notificationPreference: user.notificationPreference || "never"
},
surveyStatus: user.survey_status || "pending",
buildingName: user.buildingName || "",
stripePaymentStatus: user.stripePaymentStatus || false,
stripeSubscriptionStatus: user.stripeSubscriptionStatus || false,
createdAt: user.createdAt,
updatedAt: user.updatedAt
};
customer : {
customerId: cid,
connectionStatus: customerStatusMap[cid]?.status || "unknown",
username: user.username || "",
firstName: user.profile?.firstName || user.firstName || "",
lastName: user.profile?.lastName || user.lastName || "",
phone: user.phone || user.profile?.contactNumber || user.alternativeNumber || "",
email: user.emails?.[0]?.email || user.email || "",
phoneVerified: user.phoneVerified || false,
address1: user.profile?.address1 || user.address1 || "",
address2: user.profile?.address2 || user.address2 || "",
city: user.profile?.city || user.city || "",
state: user.profile?.state || user.state || "",
country: user.profile?.country || user.country || "",
zip: user.profile?.zip || "",
notes: user.profile?.notes || "",
latitude: user.latitude || 0,
longitude: user.longitude || 0,
fcmIds: (user.fcmIds || []).filter(fcm => typeof fcm === "string" && fcm.startsWith("d")),
installationId: user.installationId || "",
notificationPreferences: {
allowNotifications: user.allowNotifications || false,
automaticStartAndStopNotify: user.automaticStartAndStopNotify || false,
manualStartAndStopNotify: user.manualStartAndStopNotify || false,
criticalLowWaterAlert: user.criticalLowWaterAlert || false,
lowWaterAlert: user.lowWaterAlert || false,
notificationPreference: user.notificationPreference || "never"
},
surveyStatus: user.survey_status || "pending",
buildingName: user.buildingName || "",
stripePaymentStatus: user.stripePaymentStatus || false,
stripeSubscriptionStatus: user.stripeSubscriptionStatus || false,
createdAt: user.createdAt,
updatedAt: user.updatedAt
}
};
});
return reply.send({

Loading…
Cancel
Save