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