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 Sales Data",
"Update Inventory Data", "Update Inventory Data",
"Collect KYC", "Collect KYC",
"Update Sales",
].includes(task) ].includes(task)
) { ) {
return res.status(400).json({ return res.status(400).json({

View File

@ -12,7 +12,7 @@ const TaskSchema = new mongoose.Schema(
task: { task: {
type: String, type: String,
required: true, 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: { note: {
type: String, type: String,
@ -49,20 +49,20 @@ const TaskSchema = new mongoose.Schema(
type: String, type: String,
enum: ['PrincipalDistributor', 'RetailDistributor'], enum: ['PrincipalDistributor', 'RetailDistributor'],
required: function () { 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: { addedForId: {
type: mongoose.Schema.Types.ObjectId, type: mongoose.Schema.Types.ObjectId,
refPath: 'addedFor', refPath: 'addedFor',
required: function () { 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: { tradename: {
type: String, type: String,
required: function () { 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";
}, },
}, },
}, },