|
|
@ -2323,7 +2323,7 @@ exports.motortemperature = async (req, reply) => {
|
|
|
|
exports.update_auto_mode = async (req, reply) => {
|
|
|
|
exports.update_auto_mode = async (req, reply) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const customerId = req.params.customerId;
|
|
|
|
const customerId = req.params.customerId;
|
|
|
|
const { motor_id, auto_min_percentage, auto_max_percentage, auto_mode } = req.body;
|
|
|
|
const { motor_id, auto_mode } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
// Update inputConnections' auto_mode
|
|
|
|
// Update inputConnections' auto_mode
|
|
|
|
await Tank.updateOne(
|
|
|
|
await Tank.updateOne(
|
|
|
@ -2331,9 +2331,25 @@ exports.update_auto_mode = async (req, reply) => {
|
|
|
|
{ $set: { "connections.inputConnections.$.auto_mode": auto_mode } }
|
|
|
|
{ $set: { "connections.inputConnections.$.auto_mode": auto_mode } }
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reply.send({ status_code: 200, message: "Auto mode and percentages updated successfully." });
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
throw boom.boomify(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.update_auto_percentage = async (req, reply) => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const customerId = req.params.customerId;
|
|
|
|
|
|
|
|
const { tankName,tankLocation, auto_min_percentage, auto_max_percentage } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update inputConnections' auto_mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update auto_min_percentage and auto_max_percentage
|
|
|
|
// Update auto_min_percentage and auto_max_percentage
|
|
|
|
await Tank.updateMany(
|
|
|
|
await Tank.updateOne(
|
|
|
|
{ customerId: customerId },
|
|
|
|
{ customerId: customerId,tankLocation, tankName},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$set: {
|
|
|
|
$set: {
|
|
|
|
"auto_min_percentage": auto_min_percentage,
|
|
|
|
"auto_min_percentage": auto_min_percentage,
|
|
|
@ -2347,4 +2363,3 @@ exports.update_auto_mode = async (req, reply) => {
|
|
|
|
throw boom.boomify(error);
|
|
|
|
throw boom.boomify(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|