master^2
Bhaskar 3 months ago
parent b5ca5672d5
commit f6aaa50e53

@ -9996,7 +9996,7 @@ if (!orders.length) {
exports.sendToStoreHardwareList = async (req, reply) => {
try {
const { supportId, customerId } = req.params;
const { storeId } = req.body;
const { storeId, type } = req.body;
if (!supportId || !customerId) {
return reply.code(400).send({ error: "supportId and customerId are required in path params" });
@ -10156,6 +10156,7 @@ exports.sendToStoreHardwareList = async (req, reply) => {
}
// ✅ Step: Update storeId in Orders where matching master_connections.hardwareId
// ✅ Step: Update storeId and type in Orders where matching master_connections.hardwareId
const updatedHardwareIds = disconnectedIssues.map(item => item.hardwareId);
await Order.updateMany(
{
@ -10163,7 +10164,10 @@ exports.sendToStoreHardwareList = async (req, reply) => {
"master_connections.hardwareId": { $in: updatedHardwareIds }
},
{
$set: { storeId }
$set: {
storeId,
type: type // Fallback if type is not passed
}
}
);

@ -830,6 +830,7 @@ const orderSchema = new mongoose.Schema({
switch_type_quantity_price: { type: String, default: null },
switch_type_total_price: { type: String, default: null },
qutation_total_price: { type: String, default: null },
type: { type: String, default: null },
status: { type: String, default: "pending" },
quatation_status: { type: String, default: "pending" },

@ -910,6 +910,8 @@ module.exports = function (fastify, opts, next) {
required: ["storeId"],
properties: {
storeId: { type: "string" },
type: { type: "string" },
},
},
},

Loading…
Cancel
Save