|
|
|
|
@ -351,6 +351,7 @@ exports.getTanksofParticularInstaller = async (req, reply) => {
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getTankmotordata = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { startDate, stopDate } = req.body;
|
|
|
|
|
@ -367,12 +368,12 @@ exports.getTankmotordata = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
// Fetch the name from the User collection based on customerId, only from profile
|
|
|
|
|
const user = await User.findOne({ customerId })
|
|
|
|
|
.select("profile.firstName profile.lastName");
|
|
|
|
|
.select("username");
|
|
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
|
// Get the full name (combine firstName and lastName if available)
|
|
|
|
|
const userName = user.profile.firstName && user.profile.lastName
|
|
|
|
|
? `${user.profile.firstName} ${user.profile.lastName}`
|
|
|
|
|
const userName = user.username
|
|
|
|
|
? `${user.username}`
|
|
|
|
|
: "N/A"; // Fallback if no name is found
|
|
|
|
|
|
|
|
|
|
// Construct the query object for motor data based on customerId
|
|
|
|
|
|