Sales Update

This commit is contained in:
Sibunnayak 2024-09-05 09:46:08 +05:30
parent 85c2c7ddaa
commit 20748ccd5d
2 changed files with 4 additions and 5 deletions

View File

@ -210,7 +210,6 @@ export const getTasksbytask = async (req, res) => {
"Update Sales Data",
"Update Inventory Data",
"Collect KYC",
"Update Sales",
].includes(task)
) {
return res.status(400).json({

View File

@ -12,7 +12,7 @@ const TaskSchema = new mongoose.Schema(
task: {
type: String,
required: true,
enum: ["Visit RD/PD", "Update Sales Data", "Update Inventory Data", "Collect KYC","Update Sales"],
enum: ["Visit RD/PD", "Update Sales Data", "Update Inventory Data", "Collect KYC"],
},
note: {
type: String,
@ -49,20 +49,20 @@ const TaskSchema = new mongoose.Schema(
type: String,
enum: ['PrincipalDistributor', 'RetailDistributor'],
required: function () {
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales";
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales Data";
},
},
addedForId: {
type: mongoose.Schema.Types.ObjectId,
refPath: 'addedFor',
required: function () {
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales";
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales Data";
},
},
tradename: {
type: String,
required: function () {
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales";
return this.task === "Update Inventory Data" || this.task === "Visit RD/PD" || this.task === "Update Sales Data";
},
},
},